Skip to content

Commit

Permalink
linted and formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
joeygrable94 committed Sep 15, 2023
1 parent 588a959 commit 4a16307
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
12 changes: 8 additions & 4 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class Settings(BaseSettings):

# Database
DB_ECHO_LOG: bool = False if bool(environ.get("APP_DEBUG", True)) else False
DATABASE_URI: Union[str, URL] = environ.get("DATABASE_URI", None)
ASYNC_DATABASE_URI: Union[str, URL] = environ.get("ASYNC_DATABASE_URI", None)
DATABASE_URI: Union[str, URL] = environ.get("DATABASE_URI", "")
ASYNC_DATABASE_URI: Union[str, URL] = environ.get("ASYNC_DATABASE_URI", "")

# Redis
REDIS_CONN_URI: str = environ.get("REDIS_CONN_URI", "redis://localhost:6379")
Expand Down Expand Up @@ -118,16 +118,20 @@ class Settings(BaseSettings):
def assemble_db_connection(
cls: Any, v: Optional[str], values: Dict[str, Any]
) -> Any: # pragma: no cover
if not isinstance(v, str) and not len(v) > 0:
if not isinstance(v, str):
raise ValueError("DATABASE_URI must be a string") # pragma: no cover
if len(v) == 0:
raise ValueError("DATABASE_URI must not be empty")
return v

@validator("ASYNC_DATABASE_URI", pre=True)
def assemble_async_db_connection(
cls: Any, v: Optional[str], values: Dict[str, Any]
) -> Any: # pragma: no cover
if not isinstance(v, str) and not len(v) > 0:
if not isinstance(v, str):
raise ValueError("ASYNC_DATABASE_URI must be a string") # pragma: no cover
if len(v) == 0:
raise ValueError("ASYNC_DATABASE_URI must not be empty")
return v

@validator("BACKEND_CORS_ORIGINS", pre=True)
Expand Down
1 change: 0 additions & 1 deletion app/db/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ async def check_db_disconnected() -> None: # pragma: no cover
if result is not None:
logger.info("+ ASYCN F(X) --> MYSQL CONNECTED!")
logger.info("+ ASYNC F(X) --> MYSQL DISCONNECTED!")
pass
logger.info("+ ASYNC F(X) --> Database Disconnected. (-_-) Zzz")
except Exception as e:
logger.info("+ ASYNC F(X) --> Failed to Disconnect Database! (@_@)")
Expand Down
5 changes: 3 additions & 2 deletions app/models/client_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@


class ClientBucket(Base):
'''
"""
Bucket Name: The name of the AWS S3 bucket where the image is stored. This allows
you to identify the specific bucket for retrieval.
Object Key: The unique key (path) within the S3 bucket that identifies the image.
This should be unique for each image and can include subdirectories if needed.
'''
"""

__tablename__: str = "client_bucket"
id: Mapped[UUID4] = mapped_column(
UUIDType(binary=False),
Expand Down
5 changes: 3 additions & 2 deletions app/models/file_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class FileAsset(Base):
'''
"""
ID (Primary Key): A unique identifier for each image record. You can use an
auto-incrementing integer or a UUID as the primary key.
Expand Down Expand Up @@ -46,7 +46,8 @@ class FileAsset(Base):
Client ID: The ID of the client that the file belongs to. This associates the
file with a specific client if your application has multiple clients.
'''
"""

__tablename__: str = "file_asset"
__table_args__: Any = {"mysql_engine": "InnoDB"}
__mapper_args__: Any = {"always_refresh": True}
Expand Down

0 comments on commit 4a16307

Please sign in to comment.