fix: Auto-create users on profile access and make email nullable in types

- Update getUserProfile, getUserReports, getUserEvents, and getUserActivity to call findOrCreateUser for Clerk IDs
- This ensures users are automatically created in database when accessing their profile for the first time
- Update User type to have email as 'string | null' instead of 'string'
- Fixes 404 errors when new users try to access their profile

This resolves the issue where new users signing up without email would get 404 errors when accessing their profile page.
This commit is contained in:
2025-11-18 18:15:33 +00:00
parent d71c994f0f
commit d1a06699e5
3 changed files with 12 additions and 25 deletions

View File

@@ -18,7 +18,7 @@ export interface Coordinates {
export interface User {
id: string;
clerkId: string;
email: string;
email: string | null;
username: string;
firstName?: string;
lastName?: string;