Updated claude big changes

This commit is contained in:
2026-01-29 08:43:56 -05:00
parent 2dbd3ea53f
commit eb4740c553
24 changed files with 388 additions and 429 deletions

View File

@@ -1,8 +1,8 @@
import logging
from flask import jsonify
from decimal import Decimal
from app.info import info
from app import db
from app.common.responses import error_response, success_response
from app.classes.pricing import Pricing_Oil_Oil, Pricing_Oil_Oil_schema
from app.classes.admin import Admin_Company
from app.classes.delivery import Delivery_Delivery
@@ -22,7 +22,7 @@ def get_pricing_tiers():
.first())
if not get_price_query:
return jsonify({"error": "No pricing data available"}), 404
return error_response("No pricing data available", 404)
# Get the single price per gallon from the database, e.g., Decimal('2.92')
price_per_gallon = get_price_query.price_for_customer
@@ -37,7 +37,7 @@ def get_pricing_tiers():
}
# Return the dictionary of totals
return jsonify(pricing_totals)
return success_response({"pricing_tiers": pricing_totals})
@info.route("/price/oil", methods=["GET"])
@login_required
@@ -47,14 +47,14 @@ def get_oil_price_today():
.query(Pricing_Oil_Oil)
.order_by(Pricing_Oil_Oil.date.desc())
.first())
return jsonify({"ok": True,
'price_from_supplier': get_price_query.price_from_supplier,
'price_for_customer': get_price_query.price_for_customer,
'price_for_employee': get_price_query.price_for_employee,
'price_same_day': get_price_query.price_same_day,
'price_prime': get_price_query.price_prime,
'price_emergency': get_price_query.price_emergency,
}), 200
return success_response({
'price_from_supplier': get_price_query.price_from_supplier,
'price_for_customer': get_price_query.price_for_customer,
'price_for_employee': get_price_query.price_for_employee,
'price_same_day': get_price_query.price_same_day,
'price_prime': get_price_query.price_prime,
'price_emergency': get_price_query.price_emergency,
})
@info.route("/price/oil/table", methods=["GET"])
@@ -66,7 +66,7 @@ def get_pricing():
.order_by(Pricing_Oil_Oil.date.desc())
.first())
delivery_schema = Pricing_Oil_Oil_schema(many=False)
return jsonify(delivery_schema.dump(get_price_query))
return success_response({"pricing": delivery_schema.dump(get_price_query)})
@@ -80,7 +80,7 @@ def get_company():
.query(Admin_Company)
.first())
return jsonify({"ok": True,
'name': get_data_company.company_name,
'telephone': get_data_company.company_phone_number,
}), 200
return success_response({
'name': get_data_company.company_name,
'telephone': get_data_company.company_phone_number,
})