diff --git a/store/app/crud/base.py b/store/app/crud/base.py index 423fd87a..2c405f9e 100644 --- a/store/app/crud/base.py +++ b/store/app/crud/base.py @@ -359,7 +359,7 @@ async def _get_unique_item_from_secondary_index( item_class: type[T], throw_if_missing: bool = False, ) -> T | None: - if secondary_index_name not in item_class.model_fields: + if secondary_index_name not in item_class.model_json_schema()["properties"]: raise InternalError(f"Field '{secondary_index_name}' not in model {item_class.__name__}") items = await self._get_items_from_secondary_index( secondary_index_name,