Done setup template

This commit is contained in:
2024-06-01 12:34:20 +00:00
parent 71d4afcc5e
commit 449a5f644f
104 changed files with 313 additions and 256 deletions

View File

@ -0,0 +1,28 @@
from abc import ABC, abstractmethod
from pathlib import Path
from pydantic import BaseModel
class AbstractDBProvider(ABC):
@property
@abstractmethod
def db_url(self) -> str: ...
@property
@abstractmethod
def db_url_public(self) -> str: ...
class SQLiteProvider(AbstractDBProvider, BaseModel):
data_dir: Path
prefix: str = ""
@property
def db_path(self):
return self.data_dir / f"{self.prefix}fuware.db"
@property
def db_url(self) -> str:
return f"sqlite:///{str(self.db_path.absolute())}"
@property
def db_url_public(self) -> str:
return self.db_url