pub async fn get_graph(
__arg0: State<AppState>,
__arg1: Path<(i64, i64)>,
__arg2: Query<PlagiarismQuery>,
) -> impl IntoResponse
Expand description
GET /api/modules/{module_id}/assignments/{assignment_id}/plagiarism/graph
Builds a user-to-user plagiarism graph for the given assignment. Each edge indicates that there is at least one plagiarism case linking submissions from the two users.
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 whose plagiarism graph should be built
§Query Parameters
status
(optional): Filter edges by case status. One of:"review"
"flagged"
"reviewed"
§Semantics
- Nodes are usernames derived from the submissions involved in cases.
- Each returned
Link { source, target }
represents a directed edge fromsource
user totarget
user for at least one case. (If multiple cases exist between the same pair, multiple identical edges may appear; if you prefer deduplication, apply it in your client or adjust the endpoint to de-duplicate.) - Only cases where both submissions belong to the specified assignment are considered.
§Returns
200 OK
with alinks
array (possibly empty) on success400 BAD REQUEST
ifstatus
is provided but invalid500 INTERNAL SERVER ERROR
if submissions, users, or cases could not be fetched
§Example Request
GET /api/modules/12/assignments/34/plagiarism/graph?status=flagged
§Example Response (200 OK)
{
"success": true,
"message": "Plagiarism graph retrieved successfully",
"data": {
"links": [
{ "source": "u12345678", "target": "u87654321" },
{ "source": "u13579246", "target": "u24681357" }
]
}
}
§Example Response (Empty Graph)
{
"success": true,
"message": "Plagiarism graph retrieved successfully",
"data": { "links": [] }
}
§Example Response (400 Bad Request)
{
"success": false,
"message": "Invalid status parameter"
}
§Notes
- This endpoint is optimized for visualization. If you need case details, use the list
endpoint (
GET /plagiarism
) instead. - Edges are derived from the current cases in the database after any filtering.
- Usernames are taken from the submissions’ authors at query time.