-
-
Notifications
You must be signed in to change notification settings - Fork 173
Added some validations to jobs-create page #1142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3efd891
71e0b04
dd4e39f
2f887c9
d8a32da
0bd09a9
637fd86
f7c6478
f930ab3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import z from "zod"; | ||
|
|
||
| export const saveJobsSchema = z.object({ | ||
| companyName: z | ||
| .string() | ||
| .min(1, "Company name should contain atleast 1 character") | ||
| .max(50, "Company name should contain atmost 50 characters"), | ||
| jobTitle: z | ||
| .string() | ||
| .min(3, "Job title should contain atleast 3 character") | ||
| .max(50, "Job title should contain atmost 50 characters"), | ||
| jobDescription: z | ||
| .string() | ||
| .min(100, "Job Description should contain atleast 100 characters") | ||
| .max(2000, "Job Description should contain atmost 2000 characters") | ||
| .optional(), | ||
| jobLocation: z | ||
| .string() | ||
| .min(3, "Location should contain atleast 3 characters") | ||
| .max(40, "Max location length is 40 characters."), | ||
| applicationUrl: z | ||
| .string() | ||
| .url("Provide a valid url") | ||
| .optional() | ||
| .or(z.literal("")), | ||
| remote: z.boolean().optional().default(false), | ||
| relocation: z.boolean().optional().default(false), | ||
| visa_sponsorship: z.boolean().optional().default(false), | ||
| jobType: z.enum(["full-time", "part-time", "freelancer", "other"]), | ||
| }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would love some thoughts on if you think all of these are sensible too? 🦾
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think yes, these should also be populated. As a result these values can be shown in the |
||
|
|
||
| export type saveJobsInput = z.TypeOf<typeof saveJobsSchema>; | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good implementation of application URL and job type fields, but missing error handling for job type
The changes to the application URL input and job type radio group are well-implemented:
However, error handling for the job type field is missing. Consider adding error display for the job type field to maintain consistency with other form fields.
Add error handling for the job type field:
Also applies to: 255-289