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

Implement Backend for User Avatar Management #148

Open
13 tasks
mahid797 opened this issue Dec 31, 2024 · 0 comments
Open
13 tasks

Implement Backend for User Avatar Management #148

mahid797 opened this issue Dec 31, 2024 · 0 comments
Assignees
Labels
Backend Backend Related Issue 📥Icebox Not a current priority but kept for future reference New Feature New feature to be implemented
Milestone

Comments

@mahid797
Copy link
Collaborator

Description

Develop the backend functionality to support user avatar management. This includes creating a new Supabase bucket for storing avatars, updating the database schema to associate avatars with users, and implementing API endpoints for fetching and uploading avatars. These updates will allow seamless integration with the frontend for displaying and updating user avatars.


Tasks

  • Supabase Bucket Setup:

    • Create a dedicated Supabase bucket for storing user avatars.
    • Configure appropriate access policies for the bucket to ensure secure and controlled access.
  • Database Schema Update:

    • Add an avatar_url field to the User table in schema.prisma:
      • avatar_url: Optional field to store the public URL of the user's avatar.
    • Run the necessary database migration to apply schema changes.
  • API Endpoints:

    • Create a GET endpoint for fetching a user's avatar:
      • Fetch the avatar_url field from the database.
      • Return the avatar URL or a default placeholder URL if no avatar exists.
    • Create a POST endpoint for uploading/updating a user's avatar:
      • Accept an image file from the frontend.
      • Validate the file type and size.
      • Upload the image to the Supabase bucket and retrieve the public URL.
      • Update the avatar_url field in the database.
      • Delete the previous avatar from the bucket, if applicable.
    • Ensure authentication and authorization for both endpoints to allow access only to the authenticated user.
  • Error Handling and Logging:

    • Implement error handling for file validation failures, Supabase upload errors, and database update issues.
    • Add logs for critical operations (e.g., upload success, failed validations).

Notes

  • The avatar_url field should be optional to account for users who do not upload an avatar.
  • Use default avatar URLs for users without a custom avatar.
  • Ensure the backend integrates seamlessly with the existing Profile API for user data updates.
@mahid797 mahid797 added New Feature New feature to be implemented Backend Backend Related Issue labels Dec 31, 2024
@mahid797 mahid797 added this to the 1.0 milestone Dec 31, 2024
@mahid797 mahid797 added the Wontfix This will not be worked on label Jan 15, 2025
@mahid797 mahid797 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
@mahid797 mahid797 reopened this Jan 16, 2025
@mahid797 mahid797 reopened this Jan 20, 2025
@mahid797 mahid797 modified the milestones: v0.1.0-alpha, v0.1.0-beta, v0.1 Feb 18, 2025
@mahid797 mahid797 added the 📥Icebox Not a current priority but kept for future reference label Feb 22, 2025
@mahid797 mahid797 self-assigned this Feb 23, 2025
@mahid797 mahid797 removed the Wontfix This will not be worked on label Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Backend Related Issue 📥Icebox Not a current priority but kept for future reference New Feature New feature to be implemented
Projects
None yet
Development

No branches or pull requests

1 participant