Updated claude big changes
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import logging
|
||||
from flask import request, jsonify
|
||||
from flask import request
|
||||
from flask_login import current_user, logout_user, login_user, login_required
|
||||
from app.admin import admin
|
||||
from app import db
|
||||
from app.common.responses import error_response, success_response
|
||||
from datetime import datetime
|
||||
from app.classes.pricing import (
|
||||
Pricing_Oil_Oil,
|
||||
@@ -48,10 +49,7 @@ def create_oil_price():
|
||||
db.session.add(new_admin_oil_price)
|
||||
db.session.commit()
|
||||
|
||||
return jsonify({
|
||||
"ok": True,
|
||||
'price': new_admin_oil_price.id,
|
||||
}), 200
|
||||
return success_response({'price': new_admin_oil_price.id})
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +65,7 @@ def get_oil_price():
|
||||
.order_by(Pricing_Oil_Oil.date.desc())
|
||||
.first())
|
||||
price_schema = Pricing_Oil_Oil_schema(many=False)
|
||||
return jsonify(price_schema.dump(get_oil_prices))
|
||||
return success_response({"price": price_schema.dump(get_oil_prices)})
|
||||
|
||||
|
||||
@admin.route("/company/<int:company_id>", methods=["GET"])
|
||||
@@ -79,7 +77,7 @@ def get_company(company_id):
|
||||
.first())
|
||||
|
||||
company_schema = Admin_Company_schema(many=False)
|
||||
return jsonify(company_schema.dump(get_data_company))
|
||||
return success_response({"company": company_schema.dump(get_data_company)})
|
||||
|
||||
@admin.route("/voip_routing", methods=["GET"])
|
||||
@admin_required
|
||||
@@ -93,6 +91,6 @@ def get_voip_routing():
|
||||
.order_by(Call.created_at.desc())
|
||||
.first())
|
||||
if latest_call:
|
||||
return jsonify({"current_phone": latest_call.current_phone})
|
||||
return success_response({"current_phone": latest_call.current_phone})
|
||||
else:
|
||||
return jsonify({"current_phone": None}), 404
|
||||
return error_response("No VoIP routing found", 404)
|
||||
|
||||
Reference in New Issue
Block a user