FlightPlanner is a web application that allows customers to search for flights and administrators to manage flights. The application provides APIs for searching flights and airports, adding and deleting flights, and clearing the list of flights.
To get started with FlightPlanner, you'll need to have the following installed on your system:
Once you've installed the required software, you can run FlightPlanner by following these steps:
Clone the repository to your local machine.
Navigate to the FlightPlanner
directory.
Run dotnet build
to build the application.
Run dotnet run
to start the application.
By default, the application runs on http://localhost:5000
.
The FlightPlanner application provides the following API endpoints:
GET /api/airports?search={search}
: Returns a list of airports that match the specified search term.
POST /api/flights/search
: Searches for flights that match the specified criteria.
GET /api/flights/{id}
: Returns the flight with the specified ID.
GET /admin-api/flights/{id}
: Returns the flight with the specified ID.
PUT /admin-api/flights
: Adds a new flight.
DELETE /admin-api/flights/{id}
: Deletes the flight with the specified ID.
POST /testing-api/clear
: Clears the list of flights.
The FlightPlanner application uses the following data models:
Airport
: Represents an airport.
Flight
: Represents a flight.
FlightSearch
: Represents a flight search request.
AddFlightRequest
: Represents a request to add a new flight.
PageResult
: Represents a page of search results.
The FlightPlanner application uses the following controllers:
CustomerApiController
: Handles requests made by customers.
AdminApiController
: Handles requests made by administrators.
TestingApiController
: Handles requests related to testing.
The FlightPlanner application uses a simple in-memory storage mechanism to store flights. The FlightStorage
class provides methods for adding, deleting, and searching for flights.
The FlightPlanner application uses validation to ensure that input data is valid. The ValidateSearch
class provides methods for validating flight search requests, and the ValidateFlight
class provides methods for validating requests to add new flights.
The FlightPlanner application uses token-based authentication to secure the admin API endpoints. Admin users must include a valid access token in the Authorization
header of their requests.