You've already forked my-video-workflow
posting+video_part预
This commit is contained in:
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())
|
Reference in New Issue
Block a user