FixNameFile
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:
37
apps/ailbl-admin_phone-delete.py
Normal file
37
apps/ailbl-admin_phone-delete.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import crud
|
||||
from flask import jsonify, request
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
```fission
|
||||
{
|
||||
"name": "phonenumbers-admin-delete",
|
||||
"http_triggers": {
|
||||
"phonenumbers-admin-delete-http": {
|
||||
"url": "/ailbl/admin/users/{UserId}/phones/{UserPhoneId}",
|
||||
"methods": ["DELETE"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
"""
|
||||
try:
|
||||
if request.method == "DELETE":
|
||||
return make_delete_request()
|
||||
else:
|
||||
return {"error": "Method not allow"}, 405
|
||||
except Exception as ex:
|
||||
return jsonify({"error": str(ex)}), 500
|
||||
|
||||
|
||||
def make_delete_request():
|
||||
try:
|
||||
user_id = request.headers.get("X-User")
|
||||
if not user_id:
|
||||
return jsonify({"error": "user_id is required"}), 400
|
||||
|
||||
response, status = crud
|
||||
return jsonify(response), status
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
Reference in New Issue
Block a user