From 16574e2145fb1f40b75b56374a44b47d503f70c8 Mon Sep 17 00:00:00 2001 From: Longze Chen Date: Thu, 9 Jan 2025 15:36:42 -0500 Subject: [PATCH] Revert incorrect api filter fix for prerpint --- api/base/filters.py | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/api/base/filters.py b/api/base/filters.py index 30b9ea87a3d..d14ae348c92 100644 --- a/api/base/filters.py +++ b/api/base/filters.py @@ -291,39 +291,7 @@ def parse_query_params(self, query_params): query.get(key).update({ field_name: self._parse_date_param(field, source_field_name, op, value), }) - elif not isinstance(value, int) and source_field_name in ['_id', 'guid._id']: - # TODO: this is broken since value can be a multi-value str separated by comma; in addition, - # as for a single-versioned-guid value, the filter is `or` but we need `and`; this will - # be fixed in [ENG-6878](https://openscience.atlassian.net/browse/ENG-6878). - base_guid, version = Guid.split_guid(value) - if base_guid is None and version is None: - raise InvalidFilterValue( - value=value, - field_type='guid', - ) - guid_filters = { - field_name: { - 'op': 'in', - 'value': self.bulk_get_values(value, field), - 'source_field_name': source_field_name, - }, - } - if version is not None: - guid_filters = { - field_name: { - 'op': 'eq', - 'value': base_guid, - 'source_field_name': 'versioned_guids___id', - }, - 'versioned_guids__version': { - 'op': 'eq', - 'value': version, - 'source_field_name': 'versioned_guids__version', - }, - } - - query.get(key).update(guid_filters) - elif not isinstance(value, int) and source_field_name in ['journal_id', 'moderation_state']: + elif not isinstance(value, int) and source_field_name in ['_id', 'guid._id', 'journal_id', 'moderation_state']: query.get(key).update({ field_name: { 'op': 'in',