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()
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()
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()}