Skip to content

gamzegenc99/FlightSearchAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Flight Search API

Flight Search API is a Java project that creates the backend side of a flight search application. This API provides CRUD operations to manage flights and airports and also includes a Search API to list flights that match the given origin, destination, departure date and return date.

Project Structure

The project is written in Java(version 21) and developed using the Spring Boot(version 3.2.1) framework. MySQL was used as the database.

  1. Controller Layer: For API endpoints.

  2. Service Layer: For business logic.

  3. Repository Layer: For database access.

  4. Entity Layer: Classes to represent database tables.

  5. Security Layer: For authentication and authorization.

    Dependencies

    • Maven
    • Spring Boot Starter Web
    • Spring Boot Starter Data JPA
    • Spring Boot Starter Security
    • H2 Database
    • MySQL connecter

    Entity

    1. Flight

      • id (Long)
      • departureAirport (Airport)
      • arrivalAirport (Airport)
      • departureDateTime (DateTime)
      • arrivalDateTime (DateTime)
      • price (BigDecimal)
    2. Airport

      • id (Long)
      • city (String)

    Parameters

  • departureLocation: Departure location
  • arrivalLocation: Arrival location
  • departureDate: Departure date
  • returnDate: Return date (optional)

CRUD operations

  • Basic CRUD operations are supported for flights.
  • Basic CRUD operations are supported for airports.

Endpoint -Search API

GET /api/flights/search

Authentication

Scheduled Background Jobs

A background job running daily at a specific time (for now every 60 seconds)retrieves flight information from a third-party API and stores it in the database.
Mock data is generated by making a mock API request.(-StartupRunner.java)

Installation

  1. Clone the project: git clone https://github.com/gamzegenc99/FlightSearchAPI.git
  2. Navigate to the project directory: cd FlightSearchAPI
  3. Run the application: ./mvnw spring-boot:run
  4. Access Swagger documentation in the browser: http://localhost:8080/swagger-ui.html

NOTES:

  • Java version 21, If you want to change it according to the version on your computer, you can change it from pom.xml.
  • Credential for login: username : username , password : password
  • If MySQL is not installed on your computer you can use H2 database, resources -> application.properties put MySQL in the comment line and remove the H2 database from the comment line.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages