Skip to content
Open
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
13 changes: 12 additions & 1 deletion backend/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from datetime import timedelta

MINIMUM_PASSWORD_LENGTH = 5
MAX_BLOOM_LENGTH = 280


def login():
Expand Down Expand Up @@ -155,10 +156,20 @@ def send_bloom():
type_check_error = verify_request_fields({"content": str})
if type_check_error is not None:
return type_check_error

content = request.json["content"]

if len(content) > MAX_BLOOM_LENGTH:
return jsonify(
{
"success": False,
"message": f"Bloom content too long (max {MAX_BLOOM_LENGTH} characters)"
}
), 400

user = get_current_user()

blooms.add_bloom(sender=user, content=request.json["content"])
blooms.add_bloom(sender=user, content=content)

return jsonify(
{
Expand Down