Fix Pydantic error by adding type annotation to DB_DIR and updating to Pydantic v2 configs

This commit is contained in:
Automated Action 2025-05-19 09:37:16 +00:00
parent e228630abf
commit a58bd6ed4a
2 changed files with 3 additions and 6 deletions

View File

@ -24,13 +24,11 @@ class Settings(BaseSettings):
raise ValueError(v) raise ValueError(v)
# Database configuration # Database configuration
DB_DIR = Path("/app") / "storage" / "db" DB_DIR: Path = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True) DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
class Config: model_config = {"case_sensitive": True, "env_file": ".env"}
case_sensitive = True
env_file = ".env"
settings = Settings() settings = Settings()

View File

@ -27,8 +27,7 @@ class ItemInDBBase(ItemBase):
created_at: datetime created_at: datetime
updated_at: datetime updated_at: datetime
class Config: model_config = {"from_attributes": True}
from_attributes = True
# Properties to return to client # Properties to return to client