Skip to content

Conversation

@brylie
Copy link
Owner

@brylie brylie commented Apr 20, 2025

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.

brylie added 7 commits April 20, 2025 13:23
- 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.
- 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.
@brylie brylie requested a review from Copilot April 20, 2025 12:09
Copy link

Copilot AI left a 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; })();

@brylie brylie merged commit 31103d1 into main Apr 20, 2025
1 check passed
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