Melhorias gerais no projeto como alterações de imports, nomes, e criação de singleton para configuração extra do ORM via init geral como timezone
--- - Muda nome de `Database` para `DatabaseClient` em `orm.respositories.databases`; - Importa `DatabaseClient` em `types.orm` para facilitar uso pelo usuário; - Define `BaseModelSdk` como base para `NotionDatabase` em `orm.mapping.database` no lugar de `BaseModel` original; - Muda imports de models Database em `notion.types.orm` para `notion.types.orm.databases` e remove 'Database' dos nomes; - Muda nome da func `get_database_id` para `id` em `orm.mapping.database`; - Muda nome da func `get_notion_field_name` para `field_name` em `orm.mapping.database`; - Muda nome da func `get_all_mappings` para `mappings` em `orm.mapping.database`; - Cria `orm.config` para configuração de timezone e afins e inicializa singleton no init do pacote com `ORMConfig.configure(timezone = timezone)`; - Altera link de 'Repository' do `pyproject.toml` para o GitHub; ---
This commit is contained in:
@@ -12,8 +12,8 @@ class DatabasesRepo(Generic[TContainer]):
|
||||
|
||||
@staticmethod
|
||||
def generic(database_id : str):
|
||||
from .databases import Database
|
||||
return Database.generic(database_id)
|
||||
from .databases import DatabaseClient
|
||||
return DatabaseClient.generic(database_id)
|
||||
|
||||
class _Repositories(Generic[TContainer]):
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ from .SearchPageProperty import SearchPageProperty as _SearchPageProperty
|
||||
|
||||
TDB = TypeVar('TDB', bound = _NotionDatabase)
|
||||
|
||||
class Database(Generic[TDB]):
|
||||
|
||||
class DatabaseClient(Generic[TDB]):
|
||||
|
||||
def __init__(self,
|
||||
database_id : str,
|
||||
generic_response : bool = False
|
||||
@@ -45,13 +45,13 @@ class Database(Generic[TDB]):
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def generic(database_id : str) -> 'Database[_NotionDatabase]':
|
||||
def generic(database_id : str) -> 'DatabaseClient[_NotionDatabase]':
|
||||
|
||||
"Acessa database sem schema definido"
|
||||
|
||||
return Database(
|
||||
return DatabaseClient(
|
||||
database_id = database_id,
|
||||
generic_response = True
|
||||
)
|
||||
|
||||
__all__ = ["Database"]
|
||||
__all__ = ["DatabaseClient"]
|
||||
Reference in New Issue
Block a user