Skip to content

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.

feat: update job and question form schemas to allow default values for job description and answer

Khuram Niazacaa730f136a
diff --git a/__tests__/AddJob.spec.tsx b/__tests__/AddJob.spec.tsx
index 537d658..39a4692 100644
--- a/__tests__/AddJob.spec.tsx
+++ b/__tests__/AddJob.spec.tsx
@@ -151,9 +151,6 @@ describe("AddJob Component", () => {
expect(screen.getByText("Company name is required.")).toBeInTheDocument();
expect(screen.getByText("Location is required.")).toBeInTheDocument();
expect(screen.getByText("Source is required.")).toBeInTheDocument();
- expect(
- screen.getByText("Job description is required."),
- ).toBeInTheDocument();
});
it("should close the dialog when clicked on cancel button", async () => {
const cancelBtn = screen.getByRole("button", { name: /cancel/i });
diff --git a/src/components/myjobs/AddJob.tsx b/src/components/myjobs/AddJob.tsx
index ca6ab83..ddf7ad3 100644
--- a/src/components/myjobs/AddJob.tsx
+++ b/src/components/myjobs/AddJob.tsx
@@ -94,7 +94,9 @@ export function AddJob({
if (!dialogOpen && searchParams.get("add-job") === "true") {
const params = new URLSearchParams(searchParams.toString());
params.delete("add-job");
- const newPath = params.toString() ? `?${params.toString()}` : window.location.pathname;
+ const newPath = params.toString()
+ ? `?${params.toString()}`
+ : window.location.pathname;
router.replace(newPath);
}
}, [dialogOpen, router, searchParams]);
@@ -105,6 +107,7 @@ export function AddJob({
status: jobStatuses[0]?.id,
salaryRange: "1",
jobUrl: "",
+ jobDescription: "N/A",
};
const form = useForm<z.infer<typeof AddJobFormSchema>>({
diff --git a/src/components/questions/QuestionForm.tsx b/src/components/questions/QuestionForm.tsx
index a68c120..5c99784 100644
--- a/src/components/questions/QuestionForm.tsx
+++ b/src/components/questions/QuestionForm.tsx
@@ -55,7 +55,7 @@ export function QuestionForm({
resolver: zodResolver(AddQuestionFormSchema),
defaultValues: {
question: "",
- answer: "",
+ answer: "TBD",
tagIds: [],
},
});
@@ -85,7 +85,7 @@ export function QuestionForm({
} else {
reset({
question: "",
- answer: "",
+ answer: "TBD",
tagIds: [],
});
}
diff --git a/src/models/addJobForm.schema.ts b/src/models/addJobForm.schema.ts
index 89535fb..8be1264 100644
--- a/src/models/addJobForm.schema.ts
+++ b/src/models/addJobForm.schema.ts
@@ -54,12 +54,16 @@ export const AddJobFormSchema = z.object({
.string({
error: "Job description is required.",
})
- .min(10, {
+ .refine((val) => val === "N/A" || val.length >= 10, {
message: "Job description must be at least 10 characters.",
}),
jobUrl: z.string().optional(),
applied: z.boolean().default(false),
resume: z.string().optional(),
coverLetter: z.string().optional(),
- tags: z.array(z.string()).max(APP_CONSTANTS.MAX_JOB_TAGS).optional().default([]),
+ tags: z
+ .array(z.string())
+ .max(APP_CONSTANTS.MAX_JOB_TAGS)
+ .optional()
+ .default([]),
});
diff --git a/src/models/addQuestionForm.schema.ts b/src/models/addQuestionForm.schema.ts
index cbce834..abff5a2 100644
--- a/src/models/addQuestionForm.schema.ts
+++ b/src/models/addQuestionForm.schema.ts
@@ -9,8 +9,8 @@ export const AddQuestionFormSchema = z.object({
.max(APP_CONSTANTS.MAX_QUESTION_LENGTH, { message: `Question cannot exceed ${APP_CONSTANTS.MAX_QUESTION_LENGTH} characters.` }),
answer: z
.string({ error: "Answer is required." })
- .min(APP_CONSTANTS.MIN_QUESTION_ANSWER_LENGTH, { message: `Answer must be at least ${APP_CONSTANTS.MIN_QUESTION_ANSWER_LENGTH} characters.` })
- .max(APP_CONSTANTS.MAX_QUESTION_ANSWER_LENGTH, { message: `Answer cannot exceed ${APP_CONSTANTS.MAX_QUESTION_ANSWER_LENGTH} characters.` }),
+ .max(APP_CONSTANTS.MAX_QUESTION_ANSWER_LENGTH, { message: `Answer cannot exceed ${APP_CONSTANTS.MAX_QUESTION_ANSWER_LENGTH} characters.` })
+ .refine((val) => val === "TBD" || val.length >= APP_CONSTANTS.MIN_QUESTION_ANSWER_LENGTH, { message: `Answer must be at least ${APP_CONSTANTS.MIN_QUESTION_ANSWER_LENGTH} characters.` }),
tagIds: z
.array(z.string())
.max(APP_CONSTANTS.MAX_JOB_TAGS, { message: `Maximum ${APP_CONSTANTS.MAX_JOB_TAGS} skill tags allowed.` })