All files / lib/validations experience.ts

100% Statements 44/44
100% Branches 0/0
100% Functions 0/0
100% Lines 44/44

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 46 47 48 49 50 51 52 53 54 552x   2x 2x 2x 2x 2x 2x 2x   2x   2x 2x 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x   2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x       2x      
import { z } from 'zod';
 
export const employmentTypes = [
  'full_time',
  'part_time',
  'contract',
  'freelance',
  'internship',
] as const;
 
export const locationTypes = ['remote', 'hybrid', 'onsite'] as const;
 
export const employmentTypeLabels: Record<(typeof employmentTypes)[number], string> = {
  full_time: 'Full-time',
  part_time: 'Part-time',
  contract: 'Contract',
  freelance: 'Freelance',
  internship: 'Internship',
};
 
export const locationTypeLabels: Record<(typeof locationTypes)[number], string> = {
  remote: 'Remote',
  hybrid: 'Hybrid',
  onsite: 'On-site',
};
 
export const workExperienceSchema = z.object({
  company_name: z
    .string()
    .min(1, 'Company name is required')
    .max(100, 'Company name must be less than 100 characters'),
  company_logo_url: z.string().url().optional().nullable(),
  company_website: z.string().url().optional().nullable().or(z.literal('')),
  role_title: z
    .string()
    .min(1, 'Role title is required')
    .max(100, 'Role title must be less than 100 characters'),
  employment_type: z.enum(employmentTypes).default('full_time'),
  location: z.string().max(100).optional().nullable(),
  location_type: z.enum(locationTypes).default('remote'),
  start_date: z.string().min(1, 'Start date is required'),
  end_date: z.string().optional().nullable(),
  is_current: z.boolean().default(false),
  description: z.string().max(2000).optional().nullable(),
  achievements: z.array(z.string()).default([]),
  skills: z.array(z.string()).default([]),
  is_visible: z.boolean().default(true),
});
 
export type WorkExperienceFormData = z.infer<typeof workExperienceSchema>;
 
export const workExperienceUpdateSchema = workExperienceSchema.partial();
 
export type WorkExperienceUpdateData = z.infer<typeof workExperienceUpdateSchema>;