Skip to content

MeeReak/student-course-management

Repository files navigation

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contact

About The Project

The Student course management system built with NodeJS and Express. It allows managing students and courses through CRUD operations (Create, Read, Update, Delete). Students and courses have detailed information stored, and you can search for them by name or phone number. Additionally, the system lets students register for courses and generates reports on both students and courses.

Built With

Node.js Express.js TypeScript

(back to top)

Getting Started

  • Deployed

    To test the deployed API, click here.click-here

  • Local

    Prerequisites

    This is an example of how to list things you need to use the software and how to install them.

  • npm

    npm install npm@latest -g

    or

  • yarn

    npm install yarn@latest -g

Installation

_Below is an example of how to settup the project requirement

  1. Clone the repo

    https://github.com/MeeReak/student-course-management.git
  2. Install NPM or YARN packages

    npm install

    or

    yarn install
  3. Enter your .env variables in configs/.env

     NODE_ENV=dev
     LOG_LEVEL=debug
     DB_URL=your_database_url
     PORT=3000

(back to top)

Usage

_Below is an example of how to get start the project!

  1. Start Server

    npm run start:dev

    or

    yarn start:dev
  2. Run Test

    npm run start:test

    or

    yarn start:test

Below are some examples of how to use the API endpoints.

For more examples, please refer to the Documentation

Endpoint

1. Student CRUD Operations (using soft delete)

  • Create Student: POST /v1/students
  • Retrieve a Student: GET /v1/students/{id}
  • Update Student: POST /v1/students/{id}
  • Delete Student: DELETE /v1/students/{id}
  • List Students: GET /v1/students

2. Student Search

  • Search Students by Full Name or Phone Number: GET /v1/students/search?query={query}

3. Course CRUD Operations (using soft delete)

  • Create Course: POST /v1/courses
  • Retrieve a Course: GET /v1/courses/{id}
  • Update Course: PUT /v1/courses/{id}
  • Delete Course: DELETE /v1/courses/{id}
  • List Courses: GET /v1/courses

4. Course Search

  • Search Courses by Name: GET /v1/courses/search?name={name}
  • Advanced Search Courses by Start Date and End Date: GET /v1/courses/date?startDate={startDate}&endDate={endDate}

5. Register/Remove Course for Student

  • Register Course for Student: POST /v1/students/{id}/course/{courseId}
  • Remove Course for Student: DELETE /v1/students/{id}/course/{courseId}

6. Course Report

  • Course Report: GET /v1/courses/reports

7. Student Report

  • Student Report: GET /v1/students/reports

Sample Request Body

  • Student
    {
        "name":{
                "en": "Kaizen",
                "km": "សុខគា"
        },
        "dateOfBirth": "02-02-2022", # format "yy,mm,dd"
        "gender": "Male",
        "phoneNumber": "0123456789"
        "courses": [
                 "667fb8a1fd67fa8bce216370",
                 "667fb9e20d778b0eb1a8d0db"
        ], 
    }
  • Course
    {
        "name": "Javascript",
        "professorName": "Kaizen",
        "startDate": "04-01-2024",
        "endDate": "12-01-2024",
        "limit": 15,
        "Enroll": [
                  "667f9b5d608df88473d6dc1a",
                  "667fbc0c2ee96d8d99d0b68e"
              ], 
          }

Sample Response Body

  • Student
    {
        "_id": "667fbc0c2ee96d8d99d0b68e",
        "name":{
                "en": "Kaizen",
                "km": "សុខគា"
        },
        "dateOfBirth": "02-02-2022", # format "yy,mm,dd"
        "gender": "Male",
        "phoneNumber": "0123456789"
        "courses": [
                 "667fb8a1fd67fa8bce216370",
                 "667fb9e20d778b0eb1a8d0db"
        ], 
        "is_deleted": false,
        "__v": 1
    }
  • Course
    {
        "name": "Javascript",
        "professorName": "Kaizen",
        "startDate": "04-01-2024",
        "endDate": "12-01-2024",
        "limit": 15,
        "Enroll": [
            "667f9b5d608df88473d6dc1a",
            "667fbc0c2ee96d8d99d0b68e"
        ],
    }

Validation

Student Document Validation:

  1. name:{ en: Must be a non-empty string. km: Must be a non-empty string. }
  2. dateOfBirth: Must be a valid date.
  3. gender: Must be either "male", "female", or “other” valid options.
  4. phoneNumber: Must be a valid phone number format .
  5. Course : Must be an array of valid course IDs. The string of IDs should not exceed

Course Document Validation:

  1. name: Must be a non-empty string.
  2. professorName: Must be a non-empty string.
  3. limit: Must be a positive integer.
  4. startDate: Must be a valid date.
  5. endDate: Must be a valid date and must be after start_date.
  6. Enroll: Must be an array of valid student IDs. The string of IDs should not exceed .

(back to top)

Contact

Rin Tithyareak - @Mee Reak - [email protected]

Project Link: https://github.com/MeeReak/student-course-management.git

(back to top)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published