How kumarbablu5598/game-renting-service works
Game Renting Service is a Spring REST API for adding and removing games and managing member loans. The request flow is HTTP client → game controller → service, which enforces uniqueness, availability, ownership, and the three-active-loan limit using game and loan repositories. JPA entities persist the catalog and active loans in the configured embedded H2 database. The README documents the API and H2 console; source excerpts show controller delegation and service-to-repository calls, but not the application configuration or database wiring.
Main entry points: GameController.java Game Endpoints · GlobalExceptionHandler.java Global Exception Handler · GameService.java Game Service · GameRepository.java Game Repository
Components 15
HTTP API
- Game Endpoints
src/main/java/com/vromo/gamerentingservice/controller/GameController.java - Create Game Request
src/main/java/com/vromo/gamerentingservice/dto/CreateGameRequest.java - Game Response
src/main/java/com/vromo/gamerentingservice/dto/GameResponse.java - Loan Response
src/main/java/com/vromo/gamerentingservice/dto/LoanResponse.java
Game And Loan Rules
- Game Service
src/main/java/com/vromo/gamerentingservice/service/GameService.java - Game Entity
src/main/java/com/vromo/gamerentingservice/entity/Game.java - Loan Entity
src/main/java/com/vromo/gamerentingservice/entity/Loan.java
Persistence
- Game Repository
src/main/java/com/vromo/gamerentingservice/repository/GameRepository.java - Loan Repository
src/main/java/com/vromo/gamerentingservice/repository/LoanRepository.java - H2 Database
Error Handling
- Global Exception Handler
src/main/java/com/vromo/gamerentingservice/exception/GlobalExceptionHandler.java - Bad Request Exception
src/main/java/com/vromo/gamerentingservice/exception/BadRequestException.java - Not Found Exception
src/main/java/com/vromo/gamerentingservice/exception/ResourceNotFoundException.java - Error Response
src/main/java/com/vromo/gamerentingservice/exception/ErrorResponse.java
Other components
- HTTP Client
Connections 15
- HTTP Client → Game Endpoints: sends requests
src/main/java/com/vromo/gamerentingservice/controller/GameController.java - Game Endpoints → Game Service: delegates actions
src/main/java/com/vromo/gamerentingservice/controller/GameController.java - Game Endpoints → Create Game Request: accepts payload
src/main/java/com/vromo/gamerentingservice/controller/GameController.java - Game Endpoints → Game Response: returns game
src/main/java/com/vromo/gamerentingservice/controller/GameController.java - Game Endpoints → Loan Response: returns loan
src/main/java/com/vromo/gamerentingservice/controller/GameController.java - Game Service → Game Repository: checks and saves
src/main/java/com/vromo/gamerentingservice/service/GameService.java - Game Service → Loan Repository: checks and changes
src/main/java/com/vromo/gamerentingservice/service/GameService.java - Game Repository → Game Entity: persists
src/main/java/com/vromo/gamerentingservice/repository/GameRepository.java - Loan Repository → Loan Entity: persists
src/main/java/com/vromo/gamerentingservice/repository/LoanRepository.java - Game Entity → Loan Entity: references loan
src/main/java/com/vromo/gamerentingservice/entity/Game.java - Game Repository → H2 Database: database access
- Loan Repository → H2 Database: database access
- Global Exception Handler → Bad Request Exception: handles
src/main/java/com/vromo/gamerentingservice/exception/GlobalExceptionHandler.java - Global Exception Handler → Not Found Exception: handles
src/main/java/com/vromo/gamerentingservice/exception/GlobalExceptionHandler.java - Global Exception Handler → Error Response: builds
src/main/java/com/vromo/gamerentingservice/exception/GlobalExceptionHandler.java