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

Remove file from /public/temp if user already exists #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sage-Enc
Copy link

@Sage-Enc Sage-Enc commented Aug 6, 2024

When user already existed, the registerUser wasn't removing the file from /public/temp/.
So, to solve this issue:

  1. I swapped Step 3 and 4 in registerUser in src/controllers/user.controller.js.
  2. Added fs.unlinksync() on the condition if user already exists.
  3. Throw the error after removing the files.
    Handled the file when user already exist.

So now when user already exists in the database the server will handle the locally stored file before throwing the error.

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.

1 participant