User Settings Enhancements and user update/delete endpoints #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces several improvements to both the front-end and back-end of our application. The changes include new backend endpoints for updating and deleting user accounts, updates to the frontend API and components for user settings, navbar updates, and poll anonymization for deleted users.
Changes Summary
Backend:
Frontend:
UserSettings
component for updating user details and deleting accounts.Detailed Changes
Backend:
Controllers (
userController.ts
):updateUser
function for updating user details.deleteUser
function for deleting user accounts and anonymizing their polls.Routes (
userRoutes.ts
):PUT /user/:id
) and deleting (DELETE /user/:id
) user accounts.Middleware (
authenticate.ts
):Models (
poll.ts
):Poll
model to makeuserId
nullable for anonymization.Migrations (
20240422193909-create-polls.ts
):userId
.API Documentation (
API.md
):Frontend:
Components (
UserSettings.tsx
):UserSettings
component that allows users to update their name, password, and avatar URL, and delete their account.API (
api.ts
):Navbar (
Navbar.tsx
):Testing
How to Test
Backend:
npm run dev
.PUT http://localhost:5000/user/:id
DELETE http://localhost:5000/user/:id
Frontend:
npm start
.