Skip to content

andela/technites-bn-backend

Repository files navigation

Coverage Status Maintainability Build Status Reviewed by Hound

Barefoot Nomad

Making company travel and accommodation easy and convinient.

Vision

Make company global travel and accommodation easy and convenient for the strong workforce of savvy members of staff, by leveraging the modern web.


Pre-requisites

  • Install Node.js if you dont have it installed.
  • Install Postgresql to your system
  • Install Redis database

Environment Setup

  1. git clone this repository && cd to the project directory
  2. with postgres create a 2 databases : one for test and another for development
  3. run npm install to install dependencies
  4. create a .env file in the root project directory
  5. copy the .env.example to the .env file and update it accordingly
  6. run npm run migrate && npm run seed to create the schemas and seed
  7. run npm run test to test the application unit tests

Testing specific endpoints:

Run in Postman or view full documentation of the API can be found here

Run the application with npm run dev and open an API testing tool. We will use Postman for this case.

http://localhost:3000/api/v1/<endpoint>
Authentication
Method EndPoint Enable a user:
POST /auth/signup Register to the barefoot
POST /auth/login Login to barefoot after email confirmation
POST /auth/logout Logout from barefoot
User
Method EndPoint Enable a user:
POST /auth/reset Request for password reset
PATCH /users/editprofile Edit user profile
Host
Method EndPoint Enable a user:
POST /host Add a verified host (Super admin)
Accommodation
    {
        accommodation_name: "myAccommodation",
        description: "This is my accommodation" ,
        location: "Kigali",
        images: "image upload",
    }
Method EndPoint Enable a user:
POST /accommodations Add an accommodation (Travel Admins / Verified Host)
GET /accommodations Get a list of all the accommodations
GET /accommodations/:id Get a specific accommodation
POST /accommodations/:id/rooms Add a room to a given accommodation (Travel admins/ Hosts)
GET /accommodations/:id/rooms get a list of all rooms in the specific accommodation
GET /accommodations/:id/rooms/:id get a specific room
POST /accommodations/:id/like Like a specific accommodation
PUT /accommodations/:id/unlike Unlike a specific accommodation
POST /accommodations/:id/feedback Provide feedback to a specific accommodation
Requests
    {
    request_type: "ReturnTrip",
    location_id: 1,
    departure_date: "2020-09-25",
    destinations: [
        { "destination_id": 2, "accomodation_id": 1, "room_id": 1, "check_in": "2020-09-25", "check_out": "2020-09-26"},
        { "destination_id": 3, "accomodation_id": 2, "room_id": 2, "check_in": "2020-09-27", "check_out": "2020-09-28"}
        ],
    reason: "Reason for the request",
    return_date: "2020-10-25"
    }
Method EndPoint Enable a user:
POST /requests Make a trip request
PATCH /request/:id Edit a trip request
POST /request/:id/comment Comment on a request
GET /requests/:id/approve Approve a trip request (Manager)
GET /requests/:id/reject Reject a trip request (Manager)
GET /requests?{query params} Reject a trip request (Manager)

Licence

This software is published by The Technites Dev Team under the MIT licence.

Contributors

Paul Otieno -TTL || Fred Mucyo || Didas Mbalanya || Jordy Bastien || Amily Kassim || Titus Thumbi