GithubHelp home page GithubHelp logo

dieudonneawa / wayfarer Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 1.37 MB

WayFarer is a public bus transportation booking server, where a client can book a trip, view all his/her bookings and can cancel any if necessary.

JavaScript 100.00%
wayfarer wayfarer-andela andela adc-challenge booking-website wayfarer-api

wayfarer's Introduction

WayFarer

WayFarer is a public bus transportation booking server where a client can book a trip, view all his/her bookings and can cancel any if necessary. to understand more, visit the api documentation hosted on heroku at: WayFarer API Documentation

Build Status Coverage Status Maintainability

WayFarer API

Required features

  1. User can sign up.
  2. User can sign in.
  3. Admin can create a trip.
  4. Admin can cancel a trip.
  5. Both Admin and Users can see all trips.
  6. Users can book a seat on a trip.
  7. View all bookings. An Admin can see all bookings, while user can see all of his/her bookings.
  8. Users can delete their booking.

Added features

  1. Admin can update a trip.
  2. Both user and admin can get a particular trip.
  3. Users can update their booking.
  4. Admin can create a bus.
  5. Both admin and users can get a bus.
  6. Admin can delete a bus.
  7. Admin can update a bus.

Optional features

  1. Users can get a list of filtered trips based on origin.
  2. Users can get a list of filtered trips based on destination.
  3. Users can specify their seat numbers when making a booking.

API Endpoints

Sign up endpoint

Endpoints Request Method Request parameter
/api/v1/auth/signup POST

Sign in endpoint

Endpoints Request Method Request parameter
/api/v1/auth/signin POST

Trips endpoint

Endpoints Request Method Request parameter
/api/v1/trips POST
/api/v1/trips GET
/api/v1/trips/:tripId GET tripId
/api/v1/trips/:tripId PATCH tripId
/api/v1/trips/:tripId DELETE tripId

Bookings endpoint

Endpoints Request Method Request parameter
/api/v1/bookings POST
/api/v1/bookings GET
/api/v1/bookings/:bookingId GET bookingId
/api/v1/bookings/:bookingId PATCH bookingId
/api/v1/bookings/:bookingId DELETE bookingId

Buses endpoint

Endpoints Request Method Request parameter
/api/v1/buses POST
/api/v1/buses GET
/api/v1/buses/:busId GET busId
/api/v1/buses/:busId PATCH busId
/api/v1/buses/:busId DELETE busId

Example - Sign up

Sign up a user

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/auth/signup

Request Type: POST

Response:

{
 "status": "Success",
 "data": {
   "id": 1,
   "first_name": "John",
   "last_name": "Richman",
   "username": "Richman",
   "email": "[email protected]",
   "is_admin": 0,
   "token": "eyJhbGciOiJIU..."
 }
}

Sign in a user

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/auth/signin

Request Type: POST

Response:

{
 "status": "Success",
 "data": {
   "id": 1,
   "first_name": "John",
   "last_name": "Richman",
   "username": "Richman",
   "email": "[email protected]",
   "is_admin": false,
   "token": "eyJhbGciOiJIUzI1NiI..."
 }
}

Examples - trips

create a trip

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/trips

Request Type: POST

Response:

{
"status": "Success",
"data": {
  "id": 1,
  "bus_id": 0,
  "origin": "Yaounde",
  "destination": "Lagos",
  "trip_date": "2019-07-20T00:00:00.000Z",
  "fare": 70000,
  "status": 1
 }
}

Get a specific trip

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/trips/2

Request Type: GET

Response:

{
  "status": "Success",
  "data": {
    "id": 1,
    "bus_id": 0,
    "origin": "Yaounde",
    "destination": "Lagos",
    "trip_date": "2019-07-20T00:00:00.000Z",
    "fare": 70000,
    "status": 1
   }
}

Update a trip

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/trips/2

Request Type: PATCH

Response:

{
  "data": {
    "id": 1,
    "bus_id": 0,
    "origin": 0,
    "destination": 0,
    "trip_date": 0,
    "fare": 0,
    "status": 0
   },
   "message": "Trip updated successfully"
}

Delete a trip

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/trips/2

Request Type: DELETE

Response:

{
  "status": "Trip deleted!",
  "data": []
}

Example - Buses

Create bus

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/buses

Request Type: POST

Get a specific bus

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/buses/1

Request Type: GET

Update a bus

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/buses/1

Request Type: PATCH

Delete a bus

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/buses/1

Request Type: DELETE

Example - Bookings

Create a booking

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/bookings

Request Type: POST

Get a specific booking

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/bookings/1

Request Type: GET

Update a booking

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/bookings/1

Request Type: PATCH

Delete a booking

URL: http://adc-wayfarer-andela.herokuapp.com/api/v1/bookings/1

Request Type: DELETE

wayfarer's People

Contributors

dieudonneawa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.