Lecturer API Routes

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

POST /auth/lecturer/courses

Description: Only lecturer can create a course.
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/auth/lecturer/courses

Request Body:
{
    "name": "Computer Science",
    "code": "CS",
    "department": "Computer Science",
    "school": "Computer Science & Information Technology"
}

Response:
{
    "course_id": "dfb3f064-bf5a-4633-87ab-6495c28e30d1",
    "message": "Course created successfully"
}

GET /auth/lecturer/courses

Description: Lecturer get all courses created by him/her.
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/auth/lecturer/courses

Response:
[
    {
        "code": "CS",
        "department": "Computer Science",
        "id": "dfb3f064-bf5a-4633-87ab-6495c28e30d1",
        "name": "Computer Science",
        "school": "Computer Science & Information Technology",
        "units": []
    }
]

GET /auth/lecturer/courses/<course_id>

Description: Return details for specific course by ID.
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/auth/lecturer/courses/<course_id>

Response:
{
    "code": "CS",
    "department": "Computer Science",
    "id": "dfb3f064-bf5a-4633-87ab-6495c28e30d1",
    "name": "Computer Science",
    "school": "Computer Science & Information Technology",
    "units": []
}

PUT /auth/lecturer/courses/<course_id>

Description: Update a course by ID (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
PUT http://localhost:8080/api/v1/auth/lecturer/courses/<course_id>

Request Body:
{
    "code": "CS",
    "department": "Computer Science",
    "name": "Computer Science",
    "school": "CS & IT"
}

Response:
{
    "code": "CS",
    "department": "Computer Science",
    "id": "dfb3f064-bf5a-4633-87ab-6495c28e30d1",
    "name": "Computer Science",
    "school": "CS & IT",
    "units": []
}

DELETE /auth/lecturer/courses/<course_id>

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

Request:
DELETE http://localhost:8080/api/v1/auth/lecturer/courses/<course_id>

Response:
{
    "message": "Course deleted successfully"
}

POST /auth/lecturer/units

Description: Lecturer creating a unit in the course he/she created.
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/auth/lecturer/units

Request Body:
{
    "unit_code": "CCS 4102",
    "unit_name": "Machine Learning",
    "level": 4,
    "semester": 1,
    "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281"
}

Response:
{
    "message": "Unit created successfully",
    "unit_id": "e1c4ffdb-c10b-43c7-acfa-8d09aad29ecd"
}

GET /auth/lecturer/units

Description: Get all units created by him or her (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/auth/lecturer/units

Response:
[
    {
        "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "id": "e1c4ffdb-c10b-43c7-acfa-8d09aad29ecd",
        "level": 4,
        "semester": 1,
        "unit_code": "CCS 4102",
        "unit_name": "Machine Learning"
    },
    {
        "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "id": "36ee41ed-21b0-4311-a848-6608baea6553",
        "level": 4,
        "semester": 1,
        "unit_code": "CCS 4101",
        "unit_name": "Human Computer Interaction (HCI)"
    },
    {
        "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "id": "7492ca17-2fe6-4d17-9ac2-5119124a3716",
        "level": 4,
        "semester": 1,
        "unit_code": "CCS 4103",
        "unit_name": "Computer Security"
    }
]

GET /auth/lecturer/units/<unit_id>

Description: Get details for a specific unit by ID (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/auth/lecturer/units/<unit_id>

Response:
{
    "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
    "id": "e1c4ffdb-c10b-43c7-acfa-8d09aad29ecd",
    "level": 4,
    "semester": 1,
    "unit_code": "CCS 4102",
    "unit_name": "Machine Learning"
}

PUT /auth/lecturer/units/<unit_id>

Description: Update a unit by ID (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
PUT http://localhost:8080/api/v1/auth/lecturer/units/<unit_id>

Request Body:
{
    "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
    "level": 4,
    "semester": 2,
    "unit_code": "CCS 4102",
    "unit_name": "Machine learning"
}

Response:
{
    "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
    "id": "e1c4ffdb-c10b-43c7-acfa-8d09aad29ecd",
    "level": 4,
    "semester": 2,
    "unit_code": "CCS 4102",
    "unit_name": "Machine learning"
}

DELETE /auth/lecturer/units/<unit_id>

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

Request:
DELETE http://localhost:8080/api/v1/auth/lecturer/units/<unit_id>

Response:
{
    "message": "Unit deleted successfully"
}

POST /auth/lecturer/students

Description: Lecturer adds a student to a course he/she created.
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/auth/lecturer/students

Request Body:
{
    "email": "joe.doe2026@edu",
    "reg_number": "C028-01-2010/2026",
    "year_of_study": 4,
    "semester": 1,
    "firstname": "Joe",
    "surname": "Doe",
    "othernames": "",
    "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281"
}

Response:
{
    "message": "Student added successfully",
    "student_id": "a7c45883-1313-44af-b3c6-ac08da6707a4"
}

GET /auth/lecturer/students

Description: Get all students taking his/her courses (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/auth/lecturer/students

Response:
[
    {
        "course": {
            "id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
            "name": "Computer Science"
        },
        "firstname": "Joe",
        "id": "a7c45883-1313-44af-b3c6-ac08da6707a4",
        "othernames": "",
        "reg_number": "C028-01-2010/2026",
        "semester": 1,
        "surname": "Doe",
        "units": [
            {
                "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
                "id": "36ee41ed-21b0-4311-a848-6608baea6553",
                "level": 4,
                "semester": 1,
                "unit_code": "CCS 4101",
                "unit_name": "Human Computer Interaction (HCI)"
            },...
        ],
        "user_id": "079fdaf8-9316-464e-9884-c0801a94e9d1",
        "year_of_study": 4
    }
]

GET /auth/lecturer/students/<student_id>

Description: Get specific student detail (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/auth/lecturer/students/<student_id>

Response:
{
    "course": {
        "id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "name": "Computer Science"
    },
    "firstname": "Joe",
    "id": "a7c45883-1313-44af-b3c6-ac08da6707a4",
    "othernames": "",
    "reg_number": "C028-01-2010/2026",
    "semester": 1,
    "surname": "Doe",
    "units": [
        {
            "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
            "id": "36ee41ed-21b0-4311-a848-6608baea6553",
            "level": 4,
            "semester": 1,
            "unit_code": "CCS 4101",
            "unit_name": "Human Computer Interaction (HCI)"
        },...
    ],
    "user_id": "079fdaf8-9316-464e-9884-c0801a94e9d1",
    "year_of_study": 4
}

PUT /auth/lecturer/students/<student_id>

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

Request:
PUT http://localhost:8080/api/v1/auth/lecturer/students/<student_id>

Request Body:
{
    "email": "joe.doe2025@edu",
    "reg_number": "C029-01-2010/2025",
    "year_of_study": 4,
    "semester": 1,
    "firstname": "Joe",
    "surname": "Doe",
    "othernames": "John",
    "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281"
}

Response:
{
    "course": {
        "id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "name": "Computer Science"
    },
    "firstname": "Joe",
    "id": "a7c45883-1313-44af-b3c6-ac08da6707a4",
    "othernames": "John",
    "reg_number": "C029-01-2010/2025",
    "semester": 1,
    "surname": "Doe",
    "units": [
        {
            "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
            "id": "36ee41ed-21b0-4311-a848-6608baea6553",
            "level": 4,
            "semester": 1,
            "unit_code": "CCS 4101",
            "unit_name": "Human Computer Interaction (HCI)"
        },...
    ],
    "user_id": "079fdaf8-9316-464e-9884-c0801a94e9d1",
    "year_of_study": 4
}

DELETE /auth/lecturer/students/<student_id>

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

Request:
DELETE http://localhost:8080/api/v1/auth/lecturer/students/<student_id>

Response:
{
    "message": "Student deleted successfully"
}

Assessment Management Routes


POST /bd/lecturer/ai/generate-assessments

Description: Generate assessment using AI (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/bd/lecturer/ai/generate-assessments

Request Body:
{
    "title": "Machine Learning",
    "description": "Add question on deep learning/neural network",
    "week": 3,
    "type": "CAT",                                                   // CAT, Assignment, Case Study
    "unit_id": "91827bb6-2be8-4b0a-9bc0-af472aacc375",
    "questions_type": "close-ended",                                // close-ended, open-ended
    "close_ended_type": "multiple choice with one answer",          // matching, multiple choice with one answer, multiple choice with multiple answers, true/false
    "topic": "Deep Learning",
    "total_marks": "20",
    "difficulty": "Intermediate",                                   // Easy, Intermediate, Advance
    "number_of_questions": "10",
    "blooms_level": "Remember",                                     // Remember, Understand, Apply, Analyze, Evaluate, Create
    "deadline": "2025-10-01T12:00:00Z",                             // optional field
    "duration": 30                                                 // in minutes (optional field)
}

Response:
{
    "assessment_id": "56e00466-48c9-4504-8e60-d78e3358d8ba",
    "message": "Assessment generated successfully.",
    "title": "Machine Learning"
}

GET /bd/lecturer/assessments/<assessment_id>/verify

Description: Used to verify AI generated assessment (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/bd/lecturer/assessments/<assessment_id>/verify

Response:
{
    "assessment_id": "56e00466-48c9-4504-8e60-d78e3358d8ba",
    "message": "Assessment verified successfully.",
    "title": "Machine Learning"
}

POST /bd/lecturer/generate-assessments

Description: Lecturer creating assessments manually.
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/bd/lecturer/generate-assessments

Request Body:
{
    "title": "Computer Security",
    "description": "Assignment on cryptography",
    "week": 3,
    "type": "Assignment",                                   // CAT, Assignment, Case Study
    "unit_id": "7492ca17-2fe6-4d17-9ac2-5119124a3716",
    "questions_type": "open-ended",                         // close-ended, open-ended
    "close_ended_type": "",                                 // matching, multiple choice with one answer, multiple choice with multiple answers, true/false
    "topic": "Cryptography",
    "total_marks": 3,
    "difficulty": "Intermediate",                           // Easy, Intermediate, Advance
    "number_of_questions": 1,
    "blooms_level": "Remember",                             // Remember, Understand, Apply, Analyze, Evaluate, Create
    "deadline": "",                                         // optional field
    "duration": ""                                          // in minutes (optional field)
}

Response:
{
    "assessment_id": "e49d387f-7128-42c3-939e-0175847733ab",
    "message": "Assessment created successfully.",
    "title": "Computer Security"
}

DELETE /bd/lecturer/assessments/<assessment_id>

Description: Delete an assessment by ID (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
DELETE http://localhost:8080/api/v1/bd/lecturer/assessments/<assessment_id>

Response:
{
    "message": "Assessment deleted successfully."
}

POST /bd/lecturer/assessments/<assessment_id>/questions

Description: Add a question to an assessment (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
POST http://localhost:8080/api/v1/bd/lecturer/assessments/<assessment_id>/questions

Request Body:
{
    "text": "Challenge of key exchange, possible solutions",
    "marks": 3,
    "type": "open-ended", // should match the parent assessment type
    "rubric": "Award full marks for correct year; partial for close guesses",
    "correct_answer": "",
    "choices": ""
}

Response:
{
    "message": "Question added successfully.",
    "question_id": "b0136541-5f9b-4ed7-9c68-1ed1e663cbe1"
}

GET /bd/lecturer/assessments

Description: Get all assessments created by the lecturer.
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/bd/lecturer/assessments

Response:
[
    {
        "blooms_level": "Remember",
        "close_ended_type": "multiple choice with one answer",
        "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "created_at": "2025-06-26T13:29:07.578776",
        "creator_id": "daa64de5-44d5-435a-a156-08637dccb58a",
        "deadline": "2025-10-01T12:00:00",
        "description": "Add question on deep learning/neural network",
        "difficulty": "Intermediate",
        "duration": 30,
        "id": "56e00466-48c9-4504-8e60-d78e3358d8ba",
        "level": 4,
        "number_of_questions": 10,
        "questions": [
            {
                "assessment_id": "56e00466-48c9-4504-8e60-d78e3358d8ba",
                "choices": [
                    "They require manual extraction of features",
                    "They automatically learn feature representations from data",
                    "They are not suitable for unstructured data"
                ],
                "correct_answer": [
                    "They automatically learn feature representations from data"
                ],
                "created_at": "2025-06-26T13:29:07.586199",
                "id": "b84f00d3-b020-44a7-bf00-6e066756640e",
                "marks": 2.0,
                "rubric": "Award full marks if the correct choice is selected; otherwise, award zero.",
                "text": "Which of the following is a key characteristic of deep learning models?",
                "type": "close-ended"
            },...
        ],
        "questions_type": "close-ended",
        "semester": 1,
        "status": "start",
        "title": "Machine Learning",
        "topic": "Deep Learning",
        "total_marks": 20,
        "type": "CAT",
        "unit_id": "91827bb6-2be8-4b0a-9bc0-af472aacc375",
        "verified": true,
        "week": 3
    },
    {
        "blooms_level": "Remember",
        "close_ended_type": null,
        "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "created_at": "2025-06-26T13:58:03.625859",
        "creator_id": "daa64de5-44d5-435a-a156-08637dccb58a",
        "deadline": null,
        "description": "Assignment on cryptography",
        "difficulty": "Intermediate",
        "duration": null,
        "id": "e49d387f-7128-42c3-939e-0175847733ab",
        "level": 4,
        "number_of_questions": 1,
        "questions": [
            {
                "assessment_id": "e49d387f-7128-42c3-939e-0175847733ab",
                "choices": null,
                "correct_answer": null,
                "created_at": "2025-06-26T14:21:50.422085",
                "id": "b0136541-5f9b-4ed7-9c68-1ed1e663cbe1",
                "marks": 3.0,
                "rubric": "Award full marks for correct year; partial for close guesses",
                "text": "Challenge of key exchange, possible solutions",
                "type": "open-ended"
            }
        ],
        "questions_type": "open-ended",
        "semester": 1,
        "status": "start",
        "title": "Computer Security",
        "topic": "Cryptography",
        "total_marks": 3,
        "type": "Assignment",
        "unit_id": "7492ca17-2fe6-4d17-9ac2-5119124a3716",
        "verified": false,
        "week": 3
    }
]

POST /bd/lecturer/units/<unit_id>/notes

Description: Upload learning materials (notes) to a unit (lecturer only).
Note: You must include credentials: include when sending the request.
Request Body (form-data):
- file (required): The file to upload
- title (required): Title of the notes
- description (optional): Description of the notes

Request:
POST http://localhost:8080/api/v1/bd/lecturer/units/<unit_id>/notes

Response:
{
    "file_info": {
        "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
        "created_at": "2025-06-26T15:06:30.974635",
        "file_size": 17460,
        "file_type": "docx",
        "filename": "machine_learning_outline.docx",
        "title": "course outline",
        "unit_id": "91827bb6-2be8-4b0a-9bc0-af472aacc375"
    },
    "message": "Notes uploaded successfully.",
    "note_id": "33b77145-0716-4b9d-9c89-0639b1a3cfc8"
}

DELETE /bd/lecturer/notes/<note_id>

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

Request:
DELETE http://localhost:8080/api/v1/bd/lecturer/notes/<note_id>

Response:
{
    "message": "Note deleted successfully.",
    "note_id": "f338ba1c-5c22-4caf-81e6-f0a436f6ba0a"
}

GET /bd/lecturer/notes

Description: Get all notes uploaded by the lecturer.
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/bd/lecturer/notes

Response:
{
    "message": "Lecturer notes retrieved successfully.",
    "notes": [
        {
            "course_id": "7d1360db-d1f3-40c1-9f05-6ab64d60f281",
            "created_at": "2025-06-26T15:06:30.974635",
            "description": "",
            "file_size": 17460,
            "file_type": "docx",
            "id": "33b77145-0716-4b9d-9c89-0639b1a3cfc8",
            "lecturer_id": "daa64de5-44d5-435a-a156-08637dccb58a",
            "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "original_filename": "machine_learning_outline.docx",
            "title": "course outline",
            "unit_id": "91827bb6-2be8-4b0a-9bc0-af472aacc375",
            "updated_at": "2025-06-26T15:06:30.974643"
        }
    ]
}

GET /bd/lecturer/submissions/assessments/<assessment_id>

Description: Get all submissions for a specific assessment (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/bd/lecturer/submissions/assessments/<assessment_id>

Response:
[
    {
        "assessment_id": "e49d387f-7128-42c3-939e-0175847733ab",
        "graded": true,
        "results": [
            {
                "assessment_id": "e49d387f-7128-42c3-939e-0175847733ab",
                "feedback": "The answer correctly identifies the challenge of securely exchanging cryptographic keys over an insecure channel and provides accurate solutions, including Diffie-Hellman key exchange and public-key cryptography (e.g., RSA). This matches the requirements of the question and aligns with the rubric, earning full marks.",
                "graded_at": "2025-06-26T17:59:53.467598",
                "id": "829d66cb-ab2a-4359-8b1d-0c15f83ffa01",
                "marks": 3.0,
                "question_id": "b0136541-5f9b-4ed7-9c68-1ed1e663cbe1",
                "question_text": "Challenge of key exchange, possible solutions",
                "score": 3.0,
                "student_id": "373ca408-11a5-4076-9844-93d03fff2e62"
            }
        ],
        "student_id": "373ca408-11a5-4076-9844-93d03fff2e62",
        "submission_id": "27eb3975-1ab8-44b6-a75b-3ecf85db1e40",
        "total_marks": 3.0
    }
]

GET /bd/lecturer/submissions/student/<student_id>

Description: Get all submissions for a specific student (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
GET http://localhost:8080/api/v1/bd/lecturer/submissions/student/<student_id>

Response:
[
    {
        "assessment_id": "e49d387f-7128-42c3-939e-0175847733ab",
        "graded": true,
        "results": [
            {
                "assessment_id": "e49d387f-7128-42c3-939e-0175847733ab",
                "feedback": "The answer correctly identifies the challenge of securely exchanging cryptographic keys over an insecure channel and provides accurate solutions, including Diffie-Hellman key exchange and public-key cryptography (e.g., RSA). This matches the requirements of the question and aligns with the rubric, earning full marks.",
                "graded_at": "2025-06-26T17:59:53.467598",
                "id": "829d66cb-ab2a-4359-8b1d-0c15f83ffa01",
                "marks": 3.0,
                "question_id": "b0136541-5f9b-4ed7-9c68-1ed1e663cbe1",
                "question_text": "Challenge of key exchange, possible solutions",
                "score": 3.0,
                "student_id": "373ca408-11a5-4076-9844-93d03fff2e62"
            }
        ],
        "student_id": "373ca408-11a5-4076-9844-93d03fff2e62",
        "submission_id": "27eb3975-1ab8-44b6-a75b-3ecf85db1e40",
        "total_marks": 3.0
    }
]

PUT /bd/lecturer/submissions/<submission_id>

Description: Update score and feedback for a student submission (lecturer only).
Note: You must include credentials: include when sending the request.

Request:
PUT http://localhost:8080/api/v1/bd/lecturer/submissions/<submission_id>

Request Body:
{
    "score": 2.5,
    "question_id": "b0136541-5f9b-4ed7-9c68-1ed1e663cbe1",
    "feedback": "The answer correctly identifies the challenge of securely exchanging cryptographic keys over an insecure channel and provides accurate solutions, including Diffie-Hellman key exchange and public-key cryptography (e.g., RSA). This matches the requirements of the question and aligns with the rubric, earning full marks."
}

Response:
{
    "graded": true,
    "message": "Submission updated successfully.",
    "submission_id": "27eb3975-1ab8-44b6-a75b-3ecf85db1e40",
    "total_marks": 2.5
}