pub async fn get_my_submissions(
__arg0: State<AppState>,
__arg1: Extension<AuthUser>,
__arg2: Query<GetSubmissionsQuery>,
) -> impl IntoResponse
Expand description
GET /api/me/submissions
Retrieves a paginated list of submissions relevant to the authenticated user.
The behavior of this endpoint changes based on the role
query parameter,
allowing users to view submissions based on their permissions.
§Authorization
Requires a valid bearer token.
§Query Parameters
page
(optional, u64, min: 1): The page number for pagination. Defaults to 1.per_page
(optional, u64, min: 1, max: 100): The number of items per page. Defaults to 20.query
(optional, string): A search term to filter submissions by module code, student username, or assignment name.role
(optional, string): The role to filter by. Can beStudent
,Tutor
,AssistantLecturer
, orLecturer
. Defaults toStudent
.- If
Student
, returns only the authenticated user’s submissions. - If
Lecturer
,Tutor
, etc., returns submissions for all students in modules where the user holds that role.
- If
year
(optional, i32): Filters submissions by the module’s academic year.is_late
(optional, bool): Filters submissions based on whether they were submitted after the assignment’s due date.sort
(optional, string): A comma-separated list of fields to sort by. Prefix with-
for descending order.- Allowed fields:
score
,created_at
.
- Allowed fields:
§Response: 200 OK
Returns a paginated list of submissions.
{
"success": true,
"message": "Submissions retrieved",
"data": {
"submissions": [
{
"id": 5512,
"status": "submitted",
"score": { "earned": 42, "total": 50 },
"created_at": "2025-08-08T12:15:00Z",
"updated_at": "2025-08-08T12:15:00Z",
"is_late": false,
"module": { "id": 344, "code": "COS344" },
"assignment": { "id": 102, "name": "A2 — Runtime & VM", "description": "..." },
"user": { "id": 2511, "username": "u23571561" }
}
],
"page": 1,
"per_page": 20,
"total": 93
}
}
§Error Responses
400 Bad Request
: Invalid query parameters.401 Unauthorized
: Not logged in.