- Added city, state, and country optional fields to Complex model - Updated onboarding to include optional location fields - Created new settings page with sidebar navigation (Datos del Complejo, Canchas) - Replaced ESLint with Biome for frontend and backend linting - Added parallel dev script with concurrently - Migrated register-routes to use direct app.route() pattern
24 lines
750 B
TypeScript
24 lines
750 B
TypeScript
import type { AuthUser } from '@/types/auth-user';
|
|
import type { UserProfile } from '@repo/api-contract';
|
|
|
|
export function getUserProfile(user: AuthUser): UserProfile {
|
|
const fullName =
|
|
(typeof user.user_metadata?.full_name === 'string' && user.user_metadata.full_name) ||
|
|
(typeof user.user_metadata?.name === 'string' && user.user_metadata.name) ||
|
|
(user.email ?? 'Usuario');
|
|
|
|
const role = (typeof user.app_metadata?.role === 'string' && user.app_metadata.role) || 'member';
|
|
|
|
const avatarUrl =
|
|
(typeof user.user_metadata?.avatar_url === 'string' && user.user_metadata.avatar_url) || null;
|
|
|
|
return {
|
|
id: user.id,
|
|
fullName,
|
|
email: user.email ?? null,
|
|
role,
|
|
avatarUrl,
|
|
createdAt: user.created_at,
|
|
};
|
|
}
|