This PR adds endpoints to access grant data relating to an organisation in the datastore.
The new endpoints:
/org/<org_id>/grants_made - paginated list of grants given out by this org
/org/<org_id>/grants_received - paginated list of grants got by this org
/grant/<grant_id> - detail about an individual grant, exactly the same as the contents of the other two endpoints, but to enable referring to grants individually (just so i could create the self link)
Following RESTy ideas, we've got two resources/data types: Organisation and Grant. I've given every object a self URL which, unsurprisingly, is the URL where detail about the object can be found. Grants always have grant_id and Organisations always have org_id. For references to other objects, I've made them be a subobject that containts self too, vaguely following the ideas from Terrifically Simple JSON. I've never used Terrifically Simple JSON before, but looks like an easy entrypoint to "linked" data vs going full JSON-LD etc.
Questions:
I threw in the recipients and funders on GrantSerializer to make easy click-through URLs, but it's essentially just a copy of the Org ID out of the data field - is this worth doing/keeping?
Would be happy to change the Latest.grants() shortcut to something like Grant.latest_best()
Should the OrganisationRef have name as well as org_id, like the list view does?
There's no tests, until we know we're not going to immediately throw this design away.
This PR adds endpoints to access grant data relating to an organisation in the datastore. The new endpoints:
/org/<org_id>/grants_made
- paginated list of grants given out by this org/org/<org_id>/grants_received
- paginated list of grants got by this org/grant/<grant_id>
- detail about an individual grant, exactly the same as the contents of the other two endpoints, but to enable referring to grants individually (just so i could create theself
link)Following RESTy ideas, we've got two resources/data types: Organisation and Grant. I've given every object a
self
URL which, unsurprisingly, is the URL where detail about the object can be found. Grants always havegrant_id
and Organisations always haveorg_id
. For references to other objects, I've made them be a subobject that containtsself
too, vaguely following the ideas from Terrifically Simple JSON. I've never used Terrifically Simple JSON before, but looks like an easy entrypoint to "linked" data vs going full JSON-LD etc.Questions:
recipients
andfunders
on GrantSerializer to make easy click-through URLs, but it's essentially just a copy of the Org ID out of thedata
field - is this worth doing/keeping?Latest.grants()
shortcut to something likeGrant.latest_best()
name
as well asorg_id
, like the list view does?There's no tests, until we know we're not going to immediately throw this design away.
Examples:
Organisation - Detail
Organisation - Grants Received