Пример #1
0
 def public_calls():
     if request.method == 'POST':
         user_id = user_from_token(request.headers['Authorization'])
         if 'relationships' not in req_data['data']:
             req_data['data']['relationships'] = dict()
         req_data['data']['relationships']['veterinarian'] = dict()
         req_data['data']['relationships']['veterinarian']['data'] = {'type': 'users', 'id': user_id}
         return TreatmentPlan.create_resource(req_data)
     elif request.method == 'GET' and tp_id:
         return TreatmentPlan.get_resource(request.args, tp_id)
     elif request.method == 'GET':
         return TreatmentPlan.get_collection(request.args)
Пример #2
0
 def private_calls():
     if request.method == 'PATCH':
         return TreatmentPlan.update_resource(req_data, tp_id)
     elif request.method == 'DELETE':
         return TreatmentPlan.deactivate_resource(tp_id)