Skip to content

Commit

Permalink
use changed models
Browse files Browse the repository at this point in the history
  • Loading branch information
hjanott authored Jan 15, 2025
1 parent 0a9c3d0 commit 3db38eb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion openslides_backend/services/database/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ...shared.filters import Filter
from ...shared.interfaces.write_request import WriteRequest
from ...shared.patterns import Collection, FullQualifiedId
from ...shared.typing import ModelMap
from .commands import GetManyRequest

PartialModel = dict[str, Any]
Expand All @@ -20,17 +21,26 @@ class Database(Protocol):
"""
Database defines the interface to the database.
"""


changed_models: ModelMap

@abstractmethod
def get_database_context(self) -> ContextManager[None]: ...

@abstractmethod
def apply_changed_model(
self, fqid: FullQualifiedId, instance: PartialModel, replace: bool = False
) -> None: ...

@abstractmethod
def get(
self,
fqid: FullQualifiedId,
mapped_fields: list[str],
position: int | None = None,
lock_result: LockResult = True,
use_changed_models: bool = True,
raise_exception: bool = True,
) -> PartialModel: ...

@abstractmethod
Expand All @@ -39,6 +49,7 @@ def get_many(
get_many_requests: list[GetManyRequest],
position: int | None = None,
lock_result: LockResult = True,
use_changed_models: bool = True,
) -> dict[Collection, dict[int, PartialModel]]: ...

@abstractmethod
Expand All @@ -56,6 +67,7 @@ def filter(
filter: Filter,
mapped_fields: list[str],
lock_result: bool = True,
use_changed_models: bool = True,
) -> dict[int, PartialModel]: ...

@abstractmethod
Expand All @@ -64,6 +76,7 @@ def exists(
collection: Collection,
filter: Filter,
lock_result: bool = True,
use_changed_models: bool = True,
) -> bool: ...

@abstractmethod
Expand All @@ -72,6 +85,7 @@ def count(
collection: Collection,
filter: Filter,
lock_result: bool = True,
use_changed_models: bool = True,
) -> int: ...

@abstractmethod
Expand All @@ -81,6 +95,7 @@ def min(
filter: Filter,
field: str,
lock_result: bool = True,
use_changed_models: bool = True,
) -> int | None: ...

@abstractmethod
Expand All @@ -90,6 +105,7 @@ def max(
filter: Filter,
field: str,
lock_result: bool = True,
use_changed_models: bool = True,
) -> int | None: ...

@abstractmethod
Expand Down

0 comments on commit 3db38eb

Please sign in to comment.