Initial commit

This commit is contained in:
Jose Selesan
2026-04-08 22:53:11 -03:00
commit 9ae270609d
179 changed files with 28096 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
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,
}
}