niming_backend/blueprints/general/comment.py

16 lines
479 B
Python
Raw Permalink Normal View History

2024-12-23 02:03:55 +08:00
from flask import Blueprint, abort
from utils import dbhelper
from utils.misc import internal_json2protobuf
# prefix: /comment
bl_comment = Blueprint('comment', __name__)
# 獲取指定文章的留言
@bl_comment.route("/<sha1>", methods = ["GET"])
def getcomment(sha1:str):
resfn, code = dbhelper.solo_comment_fetcher("general", key=sha1)
if code == 200:
return internal_json2protobuf(role="general", otype='c', original=[resfn]), code
return abort(code)