diff --git a/backend/__pycache__/app.cpython-311.pyc b/backend/__pycache__/app.cpython-311.pyc new file mode 100644 index 0000000..df217dc Binary files /dev/null and b/backend/__pycache__/app.cpython-311.pyc differ diff --git a/backend/__pycache__/db.cpython-311.pyc b/backend/__pycache__/db.cpython-311.pyc new file mode 100644 index 0000000..b80a2d9 Binary files /dev/null and b/backend/__pycache__/db.cpython-311.pyc differ diff --git a/backend/__pycache__/init.cpython-311.pyc b/backend/__pycache__/init.cpython-311.pyc new file mode 100644 index 0000000..53839b2 Binary files /dev/null and b/backend/__pycache__/init.cpython-311.pyc differ diff --git a/backend/init.py b/backend/init.py index f25c526..5f65b02 100644 --- a/backend/init.py +++ b/backend/init.py @@ -7,5 +7,7 @@ def create_app(): with app.app_context(): from routes.profile_routes import profile + from routes.trip_routes import trip app.register_blueprint(profile) + app.register_blueprint(trip) return app \ No newline at end of file diff --git a/backend/routes/__pycache__/profile_routes.cpython-311.pyc b/backend/routes/__pycache__/profile_routes.cpython-311.pyc new file mode 100644 index 0000000..3382841 Binary files /dev/null and b/backend/routes/__pycache__/profile_routes.cpython-311.pyc differ diff --git a/backend/routes/__pycache__/trip_routes.cpython-311.pyc b/backend/routes/__pycache__/trip_routes.cpython-311.pyc new file mode 100644 index 0000000..7749790 Binary files /dev/null and b/backend/routes/__pycache__/trip_routes.cpython-311.pyc differ diff --git a/backend/routes/profile_routes.py b/backend/routes/profile_routes.py index 45d0277..c2afa60 100644 --- a/backend/routes/profile_routes.py +++ b/backend/routes/profile_routes.py @@ -1,7 +1,8 @@ from flask import Flask, Blueprint, request import json from bson import json_util, ObjectId -from db import db +from db import db +import random profile = Blueprint("profile", __name__, url_prefix="/profile") @@ -9,6 +10,11 @@ def profile_home(): return "This is the profile routes" +@profile.route("/getRandomUsername", methods = ['GET']) +def get_random_username(): + data = db.profile.find({}, {"username" : True}) + return json.loads(json_util.dumps(random.choice(list(data)))) + @profile.route("/get/", methods=['GET']) def get_profile(username): diff --git a/backend/routes/trip_routes.py b/backend/routes/trip_routes.py index 65d90fb..7229c17 100644 --- a/backend/routes/trip_routes.py +++ b/backend/routes/trip_routes.py @@ -1,4 +1,16 @@ +from flask import Flask, Blueprint, request +import json +from bson import json_util +from db import db + +trip = Blueprint("trip", __name__, url_prefix="/trip") +trips = db.trip @trip.route("/") def trip_home(): - return "This is the homepage for trips" \ No newline at end of file + return "This is the profile routes" + +@trip.route("/get/", methods=['GET']) +def get_trip(state): + data = db.trip.find_one({'state': state}) + return json.loads(json_util.dumps(data)) \ No newline at end of file