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:

  1. Students API
    1. Get list of all students: GET http://localhost:8080/api/students
    2. Get student by ID: GET  http://localhost:8080/api/students/{id}
    3. Create new student: POST http://localhost:8080/api/students
    4. Update existing student: PUT http://localhost:8080/api/students/{id}
    5. Delete existing student: DELETE http://localhost:8080/api/students/{id}
  2. Cources API
    1. Get list of all courses: GET http://localhost:8080/api/courses
    2. Get course by ID: GET  http://localhost:8080/api/courses/{id}
    3. Create new course: POST http://localhost:8080/api/courses
    4. Update existing course: PUT http://localhost:8080/api/courses/{id}
    5. Delete existing course: DELETE http://localhost:8080/api/courses/{id}
  3. Registration API
    1. Register student to course by ID: POST http://localhost:8080/api/students/{id}/register/{id}
  4. Reports API
    1. Get list of all student's courses by ID: GET http://localhost:8080/api/reports/student/{id}/courses
    2. Get list of all courses' students by ID: GET http://localhost:8080/api/reports/course/{id}/students
    3. Get list of all students without any courses: GET http://localhost:8080/api/reports/studentsWithoutAnyCourses
    4. Get list of all courses without any students: GET http://localhost:8080/api/reports/coursesWithoutAnyCourses

Link to GitHub project: https://github.com/scalan75/SchoolRegistrationSystem

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :