summaryrefslogtreecommitdiff
path: root/src/controllers/replies_controller.py
blob: d7be3d04ee3379f1058a4e3adb17062db7caf930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from flask import Blueprint, request, abort, render_template
from src.services import CreateReplyService


replies_blueprint = Blueprint('replies_controller',
                              '__replies_controller__')


@replies_blueprint.post('/api/comments/<int:comment_id>/replies')
def create(comment_id):
    breakpoint()
    service = CreateReplyService(request.get_json(), comment_id)
    status_code = service.call()

    if status_code != 200:
        abort(status_code)

    return render_template('comments/index.jinja')