Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion backend/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down
2 changes: 1 addition & 1 deletion db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down