Added call
This commit is contained in:
		| @@ -6,7 +6,7 @@ from datetime import datetime | ||||
| from app.classes.pricing import ( | ||||
|                                  Pricing_Oil_Oil, | ||||
|                                  Pricing_Oil_Oil_schema) | ||||
| from app.classes.admin import Admin_Company, Admin_Company_schema | ||||
| from app.classes.admin import Admin_Company, Admin_Company_schema, Call | ||||
|  | ||||
| @admin.route("/oil/create", methods=["POST"]) | ||||
| def create_oil_price(): | ||||
| @@ -70,3 +70,18 @@ def get_company(company_id): | ||||
|  | ||||
|     company_schema = Admin_Company_schema(many=False) | ||||
|     return jsonify(company_schema.dump(get_data_company)) | ||||
|  | ||||
| @admin.route("/voip_routing", methods=["GET"]) | ||||
| @login_required | ||||
| def get_voip_routing(): | ||||
|     """ | ||||
|     Gets the current VOIP routing (latest Call record's current_phone) | ||||
|     """ | ||||
|     latest_call = (db.session | ||||
|                    .query(Call) | ||||
|                    .order_by(Call.created_at.desc()) | ||||
|                    .first()) | ||||
|     if latest_call: | ||||
|         return jsonify({"current_phone": latest_call.current_phone}) | ||||
|     else: | ||||
|         return jsonify({"current_phone": None}), 404 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user