Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
import { z } from "zod";
const isValidHttpUrl = (url: string) => {
try {
return ["http:", "https:"].includes(new URL(url).protocol);
} catch {
return false;
}
};
const optionalText = (max: number) => z.string().max(max).default("").optional();
export const AddContactFormSchema = z
.object({
id: z.string().optional(),
name: z
.string({ error: "Contact name is required." })
.min(1, { message: "Contact name cannot be empty." })
.max(120, { message: "Contact name must be 120 characters or fewer." }),
title: optionalText(120),
email: z
.string()
.default("")
.optional()
.refine(
(v) => !v || z.email().safeParse(v).success,
"Please enter a valid email address.",
),
phone: optionalText(40),
linkedinUrl: z
.string()
.default("")
.optional()
.refine(
(url) => !url || isValidHttpUrl(url),
"Please enter a full LinkedIn URL starting with https://",
),
company: z.string().optional(),
location: z.string().optional(),
relationship: optionalText(120),
workedAtCompany: z.string().optional(),
workedFrom: z.date().nullable().optional(),
workedTo: z.date().nullable().optional(),
// Named for ComboBox's `case "contactRole"` create path, not for the column
contactRole: z.string().optional(),
notes: optionalText(2000),
lastContactedAt: z
.date()
.nullable()
.optional()
.refine(
(date) => {
if (!date) return true;
const endOfToday = new Date();
endOfToday.setHours(23, 59, 59, 999);
return date <= endOfToday;
},
{ message: "Last contacted date cannot be in the future." },
),
})
.refine(
(v) => !v.workedFrom || !v.workedTo || v.workedTo >= v.workedFrom,
{ message: "The end date cannot be before the start date.", path: ["workedTo"] },
);
export type ContactFormValues = z.infer<typeof AddContactFormSchema>;