Learning Navigator is a RESTful API service using Spring Boot to manage the exam enrollment process for a Learning Management System (LMS) using Mysql.
- CRUD Operations: Create, Read, Update, and Delete operations for:
- Students
- Subjects
- Exams
- Student Enrollment: Enroll students in subjects and exams with validations.
- Subject-Exam Association: Assign exams to specific subjects.
- Relationships Management:
- Many-to-Many: Students and Subjects
- Many-to-One: Exams and Subjects
- Hidden Easter Egg Feature: Discover random facts about numbers using the Numbers API.
- Backend: Spring Boot
- Database: MySQL
- Testing: Mockito, MockMvc
- Integration: RestTemplate for external API calls (Numbers API)
-
Clone the Repository:
git clone https://github.com/geetanjaligit/LearningNavigator.git cd LearningNavigator
-
Setup MySQL Database:
- Ensure MySQL is installed and running locally on
localhost:3306
. - Default database:
lms
. - Configure username and password in
src/main/resources/application.properties
.
- Ensure MySQL is installed and running locally on
-
Configure Application Properties:
spring.jpa.hibernate.ddl-auto=update spring.datasource.url=jdbc:mysql://localhost:3306/lms spring.datasource.username=_____ spring.datasource.password=_____ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.jpa.show-sql=true
-
Run the Application:
./mvnw spring-boot:run
-
API Endpoints:
- Student Operations:
- Get All Students:
GET /students
- Get Student by ID:
GET /students/{studentId}
- Create Student:
POST /students
- Update Student:
PUT /students/{studentId}
- Delete Student:
DELETE /students/{studentId}
- Get All Students:
- Subject Operations:
- Get All Subjects:
GET /subjects
- Get Subject by ID:
GET /subjects/{subjectId}
- Create Subject:
POST /subjects
- Update Subject:
PUT /subjects/{subjectId}
- Delete Subject:
DELETE /subjects/{subjectId}
- Enroll Student in Subject:
POST /students/{studentId}/enroll/{subjectId}
- Get All Subjects:
- Exam Operations:
- Get All Exams:
GET /exams
- Get Exam by ID:
GET /exams/{examId}
- Create Exam:
POST /exams
- Update Exam:
PUT /exams/{examId}
- Delete Exam:
DELETE /exams/{examId}
- Assign Exam to Subject:
POST /subjects/{subjectId}/assign-exam
- Register Student for Exam:
POST /exams/{examId}/students/{studentId}
- Get All Exams:
- Easter Egg:
GET /easter-egg
- Student Operations:
- Controller: Manages API endpoints.
StudentController.java
SubjectController.java
ExamController.java
EasterEggController.java
- Service: Handles business logic.
StudentService.java
SubjectService.java
ExamService.java
- Repository: Interfaces with MySQL.
StudentRepository.java
SubjectRepository.java
ExamRepository.java
- Entity: Defines the data model.
Student.java
Subject.java
Exam.java
- Testing: Ensures reliability with JUnit, Mockito, and MockMvc.
StudentControllerTest.java
SubjectControllerTest.java
ExamControllerTest.java
POST /students
{
"studentName": "Anshu"
}