pub async fn create_plagiarism_case(
__arg0: State<AppState>,
__arg1: Path<(i64, i64)>,
__arg2: Json<CreatePlagiarismCasePayload>,
) -> impl IntoResponse
Expand description
POST /api/modules/{module_id}/assignments/{assignment_id}/plagiarism
Creates a new plagiarism case between two submissions in a specific assignment. Accessible only to lecturers and assistant lecturers assigned to the module.
§Path Parameters
module_id
: The ID of the parent moduleassignment_id
: The ID of the assignment containing the submissions
§Request Body
Requires a JSON payload with the following fields:
submission_id_1
(number): First submission ID (must differ from second)submission_id_2
(number): Second submission ID (must differ from first)description
(string): Explanation of the plagiarism casesimilarity
(number, required): Float percentage in the range 0.0–100.0 (inclusive)
§Returns
201 Created
with the newly created plagiarism case on success400 BAD REQUEST
for invalid payload (same submissions, missing/invalid similarity, bad range, etc.)403 FORBIDDEN
if user lacks required permissions500 INTERNAL SERVER ERROR
for database errors or creation failures
§Example Request
{
"submission_id_1": 42,
"submission_id_2": 51,
"description": "Similarity in logic and structure between both files.",
"similarity": 72.5
}
§Example Response (201 Created)
{
"success": true,
"message": "Plagiarism case created successfully",
"data": {
"id": 17,
"assignment_id": 3,
"submission_id_1": 42,
"submission_id_2": 51,
"description": "Similarity in logic and structure between both files.",
"status": "review",
"similarity": 72.5,
"created_at": "2024-05-20T14:30:00Z",
"updated_at": "2024-05-20T14:30:00Z"
}
}
§Example Error Responses
400 Bad Request
(same submission IDs)
{ "success": false, "message": "Submissions cannot be the same" }
400 Bad Request
(submission not found)
{ "success": false, "message": "One or both submissions do not exist or belong to a different assignment" }
400 Bad Request
(similarity out of range)
{ "success": false, "message": "Similarity must be between 0.0 and 100.0" }
403 Forbidden
{ "success": false, "message": "Forbidden: Insufficient permissions" }
500 Internal Server Error
{ "success": false, "message": "Failed to create plagiarism case" }