- Clone the repo or extract the content
- Run the project in linux / Mac:
- Install make if it is not installed in your system:
- Ubuntu:
sudo apt update sudo apt-get install make
- CentOs:
yum install make
- MacOs
brew install make
- Run the following command to build images & start project:
- Build images:
make build
- Create Database: (if the database didn't create automatically and showing any issue)
make create-db
- Start the project:
make start
- Stop the project:
make stop
- Build images:
- Test the project in specific URL in localhost:
https://localhost:8080
- Install make if it is not installed in your system:
With data initialization I have added 100 students and 10 test courses. So, I assume we are authorized to signup for course. Farther implementation we need to add Auth 2.0 (Authentication / Authorization)
API host: http://localhost:8080
Sign up for a course with the following request body.
POST /minden-api/v1/course-registration
Request Body:
- courseId: Real number, Id of the course that the student interested to sign up. (Required)
- studentId: Real number, Id of the student. (Required)
{ "courseId": courseId, "studentId": studentId }
Example Request Body:
{
"courseId": 1,
"studentId": 51
}
Respons:
1. Success Status 201: Successfully signed up for course Course 5 (course_id)
2. Failure Status 400: Course registration already exists.
2. List all courses that the student already signed up "/minden-api/v1/student/{student_id}/courses"
Get all signed up courses by the student.
GET /minden-api/v1/student/{studentId}/courses
i.e. GET /minden-api/v1/student/51/courses
Request Attributes:
- studentId: Real number, Id of the student to get all the registered courses those are active. (Required)
Response:
[
{
_"registration_id": 5,
"course_id": 1,
"course_name": "Course 1",
"status": "ACTIVE",
"registration_date": "2024-05-07T07:51:47.327+00:00"_
},
{
"registration_id": 6,
"course_id": 5,
"course_name": "Course 5",
"status": "ACTIVE",
"registration_date": "2024-05-07T09:25:16.027+00:00"
},
{
"registration_id": 7,
"course_id": 4,
"course_name": "Course 4",
"status": "ACTIVE",
"registration_date": "2024-05-07T09:26:51.584+00:00"
}
]
"minden-api/v1/student/{studentId}/courses/{courseId}"
Cancel Sign up for a course that the student already registered.
DELETE /minden-api/v1/student/{student_id}/courses/{course_id}
i.e. DELETE /minden-api/v1/student/51/courses/1
Request Attributes:
- courseId: Real number, Id of the course that the student interested to cancel sign up. (Required)
- studentId: Real number, Id of the student. (Required)
Example Response:
- Success Status 201: Successfully cancel the course
- Failure Status 400: Failed to cancel the course registration!.
4. List classmates those signed up for the same course that the student already signed up and currently active active "minden-api/v1/student/{studentId}/courses/{courseId}"
GET /minden-api/v1/student/51/classmates/1
i.e. GET /minden-api/v1/student/{studentId}/classmates/{courseId}
Request Attributes:
- courseId: Real number, Id of the course to find all students those signed up for the specific course. (Required)
- studentId: Real number, Id of the student. (Required) Example Response:
[
{
"id": 44,
"student_name": "Student 44",
"student_email": "[email protected]"
},
{
"id": 45,
"student_name": "Student 45",
"student_email": "[email protected]"
},
{
"id": 46,
"student_name": "Student 46",
"student_email": "[email protected]"
},
{
"id": 50,
"student_name": "Student 50",
"student_email": "[email protected]"
}
]