All files / app/(dashboard)/experience page.tsx

100% Statements 31/31
100% Branches 6/6
100% Functions 1/1
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 461x         1x 1x 1x 1x   4x 4x   4x 1x 1x   3x     3x 3x 3x 3x 3x   4x 1x 1x     2x 2x 2x 2x 2x   2x 2x 2x 4x 4x 4x   4x  
import { Metadata } from 'next';
import { redirect } from 'next/navigation';
import { getUser, createClient } from '@/lib/supabase/server';
import { ExperienceManager } from './ExperienceManager';
 
export const metadata: Metadata = {
  title: 'Work Experience - ProofID',
  description: 'Manage your work experience and employment history',
};
 
export default async function ExperiencePage() {
  const user = await getUser();
 
  if (!user) {
    redirect('/login');
  }
 
  const supabase = await createClient();
 
  // Get user's profile
  const { data: profile } = await supabase
    .from('profiles')
    .select('id, subscription_tier')
    .eq('user_id', user.id)
    .single();
 
  if (!profile) {
    redirect('/onboarding');
  }
 
  // Get work experiences
  const { data: experiences } = await supabase
    .from('work_experiences')
    .select('*')
    .eq('profile_id', profile.id)
    .order('start_date', { ascending: false });
 
  return (
    <ExperienceManager
      profileId={profile.id}
      experiences={experiences || []}
      tier={profile.subscription_tier}
    />
  );
}