Skip to content

Vath-Song99/SCM_monolithic

Repository files navigation

Contributors Forks Stargazers Issues LinkedIn


Logo

Smoeury Songvat

School and Course Management projects!
Explore the docs »

View Demo · Report Bug · Request Feature

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

About The Project

The School and Course Management project is a comprehensive system designed to manage students and courses efficiently. It includes features such as student and course CRUD operations, search functionalities, and reporting.

Built With

This section list any major frameworks/libraries used to bootstrap my project.

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

    git clone https://github.com/vath-song99/scm_monolithic.git
  2. Install NPM or YARN packages

    npm install

    or

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

     NODE_ENV=development    
     LOG_LEVEL=debug
     MONGODB_URL=your_mongodb_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 test

    or

    yarn 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 /api/v1/students
  • Retrieve Student: GET /api/v1/students/{id}
  • Update Student: PUT /api/v1/students/{id}
  • Delete Student (Soft Delete): DELETE /api/v1/students/{id}
  • List Students: GET /api/v1/students

2. Student Search

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

3. Course CRUD Operations (using soft delete)

  • Create Course: POST /api/v1/courses
  • Retrieve Course: GET /api/v1/courses/{id}
  • Update Course: PUT /api/v1/courses/{id}
  • Delete Course (Soft Delete): DELETE /api/v1/courses/{id}
  • List Courses: GET /api/v1/courses

4. Course Search

  • Search Courses by Name: GET /api/v1/courses/search?query={searchTerm}
  • Advanced Search Courses by Start Date and End Date: GET /api/v1/courses/advanced-search?start_date={startDate}&end_date={endDate}

5. Register/Remove Course for Student

  • Register Course for Student: POST /api/v1/students/{studentId}/courses/{courseId}
  • Remove Course for Student: DELETE /api/v1/students/{studentId}/courses/{courseId}

6. Course Report

  • Course Report: GET /api/v1/courses/report

7. Student Report

  • Student Report: GET /api/v1/students/report

Sample Request Body

  • Student
    {
        "full_name_en": "John Doe",
        "full_name_km": "សុខ ស៊ីម៉ាន់",
        "date_of_birth": "1990-05-15", # format "yy,mm,dd"
        "gender": "male", # noted gender only lowercase
        "phone_number": "+855973238144",
        "courses": [
            "667fb8a1fd67fa8bce216370",
            "667fb9e20d778b0eb1a8d0db"
        ], # noted course can optionaly
    }
  • Course
    {
        "name": "Introduction to Computer Science",
        "professor_name": "Dr. Jane Smith",
        "limit_number_of_students": 30,
        "start_date": "2024-09-01",
        "end_date": "2024-12-15",
        "enrolled_students": [
            "667f9b5d608df88473d6dc1a",
            "667fbc0c2ee96d8d99d0b68e"
        ], # noted enrolled_students can be optionaly 
    }

Sample Response Body

  • Student
    {
        "_id": "667fbc0c2ee96d8d99d0b68e",
        "full_name_en": "John Doe",
        "full_name_km": "សុខ ស៊ីម៉ាន់",
        "date_of_birth": "1990-05-15T00:00:00.000Z",
        "gender": "male",
        "phone_number": "+855973238144",
        "courses": [
            "667fb8a1fd67fa8bce216370",
            "667fb9e20d778b0eb1a8d0db"
        ],
        "is_deleted": false,
        "create_at": "2024-06-29T07:47:24.711Z",
        "__v": 3
    }
  • Course
    {
        "_id": "667fb9e20d778b0eb1a8d0db",
        "name": "Introduction to Computer Science",
        "professor_name": "Dr. Jane Smith",
        "limit_number_of_students": 30,
        "start_date": "2024-09-01T00:00:00.000Z",
        "end_date": "2024-12-15T00:00:00.000Z",
        "enrolled_students": [
            "667f9b5d608df88473d6dc1a",
            "667fbc0c2ee96d8d99d0b68e"
        ],
        "is_deleted": false,
        "create_at": "2024-06-29T07:38:10.361Z",
        "__v": 1
    }

Validation

Student Document Validation:

  1. full_name_en: Must be a non-empty string.
  2. full_name_km: Must be a non-empty string.
  3. date_of_birth: Must be a valid date.
  4. gender: Must be either "male", "female", or “other” valid options.
  5. phone_number: Must be a valid phone number format .
  6. courses : 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. professor_name: Must be a non-empty string.
  3. limit_number_of_students: Must be a positive integer.
  4. start_date: Must be a valid date.
  5. end_date: Must be a valid date and must be after start_date.
  6. enrolled_students: Must be an array of valid student IDs. The string of IDs should not exceed .

(back to top)

Contact

Smoeury Songvat - @Songvat - songvatsmoeury@gmail.com

Project Link: https://github.com/vath-song99/scm_monolithic

(back to top)

About

school-course-management assignment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published