diff --git a/backend/README.md b/backend/README.md index 8e31e11..08f0aef 100644 --- a/backend/README.md +++ b/backend/README.md @@ -13,7 +13,8 @@ To run: 3. Activate the virtual environment: `. .venv/bin/activate` 4. Install dependencies: `pip install -r requirements.txt` 5. Run the database: `../db/run.sh` (you must have Docker installed and running). -6. Create the database schema: `../db/create-schema.sh` +6.run the server python3 main.py +7. Create the database schema: `../db/create-schema.sh` You may want to run `python3 populate.py` to populate sample data. diff --git a/backend/endpoints.py b/backend/endpoints.py index 0e177a0..b7c091e 100644 --- a/backend/endpoints.py +++ b/backend/endpoints.py @@ -157,8 +157,13 @@ def send_bloom(): return type_check_error user = get_current_user() + content = request.json["content"] - blooms.add_bloom(sender=user, content=request.json["content"]) + # Validate bloom length + if len(content) > 280: + return make_response({"error": "Bloom must be 280 characters or less"}, 400) + + blooms.add_bloom(sender=user, content=content) return jsonify( { diff --git a/backend/requirements.txt b/backend/requirements.txt index e03836c..5e11b05 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -11,7 +11,7 @@ idna==3.10 itsdangerous==2.2.0 Jinja2==3.1.5 MarkupSafe==3.0.2 -psycopg2==2.9.10 +psycopg2-binary==2.9.10 pycparser==2.22 PyJWT==2.10.1 python-dotenv==1.0.1