Java Spring app: School registration system
Task: Design and implement simple school registration system
- Assuming you already have a list of students
- Assuming you already have a list of courses
- A student can register to multiple courses
- A course can have multiple students enrolled in it.
- A course has 50 students maximum
- A student can register to 5 course maximum
Provide the following API:
- Create students CRUD
- Create courses CRUD
- Create API for students to register to courses
- Create Report API for admin user to view all relationships between students and courses
- Filter all students with a specific course
- Filter all courses for a specific student
- Filter all courses without any students
- Filter all students without any courses
Wrap everything in docker-compose and update README.md with following details:
• Endpoints and payloads
• How to setup project
Technology stack:
• Java
• Maven
• Spring Boot
• Docker (docker-compose)
• JUnit
• MySQL
Implementation
1. Installation
============================
Clone the the repository (use command and link in github).
git clone https://github.com/scalan75/SchoolRegistrationSystem.git
Check java(1.8):
java --version
And maven and docker-compose:
mvn
docker-compose
2. Build application
To build application use next command:
mvn clean install
docker-compose build
or run build.sh
(Linux or Mac).
Application will be built, tested and ready to use. Result jar file location: target/schoolRegistrationSystem-0.0.1-SNAPSHOT.jar
Be patient first time. Maven will load set of additional libraries so it might take few minutes to build.
3. Run application
To run application use next command:
docker-compose up -d
or run run.sh
(Linux or Mac).
Endpoint:
http://localhost:8080
List of REST API endpoints:
- Students API
- Get list of all students: GET http://localhost:8080/api/students
- Get student by ID: GET http://localhost:8080/api/students/{id}
- Create new student: POST http://localhost:8080/api/students
- Update existing student: PUT http://localhost:8080/api/students/{id}
- Delete existing student: DELETE http://localhost:8080/api/students/{id}
- Cources API
- Get list of all courses: GET http://localhost:8080/api/courses
- Get course by ID: GET http://localhost:8080/api/courses/{id}
- Create new course: POST http://localhost:8080/api/courses
- Update existing course: PUT http://localhost:8080/api/courses/{id}
- Delete existing course: DELETE http://localhost:8080/api/courses/{id}
- Registration API
- Register student to course by ID: POST http://localhost:8080/api/students/{id}/register/{id}
- Reports API
- Get list of all student's courses by ID: GET http://localhost:8080/api/reports/student/{id}/courses
- Get list of all courses' students by ID: GET http://localhost:8080/api/reports/course/{id}/students
- Get list of all students without any courses: GET http://localhost:8080/api/reports/studentsWithoutAnyCourses
- Get list of all courses without any students: GET http://localhost:8080/api/reports/coursesWithoutAnyCourses
Link to GitHub project: https://github.com/scalan75/SchoolRegistrationSystem