export default defineEventHandler((event) => {
  const user = event.context.user
  if (!user) throw createError({ statusCode: 401, message: 'Unauthorized' })
  return {
    id: user.id,
    identifier: user.identifier,
    role: user.role,
    auth_provider: user.auth_provider ?? 'local',
    avatar_url: user.avatar_path ? '/api/me/avatar' : null,
  }
})
