working on backend

This commit is contained in:
HotSwapp
2025-08-15 22:04:43 -05:00
parent abc7f289d1
commit 0347284556
16 changed files with 3929 additions and 33 deletions

View File

@@ -17,6 +17,7 @@ from .pensions import (
SeparationAgreement, LifeTable, NumberTable, PensionResult
)
from .templates import DocumentTemplate, DocumentTemplateVersion, TemplateKeyword
from .billing import BillingBatch, BillingBatchFile
from .lookups import (
Employee, FileType, FileStatus, TransactionType, TransactionCode,
State, GroupLookup, Footer, PlanInfo, FormIndex, FormList,
@@ -32,5 +33,6 @@ __all__ = [
"SeparationAgreement", "LifeTable", "NumberTable", "PensionResult",
"Employee", "FileType", "FileStatus", "TransactionType", "TransactionCode",
"State", "GroupLookup", "Footer", "PlanInfo", "FormIndex", "FormList",
"PrinterSetup", "SystemSetup", "FormKeyword", "TemplateKeyword"
"PrinterSetup", "SystemSetup", "FormKeyword", "TemplateKeyword",
"BillingBatch", "BillingBatchFile"
]

47
app/models/billing.py Normal file
View File

@@ -0,0 +1,47 @@
from sqlalchemy import Column, Integer, String, DateTime, Float, Text, Index
from app.models.base import BaseModel
class BillingBatch(BaseModel):
__tablename__ = "billing_batches"
id = Column(Integer, primary_key=True, index=True)
batch_id = Column(String(100), unique=True, nullable=False, index=True)
status = Column(String(32), nullable=False)
total_files = Column(Integer, nullable=False, default=0)
successful_files = Column(Integer, nullable=False, default=0)
failed_files = Column(Integer, nullable=False, default=0)
started_at = Column(DateTime(timezone=True), nullable=False)
updated_at = Column(DateTime(timezone=True))
completed_at = Column(DateTime(timezone=True))
processing_time_seconds = Column(Float)
success_rate = Column(Float)
error_message = Column(Text)
__table_args__ = (
Index("ix_billing_batches_started_at", "started_at"),
Index("ix_billing_batches_updated_at", "updated_at"),
Index("ix_billing_batches_completed_at", "completed_at"),
{},
)
class BillingBatchFile(BaseModel):
__tablename__ = "billing_batch_files"
id = Column(Integer, primary_key=True, index=True)
batch_id = Column(String(100), nullable=False, index=True)
file_no = Column(String(50), nullable=False, index=True)
status = Column(String(32), nullable=False)
error_message = Column(Text)
filename = Column(String(255))
size = Column(Integer)
started_at = Column(DateTime(timezone=True))
completed_at = Column(DateTime(timezone=True))
__table_args__ = (
Index("ix_billing_batch_files_batch_file", "batch_id", "file_no"),
{},
)

View File

@@ -22,9 +22,9 @@ class User(BaseModel):
full_name = Column(String(100)) # Keep for backward compatibility
# Authorization
is_active = Column(Boolean, default=True)
is_admin = Column(Boolean, default=False)
is_approver = Column(Boolean, default=False)
is_active = Column(Boolean, default=True, nullable=False)
is_admin = Column(Boolean, default=False, nullable=False)
is_approver = Column(Boolean, default=False, nullable=False)
# User Preferences
theme_preference = Column(String(10), default='light') # 'light', 'dark'