mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
25 lines
722 B
Python
25 lines
722 B
Python
from typing import Optional
|
|
|
|
from sqlalchemy import select
|
|
|
|
from backend.app.db.connection import db_read_session
|
|
from infrastructure.postgres.uploaded_file_table import (
|
|
FileSourceEnum,
|
|
FileTypeEnum,
|
|
UploadedFile,
|
|
)
|
|
|
|
|
|
def get_uploaded_file_by_listing_type_and_source(
|
|
hubspot_listing_id: int,
|
|
file_type: FileTypeEnum,
|
|
file_source: FileSourceEnum,
|
|
) -> Optional[UploadedFile]:
|
|
with db_read_session() as session:
|
|
statement = select(UploadedFile).where(
|
|
UploadedFile.hubspot_listing_id == hubspot_listing_id,
|
|
UploadedFile.file_type == file_type,
|
|
UploadedFile.file_source == file_source,
|
|
)
|
|
|
|
return session.exec(statement).one_or_none()
|