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

266 create server funcapi endpoint for updating allowed users #346

Conversation

ethanhmaness
Copy link
Contributor

@ethanhmaness ethanhmaness commented Apr 24, 2024

Description

#266

Questions

It seems sketchy to be overwriting the Settings schema directly from the server func, but there's no existing server func for adding emails to the Settings schema.
It also seems sketchy to just pass the request directly into the server func, though that's what the issue said to do. Should we validate that the user ids correspond to actual users first?

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have assigned reviewers to this PR

To test

Log in as an admin and send a PUT request to /api/users that looks something like this

{
    "userEmails": ["ethanhmaness@gmail.com", "emaness@vols.utk.edu"],
    "adminIds": ["6625acc38b667741185a92ae", "662921e0e3a3ebfe912a9200"]
}

Send it a second time to check that it doesn't add duplicate emails.

NOTE: You can't use Postman for this, gotta do it directly thru the browser so your account can be authenticated.

@ethanhmaness ethanhmaness linked an issue Apr 24, 2024 that may be closed by this pull request
Copy link

vercel bot commented Apr 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
compassion-ministries ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 8:29pm

- both fields of UpdateAllowedUsersRequest are optional now
- server func now appends allowed emails rather than replacing
- api route now correctly validates request body
@ethanhmaness ethanhmaness merged commit fd4d804 into main Apr 30, 2024
3 checks passed
@ethanhmaness ethanhmaness deleted the 266-create-server-funcapi-endpoint-for-updating-allowed-users branch April 30, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create server func/api endpoint for updating allowed users
2 participants