Exemplo n.º 1
0
def update_comment(board, comment_id, content):
    comment = Comment.get(comment_id, board.id)
    if not comment:
        return ERROR_COMMENT_NOT_FOUND.get_response()
    comment.update(content)
    return SUCCESS_UPDATE_COMMENT.get_response()
Exemplo n.º 2
0
def delete_comment(board, comment_id):
    comment = Comment.get(comment_id, board.id)
    if not comment:
        return ERROR_COMMENT_NOT_FOUND.get_response()
    Comment.delete(comment)
    return SUCCESS_DELETE_COMMENT.get_response()
Exemplo n.º 3
0
def get_comment_info(board, comment_id):
    comment = Comment.get(comment_id, board.id)
    if not comment:
        return ERROR_COMMENT_NOT_FOUND.get_response()

    return {"comment_info": comment.as_dict()}