Initial commit: Add EAMCO Service API
- Add FastAPI service for managing oil delivery services - Implement service scheduling and management endpoints - Add customer service history tracking - Include database models for services, customers, and auto-delivery - Add authentication and authorization middleware - Configure Docker support for local, dev, and prod environments - Add comprehensive .gitignore for Python projects
This commit is contained in:
5
app/models/__init__.py
Normal file
5
app/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# Models module
|
||||
from .service import Service_Service, Service_Parts, Service_Plans
|
||||
from .customer import Customer_Customer
|
||||
from .auto import Auto_Delivery
|
||||
from .auth import Auth_User
|
||||
20
app/models/auth.py
Normal file
20
app/models/auth.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from sqlalchemy import Column, Integer, String, Text, TIMESTAMP
|
||||
from database import Base
|
||||
|
||||
|
||||
class Auth_User(Base):
|
||||
__tablename__ = 'auth_users'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
uuid = Column(String(32))
|
||||
api_key = Column(Text)
|
||||
username = Column(String(40))
|
||||
password_hash = Column(Text)
|
||||
member_since = Column(TIMESTAMP)
|
||||
email = Column(String(350))
|
||||
last_seen = Column(TIMESTAMP)
|
||||
admin = Column(Integer)
|
||||
admin_role = Column(Integer)
|
||||
confirmed = Column(Integer)
|
||||
active = Column(Integer, default=1)
|
||||
28
app/models/auto.py
Normal file
28
app/models/auto.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from sqlalchemy import Column, Integer, String, Numeric, Date
|
||||
from database import Base
|
||||
|
||||
|
||||
class Auto_Delivery(Base):
|
||||
"""Read-only auto delivery model for syncing hot_water_summer."""
|
||||
__tablename__ = 'auto_delivery'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
customer_id = Column(Integer)
|
||||
account_number = Column(String(25))
|
||||
customer_town = Column(String(140))
|
||||
customer_state = Column(Integer)
|
||||
customer_address = Column(String(1000))
|
||||
customer_zip = Column(String(25))
|
||||
customer_full_name = Column(String(250))
|
||||
last_fill = Column(Date)
|
||||
days_since_last_fill = Column(Integer)
|
||||
last_updated = Column(Date)
|
||||
estimated_gallons_left = Column(Numeric(6, 2))
|
||||
estimated_gallons_left_prev_day = Column(Numeric(6, 2))
|
||||
tank_height = Column(String(25))
|
||||
tank_size = Column(String(25))
|
||||
house_factor = Column(Numeric(5, 2))
|
||||
hot_water_summer = Column(Integer)
|
||||
auto_status = Column(Integer)
|
||||
open_ticket_id = Column(Integer)
|
||||
28
app/models/customer.py
Normal file
28
app/models/customer.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from sqlalchemy import Column, Integer, String, TIMESTAMP, Boolean
|
||||
from database import Base
|
||||
|
||||
|
||||
class Customer_Customer(Base):
|
||||
"""Read-only customer model for reference."""
|
||||
__tablename__ = 'customer_customer'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
auth_net_profile_id = Column(String, unique=True, index=True, nullable=True)
|
||||
account_number = Column(String(25))
|
||||
customer_last_name = Column(String(250))
|
||||
customer_first_name = Column(String(250))
|
||||
customer_town = Column(String(140))
|
||||
customer_state = Column(Integer)
|
||||
customer_zip = Column(String(25))
|
||||
customer_first_call = Column(TIMESTAMP)
|
||||
customer_email = Column(String(500))
|
||||
customer_automatic = Column(Integer)
|
||||
customer_phone_number = Column(String(25))
|
||||
customer_home_type = Column(Integer)
|
||||
customer_apt = Column(String(140))
|
||||
customer_address = Column(String(1000))
|
||||
company_id = Column(Integer)
|
||||
customer_latitude = Column(String(250))
|
||||
customer_longitude = Column(String(250))
|
||||
correct_address = Column(Boolean)
|
||||
48
app/models/service.py
Normal file
48
app/models/service.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from sqlalchemy import Column, Integer, String, Numeric, DateTime, Text, Date
|
||||
from database import Base
|
||||
|
||||
|
||||
class Service_Service(Base):
|
||||
__tablename__ = 'service_service'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
customer_id = Column(Integer)
|
||||
customer_name = Column(String(1000))
|
||||
customer_address = Column(String(1000))
|
||||
customer_town = Column(String(140))
|
||||
customer_state = Column(String(140))
|
||||
customer_zip = Column(String(10))
|
||||
# tune-up = 0, no heat = 1, fix = 2, tank = 3, other = 4
|
||||
type_service_call = Column(Integer)
|
||||
when_ordered = Column(DateTime)
|
||||
scheduled_date = Column(DateTime)
|
||||
description = Column(Text)
|
||||
service_cost = Column(Numeric(10, 2), nullable=True)
|
||||
payment_type = Column(Integer, nullable=True)
|
||||
payment_card_id = Column(Integer, nullable=True)
|
||||
payment_status = Column(Integer, nullable=True)
|
||||
|
||||
|
||||
class Service_Parts(Base):
|
||||
__tablename__ = 'service_parts'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
customer_id = Column(Integer)
|
||||
oil_filter = Column(String(100))
|
||||
oil_filter_2 = Column(String(100))
|
||||
oil_nozzle = Column(String(10))
|
||||
oil_nozzle_2 = Column(String(10))
|
||||
hot_water_tank = Column(Integer)
|
||||
|
||||
|
||||
class Service_Plans(Base):
|
||||
__tablename__ = 'service_plans'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
customer_id = Column(Integer)
|
||||
contract_plan = Column(Integer, default=0) # 0=no contract, 1=standard, 2=premium
|
||||
contract_years = Column(Integer, default=1)
|
||||
contract_start_date = Column(Date)
|
||||
Reference in New Issue
Block a user