diff --git a/model/bot_entity.py b/model/bot_entity.py index 07ffc9f..8745b27 100644 --- a/model/bot_entity.py +++ b/model/bot_entity.py @@ -338,7 +338,7 @@ class BotEntity[CreateSchemaType: BaseModel, UpdateSchemaType: BaseModel]( select_statement = select(cls).offset(skip) if limit: select_statement = select_statement.limit(limit) - if static_filter: + if static_filter is not None: if isinstance(static_filter, list): select_statement = cls._static_filter_condition( select_statement, static_filter @@ -349,11 +349,11 @@ class BotEntity[CreateSchemaType: BaseModel, UpdateSchemaType: BaseModel]( select_statement = cls._filter_condition( select_statement, filter, filter_fields ) - if ext_filter: + if ext_filter is not None: select_statement = select_statement.where(ext_filter) if user: select_statement = cls._ownership_condition(select_statement, user) - if order_by: + if order_by is not None: select_statement = select_statement.order_by(order_by) return (await session.exec(select_statement)).all() diff --git a/model/bot_enum.py b/model/bot_enum.py index 6fa3eba..eea62d5 100644 --- a/model/bot_enum.py +++ b/model/bot_enum.py @@ -126,7 +126,10 @@ class EnumMember(object): if isinstance(other, str): return self.value == other if isinstance(other, EnumMember): - return self.value == other.value and self._parent is other._parent + return self.value == other.value and ( + issubclass(self._parent, other._parent) + or issubclass(other._parent, self._parent) + ) return other.__eq__(self.value) def __hash__(self):