CRUD_UserProfile
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 21s
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 21s
This commit is contained in:
68
apps/ailbl-admin_profile-insert-get-update-delete.py
Normal file
68
apps/ailbl-admin_profile-insert-get-update-delete.py
Normal file
@@ -0,0 +1,68 @@
|
||||
import crud
|
||||
from flask import jsonify, request
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
```fission
|
||||
{
|
||||
"name": "profile-admin-get-insert-delete-put",
|
||||
"http_triggers": {
|
||||
"profile-admin-get-insert-delete-put-http": {
|
||||
"url": "/ailbl/admin/users/{user_id}/profiles",
|
||||
"methods": ["POST", "PUT", "DELETE", "GET"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
"""
|
||||
try:
|
||||
if request.method == "PUT":
|
||||
return make_update_request()
|
||||
elif request.method == "DELETE":
|
||||
return make_delete_request()
|
||||
elif request.method == "POST":
|
||||
return make_insert_request()
|
||||
elif request.method == "GET":
|
||||
return make_get_request()
|
||||
else:
|
||||
return {"error": "Method not allow"}, 405
|
||||
except Exception as ex:
|
||||
return jsonify({"error": str(ex)}), 500
|
||||
|
||||
|
||||
def make_insert_request():
|
||||
try:
|
||||
|
||||
response, status = crud
|
||||
return jsonify(response), status
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
|
||||
def make_update_request():
|
||||
try:
|
||||
|
||||
response, status = crud# Call CRUD function to update avatar
|
||||
return jsonify(response), status
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
|
||||
def make_delete_request():
|
||||
try:
|
||||
|
||||
response, status = crud
|
||||
return jsonify(response), status
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
|
||||
def make_get_request():
|
||||
try:
|
||||
|
||||
return crud
|
||||
# return jsonify(response), status
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
Reference in New Issue
Block a user