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

refactor: profile upsert #652

Merged
merged 1 commit into from
Jan 6, 2025
Merged

refactor: profile upsert #652

merged 1 commit into from
Jan 6, 2025

Conversation

RaoHai
Copy link
Contributor

@RaoHai RaoHai commented Jan 4, 2025

No description provided.

Copy link

vercel bot commented Jan 4, 2025

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

Name Status Preview Comments Updated (UTC)
petercat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 4, 2025 3:16am

Copy link

Walkthrough

This pull request refactors the profile upsert functionality by replacing direct database interaction with a DAO (Data Access Object) pattern. The changes involve using the ProfilesDAO class to handle user profile upserts instead of directly using the supabase client.

Changes

File Summary
server/auth/clients/base.py, server/auth/clients/local.py Replaced direct supabase client usage with ProfilesDAO for upserting user profiles.
server/core/dao/profilesDAO.py Added upsert_user method to handle user profile upserts through the DAO pattern.

supabase = get_client()
supabase.table("profiles").upsert(data).execute()
profiles_dao = ProfilesDAO()
profiles_dao.upsert_user(data)

Choose a reason for hiding this comment

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

Ensure that the ProfilesDAO instance is properly initialized and that the upsert_user method handles all necessary exceptions that might occur during the database operation. This is crucial to prevent any runtime errors that could disrupt the user login process.

Copy link

codecov bot commented Jan 4, 2025

Codecov Report

Attention: Patch coverage is 42.85714% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/auth/clients/local.py 57.14% 3 Missing ⚠️
server/core/dao/profilesDAO.py 25.00% 3 Missing ⚠️
server/auth/clients/base.py 33.33% 2 Missing ⚠️
Files with missing lines Coverage Δ
server/auth/clients/base.py 52.77% <33.33%> (ø)
server/auth/clients/local.py 53.33% <57.14%> (ø)
server/core/dao/profilesDAO.py 37.50% <25.00%> (ø)

Copy link
Contributor

@xingwanying xingwanying left a comment

Choose a reason for hiding this comment

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

LG

@RaoHai RaoHai merged commit af08e82 into main Jan 6, 2025
4 of 5 checks passed
@RaoHai RaoHai deleted the refactor/profiles_upsert branch January 6, 2025 03:43
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