Flight ticket aggregator processes the flight Records to send an email, offering a discount on upgrade to a higher class, to all the passengers who have booked tickets on its flights.
Below is a list of API endpoint with their respective input and output.
The API processes the input file sent via the request over the endpoint. Then write it to the passed record file. The records that fail the validation, get stored in the failed record file. So, that someone can look at them and fix the problem. Both files get stored inside the uploads folder.
First_name, Last_name, PNR, Fare_class, Travel_date, Pax, Ticketing_date, Email, Mobile_phone, Booked_cabin
POST
/upload/flightRecord
- Header.
- Content-Type = multipart/form-data
- Body.
- formKey = flightRecord
- formValue = file in .CSV format
[
{
"Upload": "File_Upload_Status",
"Filename": "Uploaded_Filename",
"Records": {
"PassedRecordFileName": "Passed_Record_FileName",
"FailedRecordFileName": "Failed_Record_FileName",
"PassedRecordFilePathUrl": "Passed_Record_FilePath_Url",
"FailedRecordFilePathUrl": "Failed_Record_FilePath_Url"
}
},
]
NOTE: Only CSV file formats are allowed for the file upload, File Upload Size limit has been set to 5 MB, The value can be adjusted via constant attribute UploadFileSizeLimit declared inside constant.go file.
- make lint
- make test
- make build
- make image
- make run
- make
The File watcher has been setupped on the import folder to process the flight records manually via the application which checks for the newly available CSV files in the import directory and processes them. Then writes the passed entries to the passed record file. The records that fail the validation, get stored as a failed record file. Both files get stored inside the uploads folder.
After Starting the server via the make run command the GUI will be available over the path Url, A simple GUI accepting the files to be uploaded and sending those files over the API endpoint.
The docker file has been added with the application along with the docker-compose file, The docker image can be created using the make image command which later can get used by the docker-compose file to serve the application over the path Url for the GUI access.
The unit tests have been added with the application inside the service folder for performing unit tests on the business logic of the application.