mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
bug fixes to get runner working
This commit is contained in:
parent
d229e2faf8
commit
7cd4d4c5b3
2 changed files with 18 additions and 4 deletions
|
|
@ -39,9 +39,21 @@ class UploadedFile(Base):
|
||||||
hubspot_listing_id = Column(BigInteger, nullable=True)
|
hubspot_listing_id = Column(BigInteger, nullable=True)
|
||||||
|
|
||||||
file_type = Column(
|
file_type = Column(
|
||||||
SqlEnum(FileTypeEnum, name="file_type", create_type=False), nullable=True
|
SqlEnum(
|
||||||
|
FileTypeEnum,
|
||||||
|
name="file_type",
|
||||||
|
create_type=False,
|
||||||
|
values_callable=lambda enum_cls: [e.value for e in enum_cls],
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
file_source = Column(
|
file_source = Column(
|
||||||
SqlEnum(FileSourceEnum, name="file_source", create_type=False), nullable=True
|
SqlEnum(
|
||||||
|
FileSourceEnum,
|
||||||
|
name="file_source",
|
||||||
|
create_type=False,
|
||||||
|
values_callable=lambda enum_cls: [e.value for e in enum_cls],
|
||||||
|
),
|
||||||
|
nullable=True,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@ def upload_file_to_sharepoint(
|
||||||
def upload_file_to_s3_and_update_db(
|
def upload_file_to_s3_and_update_db(
|
||||||
bucket: str, file_path: str, hubspot_listing_id: str, file_type: FileTypeEnum
|
bucket: str, file_path: str, hubspot_listing_id: str, file_type: FileTypeEnum
|
||||||
) -> None:
|
) -> None:
|
||||||
key: str = f"documents/hubspot_listing_id/{hubspot_listing_id}"
|
filename: str = os.path.basename(file_path)
|
||||||
|
key: str = f"documents/hubspot_listing_id/{hubspot_listing_id}/{filename}"
|
||||||
|
|
||||||
upload_file_to_s3(file_path, bucket, key)
|
upload_file_to_s3(file_path, bucket, key)
|
||||||
|
|
||||||
uploaded_file = UploadedFile(
|
uploaded_file = UploadedFile(
|
||||||
|
|
@ -40,7 +42,7 @@ def upload_file_to_s3_and_update_db(
|
||||||
s3_upload_timestamp=datetime.now(timezone.utc),
|
s3_upload_timestamp=datetime.now(timezone.utc),
|
||||||
hubspot_listing_id=hubspot_listing_id,
|
hubspot_listing_id=hubspot_listing_id,
|
||||||
file_source=FileSourceEnum.ECMK.value,
|
file_source=FileSourceEnum.ECMK.value,
|
||||||
file_type=file_type,
|
file_type=file_type.value,
|
||||||
)
|
)
|
||||||
|
|
||||||
with db_session() as session:
|
with db_session() as session:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue