Skip to content
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

Follow+Notes: Expose ability to retrieve current user's follower status for a grant via Finder API #3411

Open
Tracked by #2960
TylerHendrickson opened this issue Aug 17, 2024 · 0 comments
Assignees
Labels
collaboration Grant Finder Issues related to the Grant Finder javascript Pull requests that update Javascript code

Comments

@TylerHendrickson
Copy link
Member

TylerHendrickson commented Aug 17, 2024

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

  • In packages/server/src/lib/grantsCollaboration/followers.js, update the exported interface with the following functions:
    • getFollowerForGrant(knex, grantId, userId)
      • Performs a query that retrieves a single row in the grant_followers table for the identified grant and user combination.
      • The knex argument represents a knex connection object, e.g. as implemented by the existing followGrant() function.
      • Returns null if the identified user does not follow the identified grant, else the following data structure:
        {
          id: grant_followers.id,
          grant: { id: grant_followers.grant_id },
          user: {  id: grant_followers.user_id },
          createdAt: grant_followers.created_at,
        }
  • In packages/server/src/lib/grantsCollaboration, import/export the getFollowerForGrant() function exported from packages/server/src/lib/grantsCollaboration/followers.js
  • In packages/server/src/routes/grants.js, define a new GET /:grantId/follow API route handler as follows:
    • Requires authentication.
    • Calls getFollowerForGrant() from packages/server/src/lib/grantsCollaboration with the grant ID from request path parameters and the authenticated user's ID.
    • If the call to getFollowerForGrant() returns an object (instead of null), provides the function's return value as a JSON-serialized response with status code 200
    • If the call to getFollowerForGrant() returns null, provides a standard 404 response
@TylerHendrickson TylerHendrickson added Grant Finder Issues related to the Grant Finder javascript Pull requests that update Javascript code collaboration labels Aug 17, 2024
@TylerHendrickson TylerHendrickson changed the title Follow+Notes: Expose ability to retrieve current user's follower status for a grant Follow+Notes: Expose ability to retrieve current user's follower status for a grant via Finder API Aug 17, 2024
@greg-adams greg-adams self-assigned this Aug 21, 2024
@greg-adams greg-adams moved this from 🔖 Ready to 🏗 In progress in Grants Team Agile Planning Aug 21, 2024
@greg-adams greg-adams moved this from 🏗 In progress to 👀 In review in Grants Team Agile Planning Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collaboration Grant Finder Issues related to the Grant Finder javascript Pull requests that update Javascript code
Projects
Status: 🚢 Completed
Development

No branches or pull requests

2 participants