Admin API Routes

This section documents API endpoints that are accessible to admin users only.

POST /admin/lecturers

Description: Create a new lecturer (admin only).
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/admin/lecturers

Request Body:
{
    "email": "walter...@gmail.com",
    "firstname": "George",
    "surname": "Mutuku",
    "othernames": ""
}

Response:
{
    "lecturer": {
        "firstname": "George",
        "id": "25b4af02-f058-4aa1-a4b0-30385fa9d685",
        "othernames": "",
        "surname": "Mutuku",
        "units": [],
        "user_id": "7fac80d7-2de0-4924-8368-33ce5704d015"
    },
    "temp_password": "ldMZIax1" # send to the lecturer email used to create account
}

GET /admin/lecturers

Description: Get all lecturers registered (admin only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/admin/lecturers

Response:
[
    {
        "courses": [],
        "firstname": "George",
        "id": "4682aa94-6872-4dda-adcc-a377bef0eab7",
        "othernames": "",
        "surname": "Mutuku",
        "user_id": "172a0f76-45bb-424c-b15f-e50f3373d2b3"
    }
]

PUT /admin/lecturers/<lecturer_id>

Description: Update a lecturer's profile (admin only).
Note: You must include credentials: include when sending the request.

Request:
PUT http://localhost:8080/api/v1/admin/lecturers/<lecturer_id>

Request Body:
{
    "firstname": "George",
    "othernames": "James",
    "surname": "Mutuku"
}

Response:
{
    "courses": [],
    "firstname": "George",
    "id": "4682aa94-6872-4dda-adcc-a377bef0eab7",
    "othernames": "James",
    "surname": "Mutuku",
    "user_id": "172a0f76-45bb-424c-b15f-e50f3373d2b3"
}

DELETE /admin/lecturers/<lecturer_id>

Description: Delete a lecturer (admin only).
Note: You must include credentials: include when sending the request.

Request:
DELETE http://localhost:8080/api/v1/admin/lecturers/<lecturer_id>

Response:
{
    "message": "Deleted"
}