diff --git a/compose.yaml b/compose.yaml index 7541af0..d1de98f 100644 --- a/compose.yaml +++ b/compose.yaml @@ -8,4 +8,6 @@ services: - ${PORT-8000}:8000 environment: - MOODLE_URL=${MOODLE_URL} + - ALLOW_ORIGINS=${ALLOW_ORIGINS} + - LOG_LEVEL=${LOG_LEVEL} restart: unless-stopped diff --git a/src/config/_webservice_rest_server-php/Completion/core_completion_get_activities_completion_status.json b/src/config/_webservice_rest_server-php/Completion/core_completion_get_activities_completion_status.json new file mode 100644 index 0000000..e02dd52 --- /dev/null +++ b/src/config/_webservice_rest_server-php/Completion/core_completion_get_activities_completion_status.json @@ -0,0 +1,214 @@ +{ + "method": "GET", + "description": "Get completion status for activities in a course", + "query_params": [ + { + "name": "courseid", + "type": "int", + "required": true, + "description": "Course ID" + }, + { + "name": "userid", + "type": "int", + "required": false, + "description": "User ID (defaults to current user if not specified)" + } + ], + "responses": { + "200": { + "description": "List of activities with completion status", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statuses": { + "type": "array", + "items": { + "type": "object", + "properties": { + "cmid": { + "type": "integer", + "description": "Course module ID" + }, + "modname": { + "type": "string", + "description": "Module name (e.g., resource, assign, quiz, label, url, feedback)" + }, + "instance": { + "type": "integer", + "description": "Instance ID" + }, + "state": { + "type": "integer", + "description": "Completion state (0=incomplete, 1=complete, 2=complete with pass)" + }, + "timecompleted": { + "type": "integer", + "description": "Timestamp when completed (0 if not completed)" + }, + "tracking": { + "type": "integer", + "description": "Completion tracking type (1=manual, 2=automatic)" + }, + "overrideby": { + "type": ["integer", "null"], + "description": "User ID who overrode completion (null if not overridden)" + }, + "valueused": { + "type": "boolean", + "description": "Whether this completion is used for course completion" + }, + "hascompletion": { + "type": "boolean", + "description": "Whether the activity has completion enabled" + }, + "isautomatic": { + "type": "boolean", + "description": "Whether completion is automatic" + }, + "istrackeduser": { + "type": "boolean", + "description": "Whether the user is tracked for completion" + }, + "uservisible": { + "type": "boolean", + "description": "Whether the activity is visible to the user" + }, + "details": { + "type": "array", + "description": "Array of completion rule details", + "items": { + "type": "object", + "properties": { + "rulename": { + "type": "string", + "description": "Name of the completion rule (e.g., completionview, completionsubmit)" + }, + "rulevalue": { + "type": "object", + "properties": { + "status": { + "type": "integer", + "description": "Status of the rule (0=not met, 1=met)" + }, + "description": { + "type": "string", + "description": "Description of the rule" + } + } + } + } + } + }, + "isoverallcomplete": { + "type": "boolean", + "description": "Whether the activity is overall complete" + } + } + } + }, + "warnings": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "example": { + "statuses": [ + { + "cmid": 115312, + "modname": "resource", + "instance": 55202, + "state": 1, + "timecompleted": 1692954398, + "tracking": 2, + "overrideby": null, + "valueused": false, + "hascompletion": true, + "isautomatic": true, + "istrackeduser": true, + "uservisible": true, + "details": [ + { + "rulename": "completionview", + "rulevalue": { + "status": 1, + "description": "Anzeigen" + } + } + ], + "isoverallcomplete": true + }, + { + "cmid": 116438, + "modname": "assign", + "instance": 5916, + "state": 0, + "timecompleted": 0, + "tracking": 2, + "overrideby": null, + "valueused": false, + "hascompletion": true, + "isautomatic": true, + "istrackeduser": true, + "uservisible": true, + "details": [ + { + "rulename": "completionview", + "rulevalue": { + "status": 1, + "description": "Anzeigen" + } + }, + { + "rulename": "completionsubmit", + "rulevalue": { + "status": 0, + "description": "Abgabe einreichen" + } + } + ], + "isoverallcomplete": false + }, + { + "cmid": 116443, + "modname": "label", + "instance": 24959, + "state": 1, + "timecompleted": 1692955648, + "tracking": 1, + "overrideby": null, + "valueused": true, + "hascompletion": true, + "isautomatic": false, + "istrackeduser": true, + "uservisible": true, + "details": [], + "isoverallcomplete": true + } + ], + "warnings": [] + } + } + } + }, + "422": { + "description": "Invalid Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "invalidparameter", + "errorcode": "invalidparameter" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/config/_webservice_rest_server-php/Completion/core_completion_get_course_completion_status.json b/src/config/_webservice_rest_server-php/Completion/core_completion_get_course_completion_status.json new file mode 100644 index 0000000..46a828f --- /dev/null +++ b/src/config/_webservice_rest_server-php/Completion/core_completion_get_course_completion_status.json @@ -0,0 +1,129 @@ +{ + "method": "GET", + "description": "Get course completion status for a user", + "query_params": [ + { + "name": "courseid", + "type": "int", + "required": true, + "description": "Course ID" + }, + { + "name": "userid", + "type": "int", + "required": false, + "description": "User ID (defaults to current user if not specified)" + } + ], + "responses": { + "200": { + "description": "Course completion status information", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "completionstatus": { + "type": "object", + "properties": { + "completed": { + "type": "boolean", + "description": "Whether the course is completed" + }, + "aggregation": { + "type": "integer", + "description": "Completion aggregation method" + }, + "completions": { + "type": "array", + "description": "List of completion criteria", + "items": { + "type": "object", + "properties": { + "type": { + "type": "integer", + "description": "Completion criteria type" + }, + "title": { + "type": "string", + "description": "Criteria title" + }, + "status": { + "type": "string", + "description": "Completion status (complete/incomplete)" + }, + "complete": { + "type": "boolean", + "description": "Whether this criteria is complete" + }, + "timecompleted": { + "type": "integer", + "description": "Timestamp when completed" + }, + "details": { + "type": "object", + "description": "Additional criteria details" + } + } + } + } + } + }, + "warnings": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "example": { + "completionstatus": { + "completed": false, + "aggregation": 1, + "completions": [ + { + "type": 4, + "title": "Activity completion", + "status": "incomplete", + "complete": false, + "timecompleted": 0, + "details": { + "rulename": "Complete all activities", + "rulevalue": { + "required": 5, + "completed": 3 + } + } + }, + { + "type": 6, + "title": "Manual completion", + "status": "incomplete", + "complete": false, + "timecompleted": 0, + "details": {} + } + ] + }, + "warnings": [] + } + } + } + }, + "422": { + "description": "Invalid Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "invalidparameter", + "errorcode": "invalidparameter" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/config/_webservice_rest_server-php/Completion/core_completion_mark_course_self_completed.json b/src/config/_webservice_rest_server-php/Completion/core_completion_mark_course_self_completed.json new file mode 100644 index 0000000..2f3af71 --- /dev/null +++ b/src/config/_webservice_rest_server-php/Completion/core_completion_mark_course_self_completed.json @@ -0,0 +1,68 @@ +{ + "method": "POST", + "description": "Mark a course as self-completed by the current user", + "query_params": [ + { + "name": "courseid", + "type": "int", + "required": true, + "description": "Course ID to mark as completed" + } + ], + "responses": { + "200": { + "description": "Course marked as self-completed successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "boolean", + "description": "True if course was marked as completed" + }, + "warnings": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "example": { + "status": true, + "warnings": [] + } + } + } + }, + "422": { + "description": "Invalid Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "invalidparameter", + "errorcode": "invalidparameter" + } + } + } + }, + "403": { + "description": "Self-completion not enabled or permission denied", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "selfcompletionnotallowed", + "errorcode": "selfcompletionnotallowed" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/config/_webservice_rest_server-php/Completion/core_completion_update_activity_completion_status_manually.json b/src/config/_webservice_rest_server-php/Completion/core_completion_update_activity_completion_status_manually.json new file mode 100644 index 0000000..0db72e9 --- /dev/null +++ b/src/config/_webservice_rest_server-php/Completion/core_completion_update_activity_completion_status_manually.json @@ -0,0 +1,88 @@ +{ + "method": "POST", + "description": "Manually update completion status for an activity (current user only, requires manual completion tracking)", + "query_params": [ + { + "name": "cmid", + "type": "int", + "required": true, + "description": "Course module ID" + }, + { + "name": "completed", + "type": "bool", + "required": true, + "description": "True to mark as completed, false to mark as incomplete" + } + ], + "responses": { + "200": { + "description": "Completion status updated successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "boolean", + "description": "True if update was successful" + }, + "warnings": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "example": { + "status": true, + "warnings": [] + } + } + } + }, + "422": { + "description": "Invalid Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "invalidparameter", + "errorcode": "invalidparameter" + } + } + } + }, + "403": { + "description": "Permission denied - user doesn't have 'moodle/course:togglecompletion' capability", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "nopermission", + "errorcode": "nopermission" + } + } + } + }, + "400": { + "description": "Activity doesn't have manual completion tracking enabled", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "invalidcompletiontracking", + "errorcode": "invalidcompletiontracking" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/config/_webservice_rest_server-php/Enrollment/enrol_self_enrol_user.json b/src/config/_webservice_rest_server-php/Enrollment/enrol_self_enrol_user.json index 701e254..c60bf84 100644 --- a/src/config/_webservice_rest_server-php/Enrollment/enrol_self_enrol_user.json +++ b/src/config/_webservice_rest_server-php/Enrollment/enrol_self_enrol_user.json @@ -1,6 +1,6 @@ { - "method": "GET", - "description": "Self-enrol user in a course | unenrol by using function on enrolled course", + "method": "POST", + "description": "Self-enrol user in a course", "query_params": [ { "name": "courseid",