Closed techygrrrl closed 2 years ago
Here's an example SQL query for lookup by ID:
select * from twitchevents_twitchevent
where event_type = 'channel-raid'
and
event_data @> '{"to_broadcaster_user_id": "176082690"}'
order by created desc;
And querying by user name (which appears to be the display name but mine is the same as my login). This returns the same data as the other 2 queries:
select * from twitchevents_twitchevent
where event_type = 'channel-raid'
and
event_data @> '{"to_broadcaster_user_name": "techygrrrl"}'
order by created desc;
Thanks for opening the issue. I suspect this has to do with how Django filters works (how we easily filter thing for Django Rest Framework). I'll take a look this afternoon and figure out a fix soon.
Documentation reference: https://techygrrrl.github.io/tau/api/v1/#get-apiv1twitch-events
Describe the bug
I am unable to query for filtered raid-related data by passing in the documented query params
recipient_user_name
orrecipient_user_id
, assuming these are the fields I can use to get data for incoming raids.Here is an example SQL query that I am trying to retrieve:
I have attempted the following queries:
/api/v1/twitch-events?event_type=channel-raid&recipient_user_name=techygrrrl
– empty results/api/v1/twitch-events?event_type=channel-raid&recipient_user_id=176082690
– empty resultsAnd other queries (the opposite direction):
/api/v1/twitch-events?event_type=channel-raid&raid_broadcaster_id=176082690
– does not appear to be filtering as I see raids both to and from my channel/api/v1/twitch-events?event_type=channel-raid&raid_broadcaster_name=techygrrrl
– does not appear to be filtering as I see raids both to and from my channelI suspect there is a bug where TAU is converting query params to
jsonb
fields for lookups (here). I am not familiar with this magical feature in Django so I am unable to fully know what's going on in this area of the code.To Reproduce
Steps to reproduce the behaviour:
Perform the above-mentioned queries on your own TAU instance replacing the following values with your own:
176082690
to your own user_idtechygrrrl
to your own login name or display name (mine is the same all-lowercase value for both so it doesn't make a difference and the issue wouldn't be in that area)Expected behaviour
I expect to receive information about my incoming raids.
Screenshots
I am referring to the documentation that is generated in the Github Action workflows. Here's a screenshot:
Deployment:
Additional context