https://github.com/mateusvrs/balleair-backend
BalleAir Challenge Backend
https://github.com/mateusvrs/balleair-backend
ballerini django-rest-framework heroku
Last synced: about 2 months ago
JSON representation
BalleAir Challenge Backend
- Host: GitHub
- URL: https://github.com/mateusvrs/balleair-backend
- Owner: mateusvrs
- Created: 2022-04-02T22:40:43.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-03T03:12:29.000Z (about 3 years ago)
- Last Synced: 2025-01-16T02:45:41.306Z (4 months ago)
- Topics: ballerini, django-rest-framework, heroku
- Language: Python
- Homepage:
- Size: 185 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
BalleAir Backend
✏️ Project
BalleAir was a challenge proposed by the Ballerini Community. The project consisted of creating an API in
which it was possible to list, book and cancel airline flights.
✨ Extra
To improve the proposed challenge, I added a user registration with two types of users that are travelers and
airline. Travelers can book and cancel flights. The airline can create and delete flights. One important
thing is that anyone can create a traveler account, but only I with the superuser account can create airline
accounts.
Airline accounts to test:
username = Latam
password = balleair-latam
username = Azul
password = balleair-azul
username = Gol
password = balleair-gol
📝 Documentation
Users
All users API functions are preceded by /users/ on the root url
- POST: register/traveler/
Return all informations of the new travler.
body:
{
owner: {
"username": string,
"email": string,
"password": string
}
}
POST: token/
Return access and refresh tokens of the user.
body:
{
"username": string,
"password": string
}
GET: info/
Return all informations of the user.
headers:
{
'Authorization': 'Bearer {accesstoken}'
}
Flights
All flights API functions are preceded by /flights/ on the root url
- POST: create/
Return all informations of the new flight.
body:
{
"pax": {
"available": number
},
"departure_airport": string,
"arrival_airport": string,
"flight_date": string (datetime -> 2022-06-07T10:30),
"aircraft": string
}
headers:
{
'Authorization': 'Bearer {airline_accesstoken}'
}
GET: list/
Return all flights from the authenticated airline.
headers:
{
'Authorization': 'Bearer {airline_accesstoken}'
}
GET, PUT, PATCH, DELETE: detail/{flight_number}/
Return specific flight from the authenticated airline and give you the access to handle this flight.
body:
{
"pax": {
"available": number
},
"departure_airport": string,
"arrival_airport": string,
"flight_date": string (datetime -> 2022-06-07T10:30),
"aircraft": string
}
headers:
{
'Authorization': 'Bearer {airline_accesstoken}'
}
GET: retrieve/?
Return specific flight from the authenticated airline based on some query parameters.
possible query parameters:
airline = number -> airline_id,
departure_airport = string,
arrival_airport = string,
flight_date = string (datetime -> 2022-06-07T10:30),
headers:
{
'Authorization': 'Bearer {airline_flight_owner_accesstoken}'
}
GET: book/{flight_number}/
Book a flight.
headers:
{
'Authorization': 'Bearer {traveler_accesstoken}'
}
GET: cancel/{flight_number}/
Cancel a flight booked before.
headers:
{
'Authorization': 'Bearer {traveler_accesstoken}'
}
GET: airports/
Return all airports available.
headers:
{
'Authorization': 'Bearer {accesstoken}'
}
GET: aircrafts/
Return all aircrafts available.
headers:
{
'Authorization': 'Bearer {accesstoken}'
}