From 04a7d86713295468f033654f2b39717217432541 Mon Sep 17 00:00:00 2001 From: Ebrahim Beiaty Date: Wed, 1 Apr 2026 23:44:34 +0100 Subject: [PATCH] add limit 280 char --- backend/endpoints.py | 9 ++++++++- db/schema.sql | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/endpoints.py b/backend/endpoints.py index 0e177a0..c48d380 100644 --- a/backend/endpoints.py +++ b/backend/endpoints.py @@ -157,8 +157,15 @@ def send_bloom(): return type_check_error user = get_current_user() + # Adding length check for bloom content + content = request.json["content"] + if len(content) > 280: + return make_response( + jsonify({"success": False, "message": "Bloom content exceeds 280 characters"}), + 400, + ) - blooms.add_bloom(sender=user, content=request.json["content"]) + blooms.add_bloom(sender=user, content=content) return jsonify( { diff --git a/db/schema.sql b/db/schema.sql index 61e7580..7306ad5 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -9,7 +9,7 @@ CREATE TABLE users ( CREATE TABLE blooms ( id BIGSERIAL NOT NULL PRIMARY KEY, sender_id INT NOT NULL REFERENCES users(id), - content TEXT NOT NULL, + content VARCHAR(280) NOT NULL, send_timestamp TIMESTAMP NOT NULL );