83 lines
2.1 KiB
Python
Executable File
83 lines
2.1 KiB
Python
Executable File
from flask import request, jsonify
|
|
from flask_login import current_user
|
|
from datetime import date, timedelta
|
|
from app.query import query
|
|
from app import db
|
|
from datetime import datetime
|
|
from app.classes.query import Query_StateList, \
|
|
Query_DeliveryStatusList, \
|
|
Query_DeliveryStatusList_Schema, \
|
|
Query_StateList_Schema, \
|
|
Query_CustomerTypeList, \
|
|
Query_CustomerTypeList_Schema,\
|
|
Query_EmployeeTypeList, \
|
|
Query_EmployeeTypeList_Schema,\
|
|
Query_ServiceTypeList,\
|
|
Query_ServiceTypeList_Schema
|
|
|
|
|
|
@query.route("/states", methods=["GET"])
|
|
def get_state_list():
|
|
"""
|
|
This will get states
|
|
"""
|
|
|
|
query_data = db.session \
|
|
.query(Query_StateList) \
|
|
.all()
|
|
|
|
customer_schema = Query_StateList_Schema(many=True)
|
|
return jsonify(customer_schema.dump(query_data))
|
|
|
|
|
|
@query.route("/customertype", methods=["GET"])
|
|
def get_customer_type_list():
|
|
"""
|
|
This will get types of customers
|
|
"""
|
|
|
|
query_data = db.session \
|
|
.query(Query_CustomerTypeList) \
|
|
.all()
|
|
customer_schema = Query_CustomerTypeList_Schema(many=True)
|
|
return jsonify(customer_schema.dump(query_data))
|
|
|
|
|
|
@query.route("/servicetype", methods=["GET"])
|
|
def get_service_type_list():
|
|
"""
|
|
This will get types of service
|
|
"""
|
|
|
|
query_data = db.session \
|
|
.query(Query_ServiceTypeList) \
|
|
.all()
|
|
customer_schema = Query_ServiceTypeList_Schema(many=True)
|
|
return jsonify(customer_schema.dump(query_data))
|
|
|
|
|
|
@query.route("/employeetype", methods=["GET"])
|
|
def get_employee_type_list():
|
|
"""
|
|
This will get types of service
|
|
"""
|
|
|
|
query_data = db.session \
|
|
.query(Query_EmployeeTypeList) \
|
|
.all()
|
|
customer_schema = Query_EmployeeTypeList_Schema(many=True)
|
|
return jsonify(customer_schema.dump(query_data))
|
|
|
|
|
|
@query.route("/deliverystatus", methods=["GET"])
|
|
def get_delivery_status_list():
|
|
"""
|
|
This will get delivery status
|
|
"""
|
|
|
|
query_data = db.session \
|
|
.query(Query_DeliveryStatusList) \
|
|
.all()
|
|
delivery_schema = Query_DeliveryStatusList_Schema(many=True)
|
|
return jsonify(delivery_schema.dump(query_data))
|