A comprehensive mobile application for Junior High School (JHS) students in Ghana preparing for the BECE.
## Admin Panel Features
Admin functionalities are accessible under the '/api/admin' path and require authentication as an admin user.
### Upload Questions via CSV
* **Endpoint:** 'POST /api/admin/upload-questions-csv'
* **Description:** Allows administrators to bulk upload BECE questions using a CSV file.
* **Authentication:** Requires admin privileges.
* **Request Body:** 'multipart/form-data' with a single file field named 'questionsCsv'.
* **CSV File Format:**
The CSV file must have the following headers:
* 'subject': (String, Required) - The subject of the question (e.g., 'Mathematics', 'English Language').
* 'year': (Integer, Required) - The year the question is from (e.g., 2023).
* 'type': (String, Required) - The type of question. Must be either 'objective' or 'theory'.
* 'questionText': (String, Required) - The main text of the question.
* 'options': (String, Optional for theory, Required for objective) - A JSON string representing an array of options for objective questions. Example: '"[""Option A"", ""Option B"", ""Option C"", ""Option D""]"'. This entire string, including the outer quotes and escaped inner quotes, should be within a single CSV cell.
* 'correctAnswer': (String, Required) - The correct answer. For objective questions, this should match one of the options. For theory, it's the model answer.
* 'solution': (String, Optional) - A detailed solution or explanation for the question.
* **Success Response (201 Created):**
```json
{
"message": "CSV processed. Check status for details.",
"successfullySaved": 50,
"totalCsvRowsProcessed": 52,
"csvValidationErrors": [
{ "row": 10, "message": "Invalid type: 'obj'. Must be 'objective' or 'theory'.", "data": { ... } }
],
"databaseSaveErrors": [],
"warnings": [
{ "row": 15, "message": "Options field was not valid JSON, storing as null.", "originalValue": "[A,B,C]", "error": "Unexpected token A in JSON at position 1"}
]
}
```
* **Error Responses:**
* '400 Bad Request': If no …