Function bulk_update_assignments

Source
pub async fn bulk_update_assignments(
    __arg0: State<AppState>,
    __arg1: Path<i64>,
    __arg2: Json<BulkUpdateRequest>,
) -> impl IntoResponse
Expand description

PUT /api/modules/:module_id/assignments/bulk

Bulk update fields on multiple assignments. Only accessible by lecturers or admins assigned to the module.

§Path Parameters

  • module_id (i64): The ID of the module.

§Request Body (JSON)

{
  "assignment_ids": [123, 124, 125],
  "available_from": "2024-01-01T00:00:00Z",
  "due_date": "2024-02-01T00:00:00Z"
}

§Notes

  • The status field of assignments cannot be updated using this endpoint.
  • Status transitions are handled automatically by the system based on readiness checks.

§Responses

  • 200 OK (all succeeded)
{
  "success": true,
  "message": "Updated 3/3 assignments",
  "data": {
    "updated": 3,
    "failed": []
  }
}
  • 200 OK (partial failure)
{
  "success": true,
  "message": "Updated 2/3 assignments",
  "data": {
    "updated": 2,
    "failed": [
      {
        "id": 125,
        "error": "Assignment not found"
      }
    ]
  }
}
  • 400 Bad Request
{
  "success": false,
  "message": "No assignment IDs provided"
}