Skip to content

Conversation

@vrundraval24
Copy link
Contributor

@vrundraval24 vrundraval24 commented Oct 21, 2023

Fixes #200

Description

I added logic to delete the old profile image of the user from storage as the user change or add a new profile image. This way we can maintain the usage of Storage and reduce the redundancy of profile images.

I tried other ways like storing image using user uid or email but it didn't work well so at last,

I created a new attribute in User Docs in the Database to store the UserProfileImageID and used it to delete the Old user image.
I used DateTime millieSecondsSinceEpoch as a Unique ID for the profile image.

image

Type of change

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

How Has This Been Tested?

Everything at the front end and the database works fine. Shared some screenshots and screen-recording to review the changes.

Screen recordings

screen.recording.mp4

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own 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
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

@chandansgowda Please review this.

@vrundraval24 vrundraval24 marked this pull request as ready for review October 21, 2023 17:15
@chandansgowda chandansgowda added the enhancement New feature or request label Oct 22, 2023
}

uniqueIdForProfileImage =
DateTime.now().millisecondsSinceEpoch.toString();
Copy link
Member

Choose a reason for hiding this comment

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

Don't you think in some cases that two people can have the same profileimage id ?

Future<String> getAppwriteToken() async {
Jwt authToken = await account.createJWT();
print(authToken);
// print(authToken);
Copy link
Member

Choose a reason for hiding this comment

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

Let's change this to log or just delete the line.

@vrundraval24
Copy link
Contributor Author

@chandansgowda The Requested changes are made. Please review them.

@chandansgowda
Copy link
Member

Great job @vrundraval24 🙌

@chandansgowda chandansgowda merged commit b3c9ac3 into AOSSIE-Org:master Oct 29, 2023
@vrundraval24 vrundraval24 deleted the profile_image_storage branch December 26, 2023 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Profile Image storing logic to manage redundancy of profile images in Storage

2 participants