maybe good
This commit is contained in:
63
app/models/rolodex.py
Normal file
63
app/models/rolodex.py
Normal file
@@ -0,0 +1,63 @@
|
||||
"""
|
||||
Rolodex (Customer/Client) models based on legacy ROLODEX.SC analysis
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, Date, Text, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.models.base import BaseModel
|
||||
|
||||
|
||||
class Rolodex(BaseModel):
|
||||
"""
|
||||
Customer/Client information table
|
||||
Corresponds to ROLODEX table in legacy system
|
||||
"""
|
||||
__tablename__ = "rolodex"
|
||||
|
||||
id = Column(String(80), primary_key=True, index=True) # Unique key from legacy
|
||||
last = Column(String(80), nullable=False, index=True) # Last name or company
|
||||
first = Column(String(45)) # First name
|
||||
middle = Column(String(45)) # Middle name or initial
|
||||
prefix = Column(String(45)) # Title like Mr., Ms., Dr.
|
||||
suffix = Column(String(45)) # Jr., Sr., M.D., etc.
|
||||
title = Column(String(45)) # Official title/position
|
||||
group = Column(String(45)) # Client, opposing counsel, personal, etc.
|
||||
|
||||
# Address fields
|
||||
a1 = Column(String(45)) # Address line 1 or firm name
|
||||
a2 = Column(String(45)) # Address line 2
|
||||
a3 = Column(String(45)) # Address line 3
|
||||
city = Column(String(80)) # City
|
||||
abrev = Column(String(45)) # State abbreviation
|
||||
zip = Column(String(45)) # Zip code
|
||||
|
||||
# Contact info
|
||||
email = Column(String(100)) # Email address
|
||||
|
||||
# Personal info
|
||||
dob = Column(Date) # Date of birth
|
||||
ss_number = Column(String(20)) # Social Security Number
|
||||
legal_status = Column(String(45)) # Petitioner/Respondent, etc.
|
||||
|
||||
# Notes
|
||||
memo = Column(Text) # Notes for this rolodex entry
|
||||
|
||||
# Relationships
|
||||
phone_numbers = relationship("Phone", back_populates="rolodex_entry", cascade="all, delete-orphan")
|
||||
files = relationship("File", back_populates="owner")
|
||||
payments = relationship("Payment", back_populates="client")
|
||||
|
||||
|
||||
class Phone(BaseModel):
|
||||
"""
|
||||
Phone numbers linked to rolodex entries
|
||||
Corresponds to PHONE table in legacy system
|
||||
"""
|
||||
__tablename__ = "phone"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
rolodex_id = Column(String(80), ForeignKey("rolodex.id"), nullable=False)
|
||||
location = Column(String(45)) # Office, Home, Mobile, etc.
|
||||
phone = Column(String(45), nullable=False) # Phone number
|
||||
|
||||
# Relationships
|
||||
rolodex_entry = relationship("Rolodex", back_populates="phone_numbers")
|
||||
Reference in New Issue
Block a user