FlightPlannerApp is a web application that provides flight management functionalities. It allows administrators to add, view, and delete flights, while customers can search for flights and view available airports. The application supports two profiles: in-memory and database, making it flexible for different environments.
- Admin API
- Add new flights
- View flight details by ID
- Delete flights by ID
- Customer API
- Search for available flights
- View airports by search term
- View flight details by ID
- Testing API
- Clear all flight data
- Spring Boot
- Spring Security
- JPA/Hibernate
- H2 Database
- Liquibase
- Jakarta Validation
- SpringDoc OpenApi (Swagger)
- Java 21
- Gradle 7.0+
- Git
- Clone the repository:
git clone https://github.com/Zelchs/flight-planner.git
cd flight-planner
- Build the project:
./gradlew clean build
- Set the active profile to
in-memory
:
export SPRING_PROFILES_ACTIVE=in-memory
- Run the application
./gradlew bootRun
- Set the active profile to
db
:
export SPRING_PROFILES_ACTIVE=db
- Run the application:
./gradlew bootRun
- Admin API: http://localhost:8080/admin-api/flights (requires authorization)
- Customer API: http://localhost:8080/api
- H2 Console: http://localhost:8080/h2-console (Database URL: jdbc:h2:mem:flightplannerdb, User: sa, Password: password)
Authorization Required: To access the Admin API endpoints, you need to authorize using the credentials specified in the application.properties file.
- GET /admin-api/flights/{id}
- Get flight details by ID.
- PUT /admin-api/flights
- Add a new flight.
- DELETE /admin-api/flights/{id}
- Delete a flight by ID.
- GET /api/airports
- Search for airports.
- GET /api/flights/{id}
- Get flight details by ID.
- POST /api/flights/search
- Search for flights.
- POST /testing-api/clear
- Clear all flight data.
spring.application.name=FlightPlannerApp
spring.security.user.name=codelex-admin
spring.security.user.password=Password123
spring.profiles.active=db
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.datasource.url=jdbc:h2:mem:flightplannerdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
logging.level.liquibase=INFO
spring.liquibase.change-log=classpath:/db/changelog/changelog-master.xml
The application uses basic authentication. The default username and password are specified in the application.properties file. Use these credentials to access the Admin API:
- Username: codelex-admin
- Password: Password123
You can access the Swagger UI to interact with the APIs and view the documentation: