niming_backend/blueprints/general/comment.py
2024-12-22 18:03:55 +00:00

16 lines
479 B
Python

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)