working money and delivery dates
This commit is contained in:
@@ -1,20 +1,28 @@
|
||||
from flask import request, jsonify
|
||||
from flask_login import current_user
|
||||
from datetime import date, timedelta
|
||||
from flask import jsonify
|
||||
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
|
||||
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_CustomerTypeList_Schema,
|
||||
Query_EmployeeTypeList,
|
||||
Query_EmployeeTypeList_Schema)
|
||||
|
||||
@query.route("/company/<int:company_id>", methods=["GET"])
|
||||
def get_company(company_id):
|
||||
"""
|
||||
This will get the company from env variable
|
||||
"""
|
||||
|
||||
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"])
|
||||
def get_state_list():
|
||||
@@ -43,17 +51,6 @@ def get_customer_type_list():
|
||||
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"])
|
||||
@@ -80,3 +77,6 @@ def get_delivery_status_list():
|
||||
.all()
|
||||
delivery_schema = Query_DeliveryStatusList_Schema(many=True)
|
||||
return jsonify(delivery_schema.dump(query_data))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user