Example #1
0
def comments():
    if request.method == 'GET':
        return '', 200
    elif request.method == 'POST':
        parent_id = request.json['parent_id']
        message = request.json['message']
        entity = ds.insert_comment(parent_id, message)
        return entity, 201
Example #2
0
def comments():
    if request.method == 'GET':
        parent_id = request.args['parent_id']
        entities = ds.get_comments(parent_id)
        res = {'comments': entities}
        return res, 200

    elif request.method == 'POST':
        parent_id = request.json['parent_id']
        message = request.json['message']
        entity = ds.insert_comment(parent_id, message)
        return entity, 201