Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 4.88 KB

API.md

File metadata and controls

64 lines (45 loc) · 4.88 KB

API Directory

This directory explains each API endpoint in the front end React app and the purposes they serve. Each function name is linked to the /Controller file that it executes.

Endpoints

Each category is a link to its Routes or relevant folder.

  • refreshToken checks for user JWT to preserve their session and also protect endpoints from being accessed by non-users in conjunction with the /Auth files
  • updateUser updates user document
  • changePassword changes user password (in-app, during a secure session)
  • resetPassword changes user password (outside of a secure session, user is verified via unique URL)
  • confirmResetPasswordHash confirms a unique link provided to user if they ask to reset their password
  • confirmActivationHash confirms a unique link provided to user if they create a new account
  • deleteUser deletes user account and stored document
  • login logs user into the app
  • checkPrivilege checks if user has viewed the Eligibility requirements and clicked "Agree". (Users cannot make Celebrations without this)
  • givePrivilege updates a user's document to TRUE for the above
  • checkDonor checks is user has submitted all the required information to comply with the FEC in order to increase their maximum donation amount
  • promoteDonor updates a user document to TRUE for the above
  • getUser retrieves a user document from the database
  • getUserData returns any user data that is exposed by the client
  • forgotPassword starts process to allow user to reset their password (if they cannot login)
  • createUser creates a new User account document,
  • logout logs out user
  • getPolsByIds returns a group of Politicians based on the ID(s) provided
  • getPol returns a single Politician's document
  • getBill returns a single Bill's document
  • getPolsByLocation returns local Representative information (allows user to search by address/ZIP code)
  • notifyImgErr sends an internal system email if a Politician's profile picture is broken/missing
  • getConstants retrieves private constant values stored on the server

Other Files

trawl.js and endpoints.js control how the ProPublica Congress API is used.