-
Notifications
You must be signed in to change notification settings - Fork 0
Implement user authentication and Supabase integration #33
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add AuthDropdown component for user login, registration, and logout functionality. - Integrate AuthDropdown into NavigationMenu for seamless user experience. - Enhance database operations to support Supabase for completed exercises. - Create models for shared data between Dexie and Supabase. - Implement repository functions for saving, fetching, and deleting completed exercises in Supabase. - Add authentication functions for user registration, login, logout, and password reset. - Initialize Supabase client and user store for managing authentication state.
…ing in saveCompletedExerciseToSupabase
- Created unit tests for database models and conversion functions in models.test.ts. - Implemented tests for Supabase repository functions including saving, fetching, deleting, and syncing completed exercises in supabase-repository.test.ts. - Added a mock implementation of the Supabase client for testing purposes in supabase-mock.ts. - Developed tests for Supabase authentication functions such as registration, login, password reset, and user state management in auth.test.ts. - Established tests for Supabase client initialization and user state management in client.test.ts.
… for better readability and maintainability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements user authentication and Supabase integration while refactoring database operations and enhancing test coverage. Key changes include:
- Introducing a Supabase client with an authenticated user store and helper functions.
- Implementing authentication functions (registration, login, OAuth, password reset, logout) and corresponding tests.
- Integrating Supabase storage in the database repository with conversion utilities between internal and Supabase formats.
Reviewed Changes
Copilot reviewed 11 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/lib/supabase/client.ts | Creates the Supabase client and user store, and provides helper functions including isAuthenticated. |
| app/src/lib/supabase/auth.ts | Implements authentication functions using the Supabase client. |
| app/src/lib/supabase/client.test.ts, app/src/lib/supabase/auth.test.ts | Add tests for the authentication module. |
| app/src/lib/database/supabase-repository.ts | Provides repository functions for saving, fetching, deleting, and syncing exercises via Supabase. |
| app/src/lib/database/models.ts, models.test.ts | Defines conversion functions between internal and Supabase database models. |
| app/src/lib/database.ts | Integrates Supabase storage conditionally with existing Dexie database operations. |
| app/src/lib/supabase/mocks/supabase-mock.ts | Provides mocks for Supabase client functions for testing purposes. |
Files not reviewed (6)
- app/.env.example: Language not supported
- app/package.json: Language not supported
- app/pnpm-lock.yaml: Language not supported
- app/src/lib/components/AuthDropdown.svelte: Language not supported
- app/src/lib/components/NavigationMenu.svelte: Language not supported
- app/src/routes/history/+page.svelte: Language not supported
Comments suppressed due to low confidence (1)
app/src/lib/supabase/client.ts:39
- Consider replacing the subscription call with Svelte's get() function (imported from 'svelte/store') to synchronously retrieve the current value of the user store. This change improves code clarity and avoids the somewhat unconventional immediate invocation of the unsubscribe function.
user.subscribe((u) => { isAuth = !!u; })();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce an authentication dropdown for user management, enhance database operations with Supabase, and implement comprehensive tests for authentication and data handling. Refactor code for improved readability and type safety.