52 lines
1.1 KiB
Python
52 lines
1.1 KiB
Python
from flask import Blueprint, request
|
|
from webargs.flaskparser import parser
|
|
from marshmallow import Schema, fields
|
|
from ..schemas import model
|
|
from .. import impl
|
|
|
|
bp = Blueprint('times', __name__)
|
|
|
|
|
|
@bp.route('/times', methods=['get'])
|
|
def GetTimes():
|
|
|
|
options = {}
|
|
options["shipcall_id"] = request.args.get("shipcall_id")
|
|
|
|
return impl.times.GetTimes(options)
|
|
|
|
|
|
@bp.route('/times', methods=['post'])
|
|
def PostTimes():
|
|
|
|
schema = model.Times()
|
|
print (request.is_json)
|
|
content = request.get_json(force=True)
|
|
print (content)
|
|
# body = parser.parse(schema, request, location='json')
|
|
|
|
return impl.times.PostTimes(content)
|
|
|
|
|
|
@bp.route('/times', methods=['put'])
|
|
def PutTimes():
|
|
|
|
schema = model.Times()
|
|
print (request.is_json)
|
|
content = request.get_json()
|
|
print (content)
|
|
|
|
|
|
body = parser.parse(schema, request, location='json')
|
|
|
|
return impl.times.PutTimes(body)
|
|
|
|
|
|
@bp.route('/times', methods=['delete'])
|
|
def DeleteTimes():
|
|
|
|
options = {}
|
|
options["id"] = request.args.get("id")
|
|
|
|
return impl.times.DeleteTimes(options)
|