Fix Pydantic error by adding type annotation to DB_DIR and updating to Pydantic v2 configs
This commit is contained in:
parent
e228630abf
commit
a58bd6ed4a
@ -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()
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user