upadate databse

This commit is contained in:
Jun-te Kim 2025-08-14 14:07:02 +00:00
parent 20ae5762af
commit 8f1e6c7aa5

View file

@ -6,6 +6,7 @@ from pydantic import EmailStr
from sqlalchemy import Column
from sqlalchemy.dialects.postgresql import UUID
from etl.fileReader.reportType import ReportType
from enum import Enum
class BaseModel(SQLModel):
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
@ -34,5 +35,33 @@ class Documents(BaseModel, table=True):
target_table: str
target_id: uuid.UUID
class ReportType(str, Enum):
QUIDOS_PRESITE_NOTE = "QUIDOS_PRESITE_NOTE"
CHARTED_SURVEYOR_REPORT = "CHARTED_SURVEYOR_REPORT"
ENERGY_PERFORMANCE_REPORT = "ENERGY_PERFORMANCE_REPORT"
U_VALUE_CALCULATOR_REPORT = "U_VALUE_CALCULATOR_REPORT"
OVERWRITING_U_VALUE_DECLARATION_FORM = "OVERWRITING_U_VALUE_DECLARATION_FORM"
OSMOSIS_CONDITION_PAS_2035_REPORT = "OSMOSIS_CONDITION_PAS_2035_REPORT"
DOMNA_CONDITION_PAS_2035_REPORT = "DOMNA_CONDITION_PAS_2035_REPORT"
class uploaded_files(BaseModel, table=True):
__tablename__ = "uploaded_files" # keeps it simple/snake_case
# URIs
s3_json_uri: Optional[str] = None
s3_file_uri: str = Field(index=True) # index helps lookups; make unique in migrations if needed
# Document type (uses your enum)
doc_type: ReportType
# Timestamps
s3_file_upload_timestamp: datetime = Field(
default_factory=datetime.utcnow, nullable=False
)
s3_json_upload_timestamp: Optional[datetime] = None
# UPRN
uprn: str = Field(index=True)
Documents.update_forward_refs()