Further gql improvements & added test data #181
This commit is contained in:
@@ -46,6 +46,10 @@ class DataAccessObjectABC(ABC, Generic[T_DBM]):
|
||||
def table_name(self) -> str:
|
||||
return self._table_name
|
||||
|
||||
@property
|
||||
def type(self) -> Type[T_DBM]:
|
||||
return self._model_type
|
||||
|
||||
def has_attribute(self, attr_name: Attribute) -> bool:
|
||||
"""
|
||||
Check if the attribute exists in the DAO
|
||||
@@ -490,16 +494,16 @@ class DataAccessObjectABC(ABC, Generic[T_DBM]):
|
||||
table, join_condition = self.__foreign_tables[attr]
|
||||
builder.with_left_join(table, join_condition)
|
||||
|
||||
if filters:
|
||||
if filters is not None:
|
||||
await self._build_conditions(builder, filters, external_table_deps)
|
||||
|
||||
if sorts:
|
||||
if sorts is not None:
|
||||
self._build_sorts(builder, sorts, external_table_deps)
|
||||
|
||||
if take:
|
||||
if take is not None:
|
||||
builder.with_limit(take)
|
||||
|
||||
if skip:
|
||||
if skip is not None:
|
||||
builder.with_offset(skip)
|
||||
|
||||
for external_table in external_table_deps:
|
||||
|
||||
@@ -12,9 +12,9 @@ class DbJoinModelABC[T](DbModelABC[T]):
|
||||
source_id: Id,
|
||||
foreign_id: Id,
|
||||
deleted: bool = False,
|
||||
editor_id: Optional[SerialId] = None,
|
||||
created: Optional[datetime] = None,
|
||||
updated: Optional[datetime] = None,
|
||||
editor_id: SerialId | None = None,
|
||||
created: datetime | None= None,
|
||||
updated: datetime | None= None,
|
||||
):
|
||||
DbModelABC.__init__(self, id, deleted, editor_id, created, updated)
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ class DbModelABC(ABC, Generic[T]):
|
||||
self,
|
||||
id: Id,
|
||||
deleted: bool = False,
|
||||
editor_id: Optional[SerialId] = None,
|
||||
created: Optional[datetime] = None,
|
||||
updated: Optional[datetime] = None,
|
||||
editor_id: SerialId | None = None,
|
||||
created: datetime | None= None,
|
||||
updated: datetime | None= None,
|
||||
):
|
||||
self._id = id
|
||||
self._deleted = deleted
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from cpl.core.configuration import Configuration
|
||||
from cpl.core.configuration.configuration import Configuration
|
||||
from cpl.core.configuration.configuration_model_abc import ConfigurationModelABC
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from typing import Optional, Self
|
||||
|
||||
from cpl.database.abc import DbModelABC
|
||||
|
||||
|
||||
class ExecutedMigration(DbModelABC):
|
||||
class ExecutedMigration(DbModelABC[Self]):
|
||||
def __init__(
|
||||
self,
|
||||
migration_id: str,
|
||||
created: Optional[datetime] = None,
|
||||
modified: Optional[datetime] = None,
|
||||
created: datetime | None= None,
|
||||
modified: datetime | None= None,
|
||||
):
|
||||
DbModelABC.__init__(self, migration_id, False, created, modified)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user