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 typing import ClassVar
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
@ -9,13 +10,14 @@ class Settings(BaseSettings):
|
||||
PROJECT_VERSION: str = "0.1.0"
|
||||
|
||||
# Database settings
|
||||
DB_DIR = Path("/app") / "storage" / "db"
|
||||
DB_DIR: ClassVar[Path] = Path("/app") / "storage" / "db"
|
||||
DB_DIR.mkdir(parents=True, exist_ok=True)
|
||||
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
||||
|
||||
class Config:
|
||||
case_sensitive = True
|
||||
env_file = ".env"
|
||||
model_config = {
|
||||
"case_sensitive": True,
|
||||
"env_file": ".env",
|
||||
}
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
@ -25,5 +25,4 @@ class Todo(TodoBase):
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
model_config = {"from_attributes": True}
|
||||
|
Loading…
x
Reference in New Issue
Block a user