Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#167730747 Creating of trip requests #40

Open
wants to merge 12 commits into
base: stage
Choose a base branch
from

Conversation

OlawaleJoseph
Copy link
Collaborator

@OlawaleJoseph OlawaleJoseph commented Sep 13, 2019

What does this PR do?

Enables users to create requests one-way, return, multi-city trip request

Description of Task to be completed?

  • Ensure only users with a requester role can access this endpoint.
  • Ensure requesters can create a one-way trip request.
  • Ensure requesters can create a return trip request.
  • Ensure requesters can create a multi-city trip request.

How should this be manually tested?

  • git clone this repo using the command git clone git@github.com:andela/firestar-backend.git

  • cd to the project

  • checkout to the branch using the command git checkout ft-create-trips-167730747

  • create a .env file and set PORT,JWT_SECRET and DB variables as specified in the .env.example file.

  • Run the command npm install in the terminal.

  • Open a terminal and run npm test.

  • Open a terminal and run npm run migrate:dev and npm run seed:dev

  • Open Postman, make a post request to localhost:port>/api/v1/auth/login, with any of the below
    in the request body.

  • {email: abc123@gmail.com}

  • {email: requester1@gmail.com}

  • {email: requester2@gmail.com}

  • {email: requester3@gmail.com}

    1. Copy the token in the reponse
    2. Make a POST request to http:localhost:<port>/api/v1/requests with the token obtained above in the request header as authorization=Bearer <token obtained>
    3. Send a request object containing the following for a one-way trip:
      { trip: { destinationLocationId: 2, departureLocationId: 1, accommodationId: 2, departureDate: '2020/10/10 18:00' }, reason: 'Business', departmentId: 2, tripType: 'oneWay', }
    4. Send a request object containing the following for a return trip:
      { initialTrip: { destinationLocationId: 2, departureLocationId: 1, accommodationId: 2, departureDate: '2020/10/10 18:00' }, returnTrip: { destinationLocationId: 1, departureLocationId: 2, departureDate: '2020/10/11 18:00' }, reason: 'Business', departmentId: 2, tripType: 'return', }
    5. Send a request object containing the following for a multi-city trip:
      { trips: [ { destinationLocationId: 2, departureLocationId: 1, accommodationId: 2, departureDate: '2020/10/10 18:00' }, { destinationLocationId: 1, departureLocationId: 2, departureDate: '2020/10/11 18:00' } ], reason: 'Business', departmentId: 2, tripType: 'multiCity', }
    6. Change values to check for edge cases.

Any background context you want to provide?

  • A requester with an open request cannot make more requests
  • The tripType can be either any of the following: oneWay, return, multiCity.
  • The departure date of the first trip object must be at least a week from the time of testing. In a real-world scenario, a request needs to be made ahead of time.
  • The departure dates of other trips except the first should be at least a day from each other. A user cannot travel to multiple countries in a day.
  • The departure date format is either YYYY-MM-DD hh:mm:ss or YYYY/MM/DD hh:mm:ss
  • When making a return trip ensure the destinationLocationId and departureLocationId are reversed for the return trip.
  • When making a multi-city request, ensure your current location is your departureLocationId. See third image below for clarification. Note the flow of the destinationLocationId and departureLocationId.

What are the relevant pivotal tracker stories?

#167730747
#167730748
#167730749

Screenshots (if appropriate)

Screenshot (74)

Screenshot (73)

Screenshot (75)

Screenshot (66)

Questions:

N/A

@rovilay rovilay had a problem deploying to firestar-backend-staging-pr-40 September 13, 2019 15:36 Failure
@rovilay rovilay had a problem deploying to firestar-backend-staging-pr-40 September 13, 2019 19:06 Failure
Copy link
Collaborator

@zanio zanio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1] @OlawaleJoseph Nice job, please see the screenshot. display a relevant message if the type of body is not application/json

image

Also update your PR under task to be completed, You have done all of those you described as task to be completed.

Also I see that it is only a requester that can make a travel request. So what if a manager wants to travel ? A manager is also under somebody. Or I'm i not getting something right ?

@OlawaleJoseph
Copy link
Collaborator Author

[1] @OlawaleJoseph Nice job, please see the screenshot. display a relevant message if the type of body is not application/json

image

Also update your PR under task to be completed, You have done all of those you described as task to be completed.

Also I see that it is only a requester that can make a travel request. So what if a manager wants to travel ? A manager is also under somebody. Or I'm i not getting something right ?

@zanio Thanks for the response.
I will look to into the request body type.
I think task to be completed means, the tasks expected to be completed/features expected to be functional.
Lastly, according to the PT story, only a requester can make trip request.

@OlawaleJoseph OlawaleJoseph added the peer Review This PR is up for team members reviews label Sep 14, 2019
Copy link
Collaborator

@dewaleolaoye dewaleolaoye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@rovilay rovilay had a problem deploying to firestar-backend-staging-pr-40 September 16, 2019 10:50 Failure
@OlawaleJoseph OlawaleJoseph added ready for merge This PR is ready for TTL review and merging and removed peer Review This PR is up for team members reviews labels Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for merge This PR is ready for TTL review and merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants