Skip to content

Latest commit

 

History

History
158 lines (131 loc) · 6.02 KB

README.md

File metadata and controls

158 lines (131 loc) · 6.02 KB

AcademEase - Student and Course Management API

Logo

Overview

The Student and Course Management API is a RESTful API built using NestJS for managing student resources, including their personal information and the courses they have taken each year. The API uses an SQL database with MySQL to store student and course data and provides various endpoints to perform operations on students and courses.

Software Engineering Principles

  • SOLID Principles: The project follows the SOLID principles, ensuring that the codebase is modular, maintainable, and scalable.
  • DRY (Don't Repeat Yourself): The codebase emphasizes the DRY principle by minimizing code duplication. Reusable components and services are employed to avoid redundancy and maintain code consistency.
  • Data Validation: Data validation is implemented at multiple levels of the application to ensure data integrity and security. Input validation is performed on the server-side to prevent invalid data from being processed.

Design

Relationship

design

Tables

design

Resources

Students Resource

  • GET /students: Retrieve a list of all students' personal information, including courses they have taken. You can also filter students by year. (OPTIONAL)
  • GET /students/:student_id: Retrieve specific student's personal information and courses they have taken. You can also filter by year. (OPTIONAL)
  • POST /students: Create a new student.
  • PUT /students/:student_id: Update a student's personal information.
  • DELETE /students/:student_id: Delete a student and all related course records.

Courses Resource

  • GET /courses: Retrieve a list of all courses.
  • GET /courses/:course_name: Retrieve information about a specific course.
  • POST /courses: Create a new course for students
  • POST /courses/assign/:course_name: Assign a student or students to a specific course
  • PUT /courses/:course_name: Update course information.
  • PUT /courses/unassign/:course_name: Unassign a student or students from a specific course
  • DELETE /courses/:course_name: Delete a course.

API Paths

Here are the main API endpoints with examples of how to use them:

Student Resource

  • Retrieve all students with courses for all years or for a specific year:

  • GET /students (For all years)
    GET /students?year=<year> (OPTIONAL, specific year)
  • Retrieve a specific student with courses for all years or for a specific year:

  • GET /students/:student_id (For all years)
    GET /students/:student_id?year=<year> (OPTIONAL, specific year)
  • Create a new student:

  • POST /students
    Example request body:
    {
        "firstname": "John",
        "lastname": "Doe",
        "address": "123 Main St"
    }
    
  • Update a student's information:

  • PUT /students/:student_id
    
    Example request body:
    {
        "firstname": "Updated First Name",
        "lastname": "Updated Last Name",
        "address": "Updated Address"
    }
    
  • Delete a student also his related course records:

  • DELETE /students/:student_id


    Course Resource

  • Retrieve a list of all courses:

  • GET /courses
  • Retrieve information about a specific course:

  • GET /courses/:course_name
  • Create a new course for a student:

  • POST /courses
    Example request body:
    {
        "course_name": "Mathematics",
        "year": 2023
    }
  • Assign students to a course:

  • POST /courses/assign/:course_name
    Example request body:
    {
        "studentIds": [1 ,2], // number:[] , array of numbers
    }
  • Update course information:

  • PUT /courses/:course_name
    Example request body:
    {
        "course_name": "Updated Course Name",
        "year": 2024
    }
  • Unassign students from course

  • PUT /courses/unassign/:course_name
    Example request body:
    {
        "studentsIds": [4], // This is an array of numbers
    }
  • Delete a course and also the records of students assigned to it:

  • DELETE /courses/:course_name

Installation

Please make sure you have the following installed:

  • Docker Desktop to run the container of MySQL DB
  • Node JS ver 18+
  • MySQL Workbench, DBeaver etc.. for viewing the DB in real-time
  • Postman, Insomnia etc.. for API Testing

To run this project locally, follow these steps:

  1. Clone the repository from Github:
  2. Navigate to the project directory:
  3. cd your-repository
    docker-compose up --build

After running the migration the tables are generated and will be visible at MySQL WorkBench

The API should now be running locally and accessible at http://localhost:3000.

You may test the API with Postman, Insomnia and look at the changes at real time with MySQL Workbench or any other application