rubyforgood / rubyforgood/casa
api/v1/ for Case Contacts (iOS App)
Nobody has claimed this yet.
- 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/
-
Secure Authentication (token based)
/api/v1/users/sign_inFoundation: 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
-
Casa Case Endpoint for Signed-In Users
/api/v1/casa_casesMilestone 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_typesto show which contact types are available to be selected for the case contact - Add data from
case_contact_contact_typesto show contact types have been selected on the case contact - Add data from
contact_topic_answersto 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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