Giter Club home page Giter Club logo

car-hire's Introduction

EnjoyTravel Tech Test

Set-up

  • Run ./vendor/bin/sail up -d to bring up Docker.
  • Run migrations: docker-compose run app php artisan migrate (ideally add to dockerfile)
  • Seed data: docker-compose run app php artisan db:seed

Endpoints

You can view the API's in the browser by going to http://localhost/docs.

Get cars available for hire

Get available cars

curl --location 'localhost/api/v1/cars?from_date=2025-04-06%2000%3A00%3A00&to_date=2025-04-06%2000%3A00%3A00&age=55' \
--header 'Accept: application/json'

Create booking

Create booking

curl --location 'localhost/api/v1/bookings' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "from_date": "2027-01-01 00:00:00",
    "to_date": "2027-02-01 00:00:00",
    "car_id": 1
}'

Update booking

Update booking

curl --location --request PATCH 'localhost/api/v1/bookings/1' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "from_date": "2027-01-01 00:00:00",
    "to_date": "2027-02-01 00:00:00",
    "car_id": 2
}'

Delete booking

Delete booking

curl --location --request DELETE 'localhost/api/v1/bookings/1'

Linting

Run docker-compose run app bin/lint

Tests

PHP

Run docker-compose run app ./vendor/bin/phpunit

If I had more time / other musings

  • Feature tests on booking CRUD endpoints
  • OAUTH Authentication / User stored on booking
  • More user friendly validation errors
  • Pipeline / CI / CD
  • Caching on bookings (kept fresh using events) / cars
  • Has potential to use ElasticSearch, but over-engineering at this point

car-hire's People

Contributors

scottdrinkwater avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.