-
-
Notifications
You must be signed in to change notification settings - Fork 774
chore: rewrite report endpoint #8883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I've left a few comments, but nothing that is blocking!
@@ -96,28 +96,6 @@ class Meta: | |||
|
|||
fields = ('amount', 'asset', 'usd_value', 'timestamp', 'round') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: Now that we're including all chains, would it make sense to include the chain that the asset is associated with in the output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for pubic consumption!
Do you see value adding it on? I figured we'd provide it if folks need it.
The data provided was what folks initially wanted so I haven't excluded / included anything new
app/grants/router.py
Outdated
"""Generate Grants report for an ethereum address""" | ||
@ratelimit(key='ip', rate='5/s') | ||
def contributions_rec_report(self, request): | ||
"""Genrate Grantee Report for an Grant""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: Would it be worth including details of the expected request format here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can throw it in a readme file (basically the PR description) !
Would you rather we add it here. It might get a lil bloated though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can assume (or can we?) that users who will be accessing our end-points will likely check the code, I think that it would be useful to include these details inline, and later we can look to create documentation from the code itself? If theres a better place we can leave these details though, we can explore that, but I still feel inline would be a safe approach?
app/grants/router.py
Outdated
@action(detail=False) | ||
@ratelimit(key='ip', rate='5/s') | ||
def contributions_sent_report(self, request): | ||
"""Generate report for grant contributions made by an address""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: Same again here (detail what a request should look like)?
Description
This PR retries the report_real which takes a lot of resources and times out on heavy grants
Instead, Gitcoin will now offer 2 endpoints for public consumption
Note:
Get all grant contributions made by an address
Endpoint:
api/v0.1/grants/contributions_sent_report/?address=0x997D35b300bA1775fdB175dF045252e57D6EA5B0&format=json
Parameters:
address
:String
format
:json
page
:number
from_timestamp
:YYYY-MM-DD
to_timestamp
:YYYY-MM-DD
sample response:
Get all grant contributions received by an grant
Endpoint:
api/v0.1/grants/contributions_rec_report/?id=23&format=json
Parameters:
id
:number
(grant id)format
:json
page
:number
from_timestamp
:YYYY-MM-DD
to_timestamp
:YYYY-MM-DD
sample response:
Fixes: #8868