This project is a Spring Boot-based Backend REST API solution developed for Lab Sheet 03 of the COSC 32133 - Full-Stack Software Development course. Its primary function is to manage vehicle service records, focusing on data retrieval and deletion functionalities.
This API successfully addresses the three main questions required by Lab Sheet 03:
- GET by Year (Q1): Retrieve a list of all vehicle service records for a specific service year.
- GET Vehicle Type (Q2): Retrieve only the vehicle type based on the provided Service ID.
- DELETE by Year (Q3): Delete all vehicle service records associated with a specific service year from the database.
| Component | Description |
|---|---|
| Backend | Java (Spring Boot) |
| Database | MySQL |
| ORM | Spring Data JPA / Hibernate |
| Dependencies | Lombok, Spring Web, MySQL Connector, HikariCP |
| Architecture | Layered Architecture (Controller, Service, Repository, Entity, DTO) |
| Port | 8081 (As defined by server.port=8081) |
| Purpose | HTTP Method | Endpoint | Controller Method |
|---|---|---|---|
| Q1: Get by Year | GET |
/api/service/year/{year} |
getVehiclesByYear |
| Q2: Get Vehicle Type | GET |
/api/service/service-id/{id} |
getServicebyId |
| Q3: Delete by Year | DELETE |
/api/service/delete-service/{year} |
deleteservice |
The project adheres to the Separation of Concerns principle and is divided into five distinct layers:
.Controller: Manages incoming HTTP requests and outgoing responses..Services: Implements the business logic and validation (e.g., checking if records exist before deletion)..Repository: Handles CRUD operations with the database using Spring Data JPA..Entity: Represents the database table (vehical) structure..DTO(Data Transfer Object): Used to safely transfer data between layers and prevent direct exposure of the database entity to the client.