Skip to content

Update documentations + Added Delete Account Feature tested manually#127

Merged
trappaly merged 12 commits intomainfrom
development
May 14, 2025
Merged

Update documentations + Added Delete Account Feature tested manually#127
trappaly merged 12 commits intomainfrom
development

Conversation

@khanhdo05
Copy link
Copy Markdown
Collaborator

Update docs

  • Added info about database and firebase
  • Added info about contributing

Delete Account Feature

image

image

  • Added a controller for deleting account that delete all instances of user_id across tables, then finally the user
  • Frontend: handle deleting user account from Firebase auth, handling auth context, added button and dialog for deleting account

How to test

  • Run local host
  • Sign up a new account, put in preferences info, add a bunch of events and deadlines, generate events.
  • Go to /dashboard/profile and click Delete account -> Yes, delete.

Expected behavior

  • Got rerouted to / and not signed-in any more.
  • Check Neon and Firebase tables and see that your account and associated data are all deleted.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just fixing typos

How to set up the database will depend on whether the database services used for our development are still available:
- Before Spring 2025 grades are released, you may ask a team member for credentials.
- This way, graders may use the team's credentials for grading purposes.
- After grades are released, please provide your own PostgreSQL database and Firebase credentials.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added descriptions on setting up database

Ensure you are in the `backend` directory (which you should be if you completed the previous step).

**To add the schema to the development database:**
```bash
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instructions on how to add scheme to database

* @param res
* @constructor
*/
public static async deleteAccount(req: Request, res: Response): Promise<any> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting account by deleting all of the users preferences from the database

@@ -0,0 +1,62 @@
# Contributing

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed instructions on how future users can contribute to our repository

@@ -2,7 +2,7 @@

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated database schema

export default function ProfilePage() {
const { user, loading } = useAuth();
const { user, deleteAccount, loading } = useAuth();
// Using state to hold user preferences
Copy link
Copy Markdown
Collaborator

@trappaly trappaly May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added delete account to the profile page

if (!user?.uid) return;

// Delete user data from backend
const res = await axios.delete(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deletes the user from both the database and firebase


{/* Delete Account Button */}
<Dialog open={openDelete} onOpenChange={setOpenDelete}>
<DialogTrigger asChild>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a delete account button and makes sure it's deleted

}
console.log(
'Deleting user: ' + user.displayName + ' with uid: ' + user.uid
);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deletes the user's account


const deleteAccount = async () => {
if (!user) {
return () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tells which user they're deleting

Copy link
Copy Markdown
Collaborator

@trappaly trappaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall very throughout and detailed code. You also wrote very detailed descriptions and instructions in the README as well. You added a license, you added both the implementation and the frontend buttons for the user to delete an account, and updated the database schema.

As I said on discord, when I ran development it wouldn't delete my account. It would probably be a good idea for other teammates to check this though to see if it's a problem with my computer or with the code itself before I merge the pull request.

@@ -0,0 +1,84 @@
'use client';

import { useState } from 'react';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated reauthentication model so if you are signed in for a long time firebase will reauthenticate

)}
{showReauthModal && (
<div className="mt-4 border rounded p-4 bg-muted">
<ReauthenticateModal
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the reauthenticate model button if you're signed into your account for a long time to reauthenticate

Copy link
Copy Markdown
Collaborator

@trappaly trappaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I tested it and am able to delete my account now. I will merge the pull request.

@trappaly trappaly merged commit 4ab9723 into main May 14, 2025
2 checks passed
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.

3 participants