rubyforgood / rubyforgood/casa

api/v1/ for Case Contacts (iOS App)

Open
#3,942 40 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🗺️ Epic codethechange no-issue-activity
Dominant language
Ruby
Stars
381
Forks
542
Avg merge
3d 15h
Merged PRs (30d)
47

Description

What type(s) of user does this feature affect?

  • volunteers

Description
A volunteer needs to be able to use the app to save a case contact.

Approach

Authentication

HTTP Route Description Issue(s) Completed
POST /api/v1/users/sign_in Login #4976, #6216
POST /api/v1/users/sign_in/validate Validation
POST /api/v1/users/refresh_token Refresh Access Token
DELETE /api/v1/users/sign_out Log-Out #6241

Case Contact

HTTP Route Description Issue{s) Completed
GET /api/v1/case_contacts List Case Contacts (casa_cases)
GET /api/v1/case_contacts/:id Get Specific Case Contact
POST /api/v1/case_contacts Create new Case Contact
PATCH /api/v1/case_contacts/:id Update Specific Case Contact

For Additional Expenses (they are nested under Case Contacts)

HTTP Route Issue(s) Completed
POST /api/v1/case_contacts/:case_contact_id/additional_expenses
PATCH /api/v1/case_contacts/:case_contact_id/additional_expenses/:id
DELETE /api/v1/case_contacts/:case_contact_id/additional_expenses/:id
Requirements for /api/v1/
  1. Secure Authentication (token based) /api/v1/users/sign_in

    Foundation: iOS app can authenticate on sign_in endpoint #4976, and below

    • #6207 Secure session token in JSON response through token randomization
    • #6207 Session tokens default to expire 7 hours after creation
    • #6210 Volunteers Sign-In endpoint has a "stay logged in" or "remember_me" option where refresh tokens expire after 1 year
    • #6211 Secure endpoint from denial-of-service (DDoS) attacks by blocking suspicious requests

    Token Refreshing: iOS app generates new access tokens when refresh token is still valid /api/v1/users/refresh_token

    • #6233 Volunteers Refresh Token endpoint generates new access token if refresh_token is still valid

    Token Validating: iOS app can validate users session on endpoint /api/v1/users/validate

    • #6256 Volunteers user validate endpoint ensures session is valid

    Token Revoking: iOS app can Sign-Out users on sign_out endpoint /api/v1/users/sign_out

    • #6222 Volunteers Sign-Out endpoint invalidates current session/access token and refresh token when requested
  2. Casa Case Endpoint for Signed-In Users /api/v1/casa_cases

    Milestone 1

    • Add authenticate user before_action to controller and validate user is signed-in
    • Signed-In user case contact data is accessible through POST request (only shallow fields meaning fields that don't reference a different table)
    • Make sure user can only see case contacts they have permission to see

    Milestone 2a

    • Can display errors

    Milestone 2b

    • Can accept new case contact and save it
    • Can create case contact drafts

    Milestone 2c (expand case contact data)

    • Add case contact creator to json
    • Add data from casa_case_contact_types to show which contact types are available to be selected for the case contact
    • Add data from case_contact_contact_types to show contact types have been selected on the case contact
    • Add data from contact_topic_answers to show sections of notes for the case contact
    • Add contact topics to show available contact topics to choose from

    Milestone 3a

    • Can update case contact and save it
    • Can update case contact drafts and save it

    Milestone 3b

    • Can delete drafts

We have jBuilder installed. It can help you if your json response is complicated. You can also use it to convert a rails object into json easily like this

Questions? Join Slack!

We highly recommend that you join us in slack https://rubyforgood.herokuapp.com/ #casa channel to ask questions quickly and hear about office hours (currently Tuesday 6-8pm Pacific), stakeholder news, and upcoming new issues.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the listed /api/v1/users and /api/v1/case_contacts routes, then review the existing sign-in endpoint and the jBuilder guidance linked in the issue. Break the work down by authentication, permissions, case-contact CRUD, drafts, and nested additional expenses. Done means the required milestones and token behaviors are implemented and the documented API responses support the iOS app.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, authentication, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.