Skip to content

MinaJP/CarPal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CarPal

Project is in progress.

A ride-sharing IOS app that allows Cornell students to schedule rides with fellow students who depart from and arrive at similar locations.

iOS Interface:

Address:

http://34.86.45.240 (down)

Database Tables

User:

Fields:
id: unique user id,
username,
requests_sent: requests to join other's people's rides, 
requests_received: requests from others to join your ride(s),
rides_created,
rides_joined

Ride:

Fields:
id: unique ride id,
origin: starting place of the ride,
destination: ending place of the ride,
scheduled: time the ride leaves in Unix,
creator: id of the creator,
members: id of people joining the ride,
requests: requests to join this ride

Requests:

Fields:
id: unique request id,
time: time the request is sent,
sender_id: id of the sender,
receiver_id: id of the owner of the ride,
ride_id: id of the ride,
message: message from sender to receiver,
accepted: status of the request

API Specification:

Get a user


GET "/carshare/user/{user_id}/"
Response
    {
    "success": true,
    "data": {            
    "id": ,
    "username":
    "scheduled_ride": [ , ... ],
    "requests": [, ... ]
    }

Create a user


POST "/carshare/user/"
Request
    {
    "username": 
    }
Response
    {
    "success": true,
    "data": {            
        "id": ,
        "username":
        "scheduled_ride": [],
        "requests": []
        }
    }

Get rides that start at the same location, end in the same destination, and scheduled to be within 24 hours starting from the desired time input

        
GET "/carshare/ride/"
parameter -o query by origin
parameter -d query by destination
parameter -s query by time (unix)
Response
    {
    "success": true,
    "data": {
        "id": ,
        "origin": ,
        "destination": ,
        "scheduled": ,
        "creator": 
        "members" [, ... ]
        "request": [, ... ]    
        }
        {
        ...
        }
    }
        
    

Create a ride


POST "/carshare/{user_id}/ride/"
Request
    {
    "origin": 
    "destination":,
    "scheduled":,
    }
Response
    {
    "success": true,
    "data": {
        "id": ,
        "origin": ,
        "destination": ,
        "scheduled": ,
        "creator": 
        "members" []
        "request": []    
        }
    }

Delete scheduled ride plan


DELETE "/carshare/{user_id}/ride/{ride_id}/"
Response:
    {
    "success": true,
    "data": {
        "id": ,
        "timestamp": ,
        "creator": ,
        "ride_id": ,
        "message": ,
        "accepted": 
        }    
    }

Create Request to join ride


POST "/carshare/{user_id}/request/{ride_id}"
Request
    {
    "message":
    }
Response
    {
    "success": true,
    "data": {
        "id": ,
        "timestamp": ,
        "sender_id": ,
        "receiver_id": ,
        "ride_id": ,
        "message": ,
        "accepted": null
        }    
    }

Accept/Decline request


POST "/carshare/{user_id}/request/response/{request_id}"
Request
    {
    "accepted": true or false
    }
Response
    {
    "success": true,
    "data": {
        "id": ,
        "timestamp": 
        "sender_id": ,
        "creator": ,
        "ride_id": ,
        "message": ,
        "accepted": 
        }    
    }

Future Development:

  • Frontend use the id to request the user info (will need to change to credential and extra layer if do authentication)
  • a client should not be able to get access to all available user
  • a client should be able to request users that fit the search can be implement by
    • using parameter and query string (more automate and can handle different combination of parameter work)
    • using / / like was done in HW (we know how, might cause error if the input not exact)
  • Find rides should be able to search for rides within a radius of the starting and ending locations.
  • Mark requests false if ride's scheduled time passes current timestamp
  • Mark rides completed if ride's scheduled time passes current timestamp

Authors

Doanh Tran, Mina Prapakamol

About

Intro to Backend Development final project | ride sharing API | maintain carshare proposals and schedules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors