Skip to content

Conversation

@nole2701
Copy link
Collaborator

Added functions in user.rs, query.rs, and queries.graphql to implement avatar uploading directly to S3.

AvatarUploader::new() - Creates an uploader instance with the aws_s3_sdk client using the env config and bucket name.

AvatarUploader::upload_avatar() - Generates a unique S3 key, determines the file type, and uses the S3 put_object function to upload it to S3. Returns the key such as user-uploaded-images/profile-images/user123/file123.png

AvatarUploader::key_to_url() - converts s3 keys to cloudfront URLs.

queries.rs upload_avatar()

  • Takes in an input of image_data and file_name
  • Validates the user is signed in
  • Decodes the base64 image data
  • Validates file size to 5MB for user avatars
  • Creates an AvatarUploader instance and uses it to upload the file to S3.
  • Convert the S3 key to a cloudfront URL and returns it.

@netlify
Copy link

netlify bot commented Aug 28, 2025

Deploy Preview for dailp ready!

Name Link
🔨 Latest commit a0f61fe
🔍 Latest deploy log https://app.netlify.com/projects/dailp/deploys/68b07fc08924800008005ebc
😎 Deploy Preview https://deploy-preview-486--dailp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

2 participants