Fix Pydantic errors in Settings and Todo models
This commit is contained in:
parent
328e65d56a
commit
29a334f71f
@ -1,4 +1,5 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import ClassVar
|
||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
|
|
||||||
|
|
||||||
@ -9,13 +10,14 @@ class Settings(BaseSettings):
|
|||||||
PROJECT_VERSION: str = "0.1.0"
|
PROJECT_VERSION: str = "0.1.0"
|
||||||
|
|
||||||
# Database settings
|
# Database settings
|
||||||
DB_DIR = Path("/app") / "storage" / "db"
|
DB_DIR: ClassVar[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
|
"case_sensitive": True,
|
||||||
env_file = ".env"
|
"env_file": ".env",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
@ -25,5 +25,4 @@ class Todo(TodoBase):
|
|||||||
created_at: datetime
|
created_at: datetime
|
||||||
updated_at: datetime
|
updated_at: datetime
|
||||||
|
|
||||||
class Config:
|
model_config = {"from_attributes": True}
|
||||||
orm_mode = True
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user