Files
dbx-orderlist/app/models.py

55 lines
2.6 KiB
Python

from sqlalchemy import Column, Integer, String, Boolean
from .database import Base
class Order(Base):
__tablename__ = "orders"
id = Column(Integer, primary_key=True, index=True)
order_date = Column(String, nullable=True) # 주문날짜
sequence_num = Column(String, nullable=True) # 번호
order_no = Column(String, nullable=True) # 주문번호
order_no_mall = Column(String, nullable=True) # 주문번호(쇼핑몰)
recipient_name = Column(String, index=True, nullable=True) # 수령인명
product_code = Column(String, nullable=True) # 상품코드
product_name = Column(String, nullable=True) # 상품명
order_quantity = Column(String, nullable=True) # 주문수량
address = Column(String, index=True, nullable=True) # 주소
address_normalized = Column(String, index=True, nullable=True)
postal_code = Column(String, nullable=True) # 우편번호
recipient_phone = Column(String, nullable=True) # 수령인 전화번호 (일반전화)
recipient_mobile = Column(String, index=True, nullable=True) # 수령인 휴대폰
recipient_phone_normalized = Column(String, index=True, nullable=True)
recipient_mobile_normalized = Column(String, index=True, nullable=True)
delivery_memo = Column(String, nullable=True) # 배송시 요구사항
tracking_number = Column(String, index=True, nullable=True) # 송장번호
tracking_number_normalized = Column(String, index=True, nullable=True)
vendor = Column(String, nullable=True) # 발주처
order_list_1 = Column(String, nullable=True) # 주문목록
order_list_2 = Column(String, nullable=True) # 주문목록2
note = Column(String, index=True) # 비고 (옵션)
customer_note = Column(String, index=True, nullable=True) # 고객 메모
order_note = Column(String, index=True, nullable=True) # 주문 메모
upload_date = Column(String, nullable=True) # 추가된 날짜 및 시간 (yyyy-MM-dd HH:mm:ss)
class User(Base):
"""
Users table for Google Workspace authentication.
Only approved users can access the system.
"""
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
name = Column(String, nullable=True)
is_admin = Column(Boolean, default=False)
is_approved = Column(Boolean, default=False)
class Setting(Base):
"""
Application settings (e.g., Excel export path)
"""
__tablename__ = "settings"
key = Column(String, primary_key=True, index=True)
value = Column(String, nullable=True)