diff --git a/README.md b/README.md index ee78fa0..e957e6c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Originally created by Julia Ying, Grace Kim, Ritika Bhatnagar, Aasha Jain - To run the application, make two terminals: - Make sure you are in `backend` and run `python app.py`. - Make sure you are in `frontend` and run `npm run dev`. -- Navigate to http://localhost:5173/ to view application. (Backend runs on http://localhost:5000/). +- Navigate to http://localhost:5173/ to view application. (Backend runs on http://localhost:5005/). ### Deploying diff --git a/backend/app.py b/backend/app.py index d2bb7a0..1b0f2ee 100644 --- a/backend/app.py +++ b/backend/app.py @@ -228,6 +228,8 @@ def addride(): origin: a dictionary containing the origin location dest: a dictionary containing the destination location arrival_time: a datetime object with the arrival date & time + leave_by_time (optional): time to leave origin + phone_number (optional): contact phone number note (optional): note with the rideshare Returns: @@ -242,6 +244,8 @@ def addride(): dest_obj = data.get("destination") note = data.get("note") + leave_by_time = data.get("leave_by_time") + phone_number = data.get("phone_number") origin_addr = origin_obj["formatted_address"] origin_name = origin_obj["name"] @@ -270,6 +274,8 @@ def addride(): dest_json, arrival_time, note, + leave_by_time, + phone_number, ) return jsonify({"success": True, "message": "Rideshare successfully created!"}) except: @@ -742,4 +748,4 @@ def send_email_notification(netid, mail, subject, message): debug = FLASK_ENV == "development" if not app._got_first_request: database.database_setup() - app.run(host="0.0.0.0", port=5000, debug=debug) + app.run(host="0.0.0.0", port=5005, debug=debug) diff --git a/backend/database.py b/backend/database.py index 1311095..4ad059f 100644 --- a/backend/database.py +++ b/backend/database.py @@ -27,6 +27,8 @@ def database_setup(): creation_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, current_riders TEXT[][], + leave_by_time TIME, + phone_number VARCHAR(20), note VARCHAR(250) ); @@ -90,6 +92,8 @@ def create_ride( destination, arrival_time, note="", + leave_by_time=None, + phone_number=None, ): """ Adds a ride to the Rides database @@ -99,8 +103,8 @@ def create_ride( sql_command = f""" INSERT INTO Rides (admin_netid, admin_name, admin_email, max_capacity, current_riders, - origin_dict, destination_dict, arrival_time, note, updated_at) VALUES (%s, %s, %s, %s, - %s, %s, %s, %s, %s, CURRENT_TIMESTAMP); + origin_dict, destination_dict, arrival_time, leave_by_time, phone_number, note, updated_at) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, CURRENT_TIMESTAMP); """ values = ( @@ -112,6 +116,8 @@ def create_ride( origin, destination, arrival_time, + leave_by_time, + phone_number, note, ) diff --git a/frontend/src/components/WarningModal.jsx b/frontend/src/components/WarningModal.jsx index 08a37c7..3fa7680 100644 --- a/frontend/src/components/WarningModal.jsx +++ b/frontend/src/components/WarningModal.jsx @@ -3,11 +3,9 @@ export default function WarningModal({ isOpen, title, children }) { return (
Arrival Time (in ET)
+Leave By:
+Arrival Time (in ET)
-Optional Note to Riders
+Note to Riders (Optional)
+
@@ -96,6 +101,11 @@ export const renderRideCardInfo = (ride) => { className="inline-flex text-theme_medium_2 hover:text-theme_dark_2 ml-1 mb-0.5 align-middle" />
+ {ride.phone_number && ( ++ Phone: {ride.phone_number} +
+ )}Seats Taken:{" "} {ride.current_riders.length}/{ride.max_capacity} diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 91fd2f7..7cc708b 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -7,7 +7,7 @@ export default defineConfig(({ command }) => ({ server: { proxy: { "/api": { - target: "http://localhost:5000", + target: "http://localhost:5005", }, }, },