diff --git a/api/registry/api/v1.py b/api/registry/api/v1.py index 221b5f26e..98ccf33c7 100644 --- a/api/registry/api/v1.py +++ b/api/registry/api/v1.py @@ -723,7 +723,8 @@ def stamp_display(request) -> List[StampDisplayResponse]: @router.get( "/gtc-stake/{str:address}/{int:round_id}", - auth=ApiKey(), + # auth=ApiKey(), + auth=None, response=GtcEventsResponse, summary="Retrieve GTC stake amounts for the GTC Staking stamp", description="Get self and community staking amounts based on address and round ID", diff --git a/api/registry/filters.py b/api/registry/filters.py index 80626b818..e8058310c 100644 --- a/api/registry/filters.py +++ b/api/registry/filters.py @@ -13,29 +13,11 @@ class Meta: def filter_address(self, queryset, name, value): round_id_value = int(self.form.cleaned_data.get("round_id", "")) - beginner_experienced_community_staker = Q( - round_id=round_id_value, - event_type="Xstake", - staker=value, - amount__gte=5, - ) | Q(address=value) - - trusted_citizen_staker = Q( - round_id=round_id_value, - event_type="Xstake", - address=value, - amount__gte=20, - ) - - self_stake = Q( - round_id=round_id_value, - event_type="SelfStake", - staker=value, - amount__gte=5, - ) - results = queryset.filter( - beginner_experienced_community_staker | trusted_citizen_staker | self_stake + Q( + round_id=round_id_value, + ) + & (Q(staker=value) | Q(address=value)) ) return results diff --git a/api/registry/migrations/0028_gtcstakeevent_gtc_staking_index_by_staker.py b/api/registry/migrations/0028_gtcstakeevent_gtc_staking_index_by_staker.py new file mode 100644 index 000000000..5a2acb2e1 --- /dev/null +++ b/api/registry/migrations/0028_gtcstakeevent_gtc_staking_index_by_staker.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.6 on 2023-11-13 21:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registry", "0027_alter_gtcstakeevent_amount"), + ] + + operations = [ + migrations.AddIndex( + model_name="gtcstakeevent", + index=models.Index( + fields=["round_id", "staker"], name="gtc_staking_index_by_staker" + ), + ), + ] diff --git a/api/registry/models.py b/api/registry/models.py index 0bb517e6c..5895a4bce 100644 --- a/api/registry/models.py +++ b/api/registry/models.py @@ -184,4 +184,8 @@ class Meta: fields=["round_id", "address", "staker"], name="gtc_staking_index", ), + models.Index( + fields=["round_id", "staker"], + name="gtc_staking_index_by_staker", + ), ]