An open API service indexing awesome lists of open source software.

https://github.com/meereak/student-course-management


https://github.com/meereak/student-course-management

expressjs nodejs student-management typescript

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

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](https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=nodedotjs&logoColor=white)](https://nodejs.org/)
[![Express.js](https://img.shields.io/badge/Express.js-404D59?style=for-the-badge)](https://expressjs.com/)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)

(back to top)

## Getting Started

- ### Deployed
*To test the deployed API, click here.*[click-here](https://www.postman.com/student-management/workspace/student-course-management/collection/33490622-2705de04-cef1-491b-a9f6-4326419c4e2a?action=share&creator=33490622&active-environment=33490622-5dd37a83-ad36-4f4f-95d8-567eb83bd745)

- ### Local
#### Prerequisites

*This is an example of how to list things you need to use the software and how to install them.*
* npm
```sh
npm install npm@latest -g
```
or

* yarn
```sh
npm install yarn@latest -g
```
### Installation

_Below is an example of how to settup the project requirement

1. Clone the repo
```sh
https://github.com/MeeReak/student-course-management.git
```
2. Install NPM or YARN packages
```sh
npm install
```
or

```sh
yarn install
```
3. Enter your .env variables in `configs/.env`
```js
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
```sh
npm run start:dev
```
or
```sh
yarn start:dev
```
2. Run Test
```sh
npm run start:test
```
or

```sh
yarn start:test
```
Below are some examples of how to use the API endpoints.

_For more examples, please refer to the [Documentation](https://www.postman.com/student-management/workspace/student-course-management/collection/33490622-2705de04-cef1-491b-a9f6-4326419c4e2a?action=share&creator=33490622&active-environment=33490622-5dd37a83-ad36-4f4f-95d8-567eb83bd745)_

### 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**
```sh
{
"name":{
"en": "Kaizen",
"km": "សុខគា"
},
"dateOfBirth": "02-02-2022", # format "yy,mm,dd"
"gender": "Male",
"phoneNumber": "0123456789"
"courses": [
"667fb8a1fd67fa8bce216370",
"667fb9e20d778b0eb1a8d0db"
],
}
```

- **Course**
```sh
{
"name": "Javascript",
"professorName": "Kaizen",
"startDate": "04-01-2024",
"endDate": "12-01-2024",
"limit": 15,
"Enroll": [
"667f9b5d608df88473d6dc1a",
"667fbc0c2ee96d8d99d0b68e"
],
}
```

## Sample Response Body

- **Student**
```sh
{
"_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**
```sh
{
"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](https://www.facebook.com/mee.reak.9461) - meereak168@gmail.com

Project Link: [https://github.com/MeeReak/student-course-management.git](https://github.com/MeeReak/student-course-management.git)

(back to top)