Follow+Notes: Expose ability to retrieve current user's follower status for a grant via Finder API #3411
Labels
collaboration
Grant Finder
Issues related to the Grant Finder
javascript
Pull requests that update Javascript code
Subtask of [STORY]: Update 'Status' to 'Follow + Note' feature #2960
Blocked by
N/A
Blocks
Definition of Done
A new API route exists that allows users retrieve followers (within the same tenant/organization) of a particular grant.
Implementation Details
packages/server/src/lib/grantsCollaboration/followers.js
, update the exported interface with the following functions:getFollowerForGrant(knex, grantId, userId)
grant_followers
table for the identified grant and user combination.knex
argument represents aknex
connection object, e.g. as implemented by the existingfollowGrant()
function.null
if the identified user does not follow the identified grant, else the following data structure:packages/server/src/lib/grantsCollaboration
, import/export thegetFollowerForGrant()
function exported frompackages/server/src/lib/grantsCollaboration/followers.js
packages/server/src/routes/grants.js
, define a newGET /:grantId/follow
API route handler as follows:getFollowerForGrant()
frompackages/server/src/lib/grantsCollaboration
with the grant ID from request path parameters and the authenticated user's ID.getFollowerForGrant()
returns an object (instead ofnull
), provides the function's return value as a JSON-serialized response with status code 200getFollowerForGrant()
returnsnull
, provides a standard 404 responseThe text was updated successfully, but these errors were encountered: