Activities
An activity is a learner-facing step inside a lesson. It has a kind, a
free-form spec (jsonb config), a rubric (jsonb grading), and an ordinal.
kind is one of ten: diagram, document, quiz, code, concept,
single_choice, multi_choice, match, order, video. See
the lesson model → activity kinds for what each means.
list_activities
Section titled “list_activities”List the activities of a lesson, ordered by ordinal. RLS-scoped.
Inputs:
| Arg | Type | Notes |
|---|---|---|
lesson_id | uuid | required |
Result: { "activities": [ { "id", "lesson_id", "ordinal", "kind", "spec", "rubric" }, … ] }
get_activity
Section titled “get_activity”Fetch one activity (kind, spec, rubric). RLS-scoped.
Inputs:
| Arg | Type | Notes |
|---|---|---|
activity_id | uuid | required |
Result: { "activity": { "id", "lesson_id", "ordinal", "kind", "spec", "rubric" } }
create_activity
Section titled “create_activity”Add an activity to a lesson. Author-role only.
Inputs:
| Arg | Type | Notes |
|---|---|---|
lesson_id | uuid | Parent lesson. |
kind | enum | One of the ten kinds above. |
ordinal? | int ≥ 0 | Sort position (default 0). |
spec? | jsonb | Kind-specific config (default {}). |
rubric? | jsonb | Grading rubric (default {}). |
Result: { "success": true, "activity": { "id", "lesson_id", "kind", "ordinal", "spec", "rubric" } }
{ "lesson_id": "…", "kind": "single_choice", "ordinal": 0, "spec": { "prompt": "Default Kafka consumer-group delivery guarantee?", "options": [ { "id": "a", "label": "Exactly-once" }, { "id": "b", "label": "At-least-once" } ], "answer": "b" }}update_activity
Section titled “update_activity”Update an activity’s kind / ordinal / spec / rubric. Author-role only.
Only provided fields change.
Inputs:
| Arg | Type | Notes |
|---|---|---|
activity_id | uuid | required |
kind? | enum | One of the ten kinds. |
ordinal? | int ≥ 0 | |
spec? | jsonb | Replaces the stored spec. |
rubric? | jsonb | Replaces the stored rubric. |
Result: { "success": true, "activity": {…} }
delete_activity
Section titled “delete_activity”Delete an activity. Author-role only. Irreversible.
Inputs:
| Arg | Type | Notes |
|---|---|---|
activity_id | uuid | required |
Result: { "success": true, "deleted": "<activity_id>" }