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
8 changes: 7 additions & 1 deletion backend/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,16 @@ 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) > 280:
return make_response(
{"success": False, "message": "Blooms can't be longer than 280 charactes "

}
)
user = get_current_user()

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