posting+video_part预
This commit is contained in:
parent
143367c29e
commit
7d9fb8d73d
4
app.py
4
app.py
@ -7,6 +7,8 @@ from controller.api.bilirecorder_blueprint import blueprint as api_bilirecorder_
|
||||
from controller.api.workflow_blueprint import blueprint as api_workflow_blueprint
|
||||
from controller.api.video_clip_blueprint import blueprint as api_video_clip_blueprint
|
||||
from controller.api.danmaku_clip_blueprint import blueprint as api_danmaku_clip_blueprint
|
||||
from controller.api.posting_blueprint import blueprint as api_posting_blueprint
|
||||
from controller.api.video_part_blueprint import blueprint as api_video_part_blueprint
|
||||
from model import db
|
||||
|
||||
app = Flask(__name__)
|
||||
@ -24,6 +26,8 @@ app.register_blueprint(api_bilirecorder_blueprint)
|
||||
app.register_blueprint(api_workflow_blueprint)
|
||||
app.register_blueprint(api_video_clip_blueprint)
|
||||
app.register_blueprint(api_danmaku_clip_blueprint)
|
||||
app.register_blueprint(api_posting_blueprint)
|
||||
app.register_blueprint(api_video_part_blueprint)
|
||||
with app.app_context():
|
||||
# db.drop_all(app=app)
|
||||
db.create_all(app=app)
|
||||
|
19
controller/api/posting_blueprint.py
Normal file
19
controller/api/posting_blueprint.py
Normal file
@ -0,0 +1,19 @@
|
||||
from flask import Blueprint, jsonify
|
||||
from model.Posting import Posting
|
||||
from util.flask import not_found_json_response
|
||||
|
||||
blueprint = Blueprint("api_posting", __name__, url_prefix="/api/posting")
|
||||
|
||||
|
||||
@blueprint.get("/")
|
||||
def get_all_posting():
|
||||
_posting = Posting.query.all()
|
||||
return jsonify([_i.to_json() for _i in _posting])
|
||||
|
||||
|
||||
@blueprint.get("/<int:posting_id>")
|
||||
def get_posting_detail(posting_id):
|
||||
posting = Posting.query.get(posting_id)
|
||||
if posting is None:
|
||||
return not_found_json_response(id=posting_id)
|
||||
return jsonify(posting.to_dict())
|
18
controller/api/video_part_blueprint.py
Normal file
18
controller/api/video_part_blueprint.py
Normal file
@ -0,0 +1,18 @@
|
||||
from flask import Blueprint, jsonify
|
||||
from model.VideoPart import VideoPart
|
||||
from util.flask import not_found_json_response
|
||||
|
||||
blueprint = Blueprint("api_video_part", __name__, url_prefix="/api/video_part")
|
||||
|
||||
@blueprint.get("/")
|
||||
def get_all_posting():
|
||||
_video_parts = VideoPart.query.all()
|
||||
return jsonify([_i.to_json() for _i in _video_parts])
|
||||
|
||||
|
||||
@blueprint.get("/<int:video_part_id>")
|
||||
def get_posting_detail(video_part_id):
|
||||
video_part = VideoPart.query.get(video_part_id)
|
||||
if video_part is None:
|
||||
return not_found_json_response(id=video_part_id)
|
||||
return jsonify(video_part.to_dict())
|
Loading…
x
Reference in New Issue
Block a user