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
Create job source
Khuram Niaz0f2581363f46
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.tsindex 8b7e282..d49553e 100644--- a/src/actions/job.actions.ts+++ b/src/actions/job.actions.ts@@ -224,6 +224,33 @@ export const createLocation = async (}};+export const createJobSource = async (+ label: string+): Promise<any | undefined> => {+ try {+ const user = await getCurrentUser();++ if (!user) {+ throw new Error("Not authenticated");+ }++ const value = label.trim().toLowerCase();++ if (!value) {+ throw new Error("Please provide job source name");+ }++ const jobSource = await prisma.jobSource.create({+ data: { label, value, createdBy: user.id },+ });++ return { data: jobSource, success: true };+ } catch (error) {+ const msg = "Failed to create job source. ";+ return handleError(error, msg);+ }+};+export const addJob = async (data: z.infer<typeof AddJobFormSchema>): Promise<any | undefined> => {diff --git a/src/components/ComboBox.tsx b/src/components/ComboBox.tsxindex 6797aeb..b645aff 100644--- a/src/components/ComboBox.tsx+++ b/src/components/ComboBox.tsx@@ -28,6 +28,7 @@ import { addCompany } from "@/actions/company.actions";import { createJobTitle } from "@/actions/jobtitle.actions";import { toast } from "./ui/use-toast";import { createActivityType } from "@/actions/activity.actions";+import { createJobSource } from "@/actions/job.actions";interface ComboboxProps {options: any[];@@ -64,6 +65,17 @@ export function Combobox({ options, field, creatable }: ComboboxProps) {}response = data;break;+ case "source":+ const sourceRes = await createJobSource(label);+ if (!sourceRes.success) {+ toast({+ variant: "destructive",+ title: "Error!",+ description: sourceRes.message,+ });+ }+ response = sourceRes.data;+ break;case "activityType":response = await createActivityType(label);break;diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsxindex 35fb516..f6c5220 100644--- a/src/components/myjobs/AddJob.tsx+++ b/src/components/myjobs/AddJob.tsx@@ -326,7 +326,7 @@ export function AddJob({render={({ field }) => (<FormItem className="flex flex-col"><FormLabel>Job Source</FormLabel>- <Combobox options={jobSources} field={field} />+ <Combobox options={jobSources} field={field} creatable /><FormMessage /></FormItem>)}