@zyacreatives/shared 2.1.11 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schemas/job.d.ts +20 -2
- package/dist/schemas/job.js +22 -33
- package/package.json +1 -1
- package/src/schemas/job.ts +61 -62
package/dist/schemas/job.d.ts
CHANGED
|
@@ -322,7 +322,7 @@ export declare const JobWithRoleDetailsEntitySchema: z.ZodObject<{
|
|
|
322
322
|
"Project Based": "Project Based";
|
|
323
323
|
}>>;
|
|
324
324
|
}, z.core.$strip>;
|
|
325
|
-
export declare const CreateJobInputSchema: z.ZodObject<{
|
|
325
|
+
export declare const CreateJobInputSchema: z.ZodPipe<z.ZodObject<{
|
|
326
326
|
title: z.ZodString;
|
|
327
327
|
brandId: z.ZodCUID2;
|
|
328
328
|
jobType: z.ZodEnum<{
|
|
@@ -361,7 +361,25 @@ export declare const CreateJobInputSchema: z.ZodObject<{
|
|
|
361
361
|
jobSections: z.ZodArray<z.ZodEnum<{
|
|
362
362
|
[x: string]: string;
|
|
363
363
|
}>>;
|
|
364
|
-
}, z.core.$strip
|
|
364
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
365
|
+
title: string;
|
|
366
|
+
brandId: string;
|
|
367
|
+
jobType: "GIG" | "ROLE";
|
|
368
|
+
workMode: "Remote" | "Hybrid" | "On Site";
|
|
369
|
+
location: "Africa" | "Asia" | "Europe" | "North America" | "South America" | "Middle East" | "Oceania" | "Global" | "Other" | "Remote" | "EMEA" | "Asia Pacific";
|
|
370
|
+
jobSections: string[];
|
|
371
|
+
employmentType?: "Full Time" | "Part Time" | "Freelance" | "Internship" | undefined;
|
|
372
|
+
gigType?: "One Time" | "Recurring" | undefined;
|
|
373
|
+
}, {
|
|
374
|
+
title: string;
|
|
375
|
+
brandId: string;
|
|
376
|
+
jobType: "GIG" | "ROLE";
|
|
377
|
+
workMode: "Remote" | "Hybrid" | "On Site";
|
|
378
|
+
location: "Africa" | "Asia" | "Europe" | "North America" | "South America" | "Middle East" | "Oceania" | "Global" | "Other" | "Remote" | "EMEA" | "Asia Pacific";
|
|
379
|
+
jobSections: string[];
|
|
380
|
+
employmentType?: "Full Time" | "Part Time" | "Freelance" | "Internship" | undefined;
|
|
381
|
+
gigType?: "One Time" | "Recurring" | undefined;
|
|
382
|
+
}>>;
|
|
365
383
|
export declare const CreateRoleJobInputSchema: z.ZodObject<{
|
|
366
384
|
id: z.ZodCUID2;
|
|
367
385
|
experienceLevel: z.ZodEnum<{
|
package/dist/schemas/job.js
CHANGED
|
@@ -94,8 +94,7 @@ exports.RoleJobEntitySchema = zod_1.z.object({
|
|
|
94
94
|
.optional(),
|
|
95
95
|
});
|
|
96
96
|
exports.JobWithRoleDetailsEntitySchema = exports.JobEntitySchema.extend(exports.RoleJobEntitySchema.shape);
|
|
97
|
-
|
|
98
|
-
.object({
|
|
97
|
+
const CreateJobInputBaseSchema = zod_1.z.object({
|
|
99
98
|
title: zod_1.z.string(),
|
|
100
99
|
brandId: zod_1.z.cuid2(),
|
|
101
100
|
jobType: zod_1.z.enum(Object.values(constants_1.JOB_TYPE)),
|
|
@@ -116,40 +115,30 @@ exports.CreateJobInputSchema = zod_1.z
|
|
|
116
115
|
sections.includes(constants_1.JOB_SECTIONS.RESUME), {
|
|
117
116
|
message: "jobSections must always include PERSONAL_INFORMATION, PROFESSIONAL_INFORMATION, and RESUME",
|
|
118
117
|
}),
|
|
119
|
-
})
|
|
120
|
-
|
|
118
|
+
});
|
|
119
|
+
exports.CreateJobInputSchema = CreateJobInputBaseSchema.superRefine((data, ctx) => {
|
|
120
|
+
if (data.jobType === constants_1.JOB_TYPE.ROLE && !data.employmentType) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
path: ["employmentType"],
|
|
123
|
+
code: "custom",
|
|
124
|
+
message: "employmentType is required for ROLE jobs",
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (data.jobType === constants_1.JOB_TYPE.GIG && !data.gigType) {
|
|
128
|
+
ctx.addIssue({
|
|
129
|
+
path: ["gigType"],
|
|
130
|
+
code: "custom",
|
|
131
|
+
message: "gigType is required for GIG jobs",
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}).transform((data) => {
|
|
121
135
|
if (data.jobType === constants_1.JOB_TYPE.ROLE) {
|
|
122
|
-
|
|
123
|
-
ctx.addIssue({
|
|
124
|
-
path: ["gigType"],
|
|
125
|
-
code: "custom",
|
|
126
|
-
message: "gigType must be null/undefined for PROJECT jobs",
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
if (!data.employmentType) {
|
|
130
|
-
ctx.addIssue({
|
|
131
|
-
path: ["employmentType"],
|
|
132
|
-
code: "custom",
|
|
133
|
-
message: "employmentType is required for PROJECT jobs",
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
+
return { ...data, gigType: undefined };
|
|
136
137
|
}
|
|
137
138
|
if (data.jobType === constants_1.JOB_TYPE.GIG) {
|
|
138
|
-
|
|
139
|
-
ctx.addIssue({
|
|
140
|
-
path: ["gigType"],
|
|
141
|
-
code: "custom",
|
|
142
|
-
message: "gigType is required for GIG jobs",
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
if (data.employmentType !== undefined) {
|
|
146
|
-
ctx.addIssue({
|
|
147
|
-
path: ["employmentType"],
|
|
148
|
-
code: "custom",
|
|
149
|
-
message: "employmentType must be null/undefined for GIG jobs",
|
|
150
|
-
});
|
|
151
|
-
}
|
|
139
|
+
return { ...data, employmentType: undefined };
|
|
152
140
|
}
|
|
141
|
+
return data;
|
|
153
142
|
});
|
|
154
143
|
exports.CreateRoleJobInputSchema = zod_1.z
|
|
155
144
|
.object({
|
|
@@ -196,7 +185,7 @@ exports.CreateGigJobInputSchema = zod_1.z
|
|
|
196
185
|
});
|
|
197
186
|
exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema.partial().required({ id: true });
|
|
198
187
|
exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial().required({ id: true });
|
|
199
|
-
exports.UpdateJobInputSchema =
|
|
188
|
+
exports.UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
|
|
200
189
|
id: zod_1.z.cuid2(),
|
|
201
190
|
status: zod_1.z
|
|
202
191
|
.enum(Object.values(constants_1.JOB_STATUS))
|
package/package.json
CHANGED
package/src/schemas/job.ts
CHANGED
|
@@ -139,71 +139,70 @@ export const JobWithRoleDetailsEntitySchema = JobEntitySchema.extend(
|
|
|
139
139
|
RoleJobEntitySchema.shape
|
|
140
140
|
);
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (data.jobType === JOB_TYPE.ROLE) {
|
|
174
|
-
if (data.gigType !== undefined) {
|
|
175
|
-
ctx.addIssue({
|
|
176
|
-
path: ["gigType"],
|
|
177
|
-
code: "custom",
|
|
178
|
-
message: "gigType must be null/undefined for PROJECT jobs",
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
if (!data.employmentType) {
|
|
182
|
-
ctx.addIssue({
|
|
183
|
-
path: ["employmentType"],
|
|
184
|
-
code: "custom",
|
|
185
|
-
message: "employmentType is required for PROJECT jobs",
|
|
186
|
-
});
|
|
142
|
+
const CreateJobInputBaseSchema = z.object({
|
|
143
|
+
title: z.string(),
|
|
144
|
+
brandId: z.cuid2(),
|
|
145
|
+
jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
|
|
146
|
+
|
|
147
|
+
employmentType: z
|
|
148
|
+
.enum(
|
|
149
|
+
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
|
|
150
|
+
)
|
|
151
|
+
.optional(),
|
|
152
|
+
|
|
153
|
+
workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
|
|
154
|
+
|
|
155
|
+
gigType: z
|
|
156
|
+
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
157
|
+
.optional(),
|
|
158
|
+
|
|
159
|
+
location: z
|
|
160
|
+
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
161
|
+
.default(JOB_LOCATIONS.REMOTE),
|
|
162
|
+
|
|
163
|
+
jobSections: z
|
|
164
|
+
.array(JobSectionEnum)
|
|
165
|
+
.refine(
|
|
166
|
+
(sections) =>
|
|
167
|
+
sections.includes(JOB_SECTIONS.PERSONAL_INFORMATION) &&
|
|
168
|
+
sections.includes(JOB_SECTIONS.PROFESSIONAL_INFORMATION) &&
|
|
169
|
+
sections.includes(JOB_SECTIONS.RESUME),
|
|
170
|
+
{
|
|
171
|
+
message:
|
|
172
|
+
"jobSections must always include PERSONAL_INFORMATION, PROFESSIONAL_INFORMATION, and RESUME",
|
|
187
173
|
}
|
|
174
|
+
),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
export const CreateJobInputSchema = CreateJobInputBaseSchema.superRefine(
|
|
178
|
+
(data, ctx) => {
|
|
179
|
+
if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
|
|
180
|
+
ctx.addIssue({
|
|
181
|
+
path: ["employmentType"],
|
|
182
|
+
code: "custom",
|
|
183
|
+
message: "employmentType is required for ROLE jobs",
|
|
184
|
+
});
|
|
188
185
|
}
|
|
189
186
|
|
|
190
|
-
if (data.jobType === JOB_TYPE.GIG) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (data.employmentType !== undefined) {
|
|
199
|
-
ctx.addIssue({
|
|
200
|
-
path: ["employmentType"],
|
|
201
|
-
code: "custom",
|
|
202
|
-
message: "employmentType must be null/undefined for GIG jobs",
|
|
203
|
-
});
|
|
204
|
-
}
|
|
187
|
+
if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
|
|
188
|
+
ctx.addIssue({
|
|
189
|
+
path: ["gigType"],
|
|
190
|
+
code: "custom",
|
|
191
|
+
message: "gigType is required for GIG jobs",
|
|
192
|
+
});
|
|
205
193
|
}
|
|
206
|
-
}
|
|
194
|
+
}
|
|
195
|
+
).transform((data) => {
|
|
196
|
+
if (data.jobType === JOB_TYPE.ROLE) {
|
|
197
|
+
return { ...data, gigType: undefined };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (data.jobType === JOB_TYPE.GIG) {
|
|
201
|
+
return { ...data, employmentType: undefined };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return data;
|
|
205
|
+
});
|
|
207
206
|
|
|
208
207
|
export const CreateRoleJobInputSchema = z
|
|
209
208
|
.object({
|
|
@@ -273,7 +272,7 @@ export const UpdateRoleJobInputSchema =
|
|
|
273
272
|
export const UpdateGigJobInputSchema =
|
|
274
273
|
CreateGigJobInputSchema.partial().required({ id: true });
|
|
275
274
|
|
|
276
|
-
export const UpdateJobInputSchema =
|
|
275
|
+
export const UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
|
|
277
276
|
id: z.cuid2(),
|
|
278
277
|
status: z
|
|
279
278
|
.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
|