major claude changes
This commit is contained in:
@@ -1,34 +1,42 @@
|
||||
import logging
|
||||
from flask import jsonify
|
||||
from app.query import query
|
||||
from app import db
|
||||
from app.classes.admin import Admin_Company
|
||||
from app.classes.query import (Query_StateList,
|
||||
Query_DeliveryStatusList,
|
||||
Query_DeliveryStatusList_Schema,
|
||||
Query_StateList_Schema,
|
||||
Query_CustomerTypeList,
|
||||
Query_DeliveryStatusList,
|
||||
Query_DeliveryStatusList_Schema,
|
||||
Query_StateList_Schema,
|
||||
Query_CustomerTypeList,
|
||||
Query_CustomerTypeList_Schema,
|
||||
Query_EmployeeTypeList,
|
||||
Query_EmployeeTypeList,
|
||||
Query_EmployeeTypeList_Schema)
|
||||
from flask_login import login_required
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@query.route("/company/<int:company_id>", methods=["GET"])
|
||||
@login_required
|
||||
def get_company(company_id):
|
||||
"""
|
||||
This will get the company from env variable
|
||||
"""
|
||||
logger.info(f"GET /query/company/{company_id} - Fetching company data")
|
||||
|
||||
query_data = (db.session
|
||||
.query(Admin_Company)
|
||||
.filter(Admin_Company.id == company_id)
|
||||
query_data = (db.session
|
||||
.query(Admin_Company)
|
||||
.filter(Admin_Company.id == company_id)
|
||||
.first())
|
||||
delivery_schema = Query_DeliveryStatusList_Schema(many=False)
|
||||
return jsonify(delivery_schema.dump(query_data))
|
||||
|
||||
@query.route("/states", methods=["GET"])
|
||||
@login_required
|
||||
def get_state_list():
|
||||
"""
|
||||
This will get states
|
||||
"""
|
||||
logger.info("GET /query/states - Fetching state list")
|
||||
|
||||
query_data = db.session \
|
||||
.query(Query_StateList) \
|
||||
@@ -39,10 +47,12 @@ def get_state_list():
|
||||
|
||||
|
||||
@query.route("/customertype", methods=["GET"])
|
||||
@login_required
|
||||
def get_customer_type_list():
|
||||
"""
|
||||
This will get types of customers
|
||||
"""
|
||||
logger.info("GET /query/customertype - Fetching customer type list")
|
||||
|
||||
query_data = db.session \
|
||||
.query(Query_CustomerTypeList) \
|
||||
@@ -54,10 +64,12 @@ def get_customer_type_list():
|
||||
|
||||
|
||||
@query.route("/employeetype", methods=["GET"])
|
||||
@login_required
|
||||
def get_employee_type_list():
|
||||
"""
|
||||
This will get types of service
|
||||
"""
|
||||
logger.info("GET /query/employeetype - Fetching employee type list")
|
||||
|
||||
query_data = db.session \
|
||||
.query(Query_EmployeeTypeList) \
|
||||
@@ -67,16 +79,15 @@ def get_employee_type_list():
|
||||
|
||||
|
||||
@query.route("/deliverystatus", methods=["GET"])
|
||||
@login_required
|
||||
def get_delivery_status_list():
|
||||
"""
|
||||
This will get delivery status
|
||||
"""
|
||||
logger.info("GET /query/deliverystatus - Fetching delivery status list")
|
||||
|
||||
query_data = db.session \
|
||||
.query(Query_DeliveryStatusList) \
|
||||
.all()
|
||||
delivery_schema = Query_DeliveryStatusList_Schema(many=True)
|
||||
return jsonify(delivery_schema.dump(query_data))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user