Skip to content

JakeHornerMan/Seneca_BETT

Repository files navigation

Seneca_BETT

Seneca backend technical task, Node.js, TypeScript, Express TypeORM. I Created a backend service that will allow users to register as standard user or admin.

  • Admin can create Courses and view stats for any session, user or course.
  • Users can start, update and end thier own sessions adding their own session and module results data. They can also view the course and session related stats attched to them.
  • PLEAESE IMPORT 'SenecaPROD.postman_collection.json' IN POSTMAN (https://github.com/JakeHornerMan/Seneca_BETT/blob/main/SenecaPROD.postman_collection.json)


    List of avalible Important endpoints

    Authentication

    /auth/register

    This allow us to register a new user, and also allows us to se the role of the user

    input:
    {
    "username": "prodadmin",
    "email": "prodadmin.test@example.com",
    "password": "securePassword123",
    "role": "admin"
    }

    /auth/login

    This allow us the user to sign in and recieve a token to be used for Authorisation Bearer Token

    input:
    {
    "username": "jake",
    "password": "securePassword123"
    }

    Admin Stat Functionality

    (ADMIN)/stats/sessions/:sessionId

    This will gather all session data based on the sessionId


    (ADMIN)stats/courses/:courseId

    This will allow us to see all related stats based on the courseId selected

    output:
    {
    "moduleAmount": {
    "totalModulesStudied": 5,
    "moduleNames": [
    "Module 1",
    "Module 2",
    "Module 3"
    ]
    },
    "sessionTime": {
    "totalDuration": "2 hours 30 minutes",
    "timeInMinutes": 150
    },
    "scores": {
    "totalSessionPoints": 397,
    "overallAverageScore": 39.7
    }
    }

    (ADMIN)stats/courses/:courseId/sessions/:sessionId

    This will allow us to see all related stats based on the courseId selected and target a sepcific sessoion

    output:
    {
    "moduleAmount": {
    "totalModulesStudied": 5,
    "moduleNames": [
    "Module 1",
    "Module 2",
    "Module 3"
    ]
    },
    "sessionTime": {
    "totalDuration": "2 hours 30 minutes",
    "timeInMinutes": 150
    },
    "scores": {
    "totalSessionPoints": 397,
    "overallAverageScore": 39.7
    }
    }

    User Stat Functionality

    (USER)/stats/user/sessions

    This will gather all session data based on the user logged in


    (USER)stats/courses/:courseId

    This will allow us to see all related stats based on the courseId selected for the user

    output:
    {
    "moduleAmount": {
    "totalModulesStudied": 5,
    "moduleNames": [
    "Module 1",
    "Module 2",
    "Module 3"
    ]
    },
    "sessionTime": {
    "totalDuration": "2 hours 30 minutes",
    "timeInMinutes": 150
    },
    "scores": {
    "totalSessionPoints": 397,
    "overallAverageScore": 39.7
    }
    }

    (USER)/stats/user/courses/:courseId/sessions/:sessionId

    This will allow us to see all related stats based on the courseId selected and target a sepcific sessoion selected for the user

    output:
    {
    "moduleAmount": {
    "totalModulesStudied": 5,
    "moduleNames": [
    "Module 1",
    "Module 2",
    "Module 3"
    ]
    },
    "sessionTime": {
    "totalDuration": "2 hours 30 minutes",
    "timeInMinutes": 150
    },
    "scores": {
    "totalSessionPoints": 397,
    "overallAverageScore": 39.7
    }
    }

    User Session Functionality

    (USER)session/startSession

    This will start a learning session for the current user

    input:
    {
    "courseIdentifier": "9e263811-0cfb-45f0-a0f9-c155c916dfed",
    "topic": "Geometry"
    }
    output:
    {
    "message": "Session started created successfully",
    "sessionId": "d0a99f23-c8f0-4fc3-9d99-665618d545ae"
    }

    (USER)session/updateSession

    This will update a learning session for the current user with the modules and it results

    input:
    {
    "sessionId": "d0a99f23-c8f0-4fc3-9d99-665618d545ae",
    "moduleStats": [
    {
    "moduleName": "Module 1",
    "adaptive": {"answers": ["A", "B"], "isCompleted": false, "score": 10},
    "quiz":{"answers": ["A", "B"], "isCompleted": false, "score": 20}
    },
    {
    "moduleName": "Module 2",
    "quiz": {"answers": ["A", "B"], "isCompleted": false, "score": 10}
    },
    {
    "moduleName": "Module 3",
    "adaptive": {"answers": ["A", "B"], "isCompleted": false, "score": 40},
    "quiz": {"answers": ["A", "B"], "isCompleted": false, "score": 2}
    }
    ]
    }

    (USER)session/endSession

    This will end a learning session for the current user

    input:
    {
    "sessionId": "d0a99f23-c8f0-4fc3-9d99-665618d545ae"
    }

    About

    Seneca backend technical task, Node.js

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published