Function bulk_edit_modules

Source
pub async fn bulk_edit_modules(
    __arg0: State<AppState>,
    __arg1: Json<Value>,
) -> impl IntoResponse
Expand description

PUT /api/modules/bulk

Bulk update multiple modules by their IDs. Only accessible by admin users.

§Request Body

{
  "module_ids": [1, 2, 3],
  "year": 2025,
  "description": "Updated description",
  "credits": 20
}

§Rules

  • code cannot be modified via this route
  • All fields (year, description, credits) are optional
  • Empty/null fields are ignored (won’t overwrite existing values)

§Responses

  • 200 OK
{
  "success": true,
  "data": {
    "updated": 2,
    "failed": [
      { "id": 3, "error": "Module not found" }
    ]
  },
  "message": "Updated 2/3 modules"
}
  • 400 Bad Request
{
  "success": false,
  "data": null,
  "message": "No module IDs provided"
}