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

Feat/editable profile #376

Merged
merged 10 commits into from
Jul 12, 2024

Conversation

anwesha2002
Copy link

Pull Request

Title

Feature update : Editable profile #127

Description

this PR adds the feature of the editable profile. User can edit their profile in profile section

Related Issues

Fixes #127

Changes Made

  • An edit form added for user profile update.
  • profile_update route and controller is added in the backend
  • All the necessary changes made in the frontend and the backend for this feature
  • Zod verification is also taken care of

Checklist

  • [x ] I have tested the changes locally
  • [x ] Documentation has been updated (if necessary)
  • [x ] Changes are backward-compatible

Screenshots (if applicable)

Recording.2024-07-06.022704.mp4

Additional Notes

HMU if any changes needed

Footer

Copy link

vercel bot commented Jul 5, 2024

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

Name Status Preview Comments Updated (UTC)
style-share ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 3:01pm

Copy link

github-actions bot commented Jul 5, 2024

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

Copy link
Owner

@VaibhavArora314 VaibhavArora314 left a comment

Choose a reason for hiding this comment

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

image
resolve these errors

Copy link
Owner

@VaibhavArora314 VaibhavArora314 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 to me, some things to change:

  1. don't use contains in updating as it is affecting all users
  2. check if email already in use by other user
  3. if user changes email, mark user verified status to false

@anwesha2002
Copy link
Author

@VaibhavArora314 I think there is no function named 'updateFirst'. in order to do so first will have to do findFirst and then 'update' that record. otherwise if i use updateMany, all the data contains that userID will be updated means in follow list, or in post or where ever it is in use.
so should I change it??

@VaibhavArora314
Copy link
Owner

VaibhavArora314 commented Jul 6, 2024

don't use contains while updating since that is affecting multiple users. you can use updateMany but don't use contains for id in where

@anwesha2002
Copy link
Author

don't use contains while updating since that is affecting multiple users. you can use updateMany but don't use contains for id in where

okay

toast.success(response.data.message)
dismiss()
}catch (e){
const axiosError = e as AxiosError<{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid as whenever possible as it does a force conversion to the specified type.

Potential solution is:

Suggested change
const axiosError = e as AxiosError<{
const axiosError: AxiosError<{ error: { message: string; }}> = e;

You would need to test if it directly works also if you fell the error is commonly used, you can create a type and pass directly.

For instance:

type ErrorType = { error: { message: string; }};
const axiosError: AxiosError<ErrorType> = e;


setError((e) => {
if (axiosError?.response?.data?.error)
return axiosError?.response?.data?.error as typeof e;
Copy link
Collaborator

Choose a reason for hiding this comment

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

See here also if you can avoid type convertion using as keyword. If it doesn't work you can avoid. Do try and let me know.

Ultimateutkarsh11

This comment was marked as resolved.

anwesha added 3 commits July 11, 2024 15:45
Copy link
Owner

@VaibhavArora314 VaibhavArora314 left a comment

Choose a reason for hiding this comment

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

looking good but after the user updates his details, the updated details should be shown on the profile as currently, it is showing old details and user has to reload to see updated details

@anwesha2002
Copy link
Author

looking good but after the user updates his details, the updated details should be shown on the profile as currently, it is showing old details and user has to reload to see updated details

is it okay now??

@akbatra567 akbatra567 merged commit ff8b982 into VaibhavArora314:main Jul 12, 2024
3 checks passed
Copy link

🎉 Your pull request has been successfully merged! 🎉 Thank you for your valuable contribution to our project. Your efforts are greatly appreciated. Feel free to reach out if you have any more contributions or if there's anything else we can assist you with. Keep up the fantastic work! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gssoc GSSOC level2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Editable profile
4 participants