@zyacreatives/shared 1.9.92 → 1.9.94
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 +167 -12
- package/dist/schemas/job.js +31 -9
- package/dist/types/job.d.ts +12 -3
- package/package.json +1 -1
- package/src/schemas/job.ts +37 -10
- package/src/types/job.ts +30 -10
package/dist/schemas/job.d.ts
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
export declare const BaseJobEntitySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodCUID2;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
brandId: z.ZodCUID2;
|
|
6
|
+
jobType: z.ZodEnum<{
|
|
7
|
+
[x: string]: string;
|
|
8
|
+
}>;
|
|
9
|
+
employmentType: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
[x: string]: string;
|
|
11
|
+
}>>;
|
|
12
|
+
workMode: z.ZodEnum<{
|
|
13
|
+
[x: string]: string;
|
|
14
|
+
}>;
|
|
15
|
+
gigType: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
[x: string]: string;
|
|
17
|
+
}>>;
|
|
18
|
+
location: z.ZodEnum<{
|
|
19
|
+
Africa: "Africa";
|
|
20
|
+
Asia: "Asia";
|
|
21
|
+
Europe: "Europe";
|
|
22
|
+
"North America": "North America";
|
|
23
|
+
"South America": "South America";
|
|
24
|
+
"Middle East": "Middle East";
|
|
25
|
+
Oceania: "Oceania";
|
|
26
|
+
Global: "Global";
|
|
27
|
+
Other: "Other";
|
|
28
|
+
Remote: "Remote";
|
|
29
|
+
EMEA: "EMEA";
|
|
30
|
+
"Asia Pacific": "Asia Pacific";
|
|
31
|
+
}>;
|
|
32
|
+
createdAt: z.ZodDate;
|
|
33
|
+
updatedAt: z.ZodDate;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export declare const JobIdSchema: z.ZodObject<{
|
|
36
|
+
jobId: z.ZodCUID2;
|
|
37
|
+
}, z.core.$strip>;
|
|
2
38
|
export declare const JobEntitySchema: z.ZodObject<{
|
|
3
39
|
id: z.ZodCUID2;
|
|
4
40
|
title: z.ZodString;
|
|
@@ -92,7 +128,7 @@ export declare const GigJobEntitySchema: z.ZodObject<{
|
|
|
92
128
|
}>>;
|
|
93
129
|
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
94
130
|
}, z.core.$strip>;
|
|
95
|
-
export declare const
|
|
131
|
+
export declare const GetJobWithGigDetailsOutputSchema: z.ZodObject<{
|
|
96
132
|
title: z.ZodString;
|
|
97
133
|
brandId: z.ZodCUID2;
|
|
98
134
|
brandName: z.ZodCUID2;
|
|
@@ -151,7 +187,6 @@ export declare const JobWithGigDetailsEntitySchema: z.ZodObject<{
|
|
|
151
187
|
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
152
188
|
}, z.core.$strip>;
|
|
153
189
|
export declare const RoleJobEntitySchema: z.ZodObject<{
|
|
154
|
-
id: z.ZodCUID2;
|
|
155
190
|
title: z.ZodString;
|
|
156
191
|
brandId: z.ZodCUID2;
|
|
157
192
|
brandName: z.ZodCUID2;
|
|
@@ -175,6 +210,7 @@ export declare const RoleJobEntitySchema: z.ZodObject<{
|
|
|
175
210
|
}>;
|
|
176
211
|
createdAt: z.ZodDate;
|
|
177
212
|
updatedAt: z.ZodDate;
|
|
213
|
+
id: z.ZodCUID2;
|
|
178
214
|
jobType: z.ZodLiteral<string>;
|
|
179
215
|
gigType: z.ZodNull;
|
|
180
216
|
employmentType: z.ZodEnum<{
|
|
@@ -214,8 +250,7 @@ export declare const RoleJobEntitySchema: z.ZodObject<{
|
|
|
214
250
|
}>>;
|
|
215
251
|
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
216
252
|
}, z.core.$strip>;
|
|
217
|
-
export declare const
|
|
218
|
-
id: z.ZodCUID2;
|
|
253
|
+
export declare const GetJobWithRoleDetailsOutputSchema: z.ZodObject<{
|
|
219
254
|
title: z.ZodString;
|
|
220
255
|
brandId: z.ZodCUID2;
|
|
221
256
|
brandName: z.ZodCUID2;
|
|
@@ -239,6 +274,7 @@ export declare const JobWithRoleDetailsEntitySchema: z.ZodObject<{
|
|
|
239
274
|
}>;
|
|
240
275
|
createdAt: z.ZodDate;
|
|
241
276
|
updatedAt: z.ZodDate;
|
|
277
|
+
id: z.ZodCUID2;
|
|
242
278
|
jobType: z.ZodLiteral<string>;
|
|
243
279
|
gigType: z.ZodNull;
|
|
244
280
|
employmentType: z.ZodEnum<{
|
|
@@ -293,7 +329,7 @@ export declare const CreateJobInputSchema: z.ZodObject<{
|
|
|
293
329
|
gigType: z.ZodOptional<z.ZodEnum<{
|
|
294
330
|
[x: string]: string;
|
|
295
331
|
}>>;
|
|
296
|
-
location: z.ZodDefault<z.
|
|
332
|
+
location: z.ZodDefault<z.ZodEnum<{
|
|
297
333
|
Africa: "Africa";
|
|
298
334
|
Asia: "Asia";
|
|
299
335
|
Europe: "Europe";
|
|
@@ -306,10 +342,10 @@ export declare const CreateJobInputSchema: z.ZodObject<{
|
|
|
306
342
|
Remote: "Remote";
|
|
307
343
|
EMEA: "EMEA";
|
|
308
344
|
"Asia Pacific": "Asia Pacific";
|
|
309
|
-
}
|
|
345
|
+
}>>;
|
|
310
346
|
}, z.core.$strip>;
|
|
311
347
|
export declare const CreateRoleJobInputSchema: z.ZodObject<{
|
|
312
|
-
|
|
348
|
+
id: z.ZodCUID2;
|
|
313
349
|
experienceLevel: z.ZodEnum<{
|
|
314
350
|
"0-1 year": "0-1 year";
|
|
315
351
|
"1-3 years": "1-3 years";
|
|
@@ -344,7 +380,7 @@ export declare const CreateRoleJobInputSchema: z.ZodObject<{
|
|
|
344
380
|
}>>;
|
|
345
381
|
}, z.core.$strip>;
|
|
346
382
|
export declare const CreateGigJobInputSchema: z.ZodObject<{
|
|
347
|
-
|
|
383
|
+
id: z.ZodCUID2;
|
|
348
384
|
overview: z.ZodString;
|
|
349
385
|
deliverables: z.ZodArray<z.ZodString>;
|
|
350
386
|
employeeRequirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -373,7 +409,6 @@ export declare const CreateGigJobInputSchema: z.ZodObject<{
|
|
|
373
409
|
}>>;
|
|
374
410
|
}, z.core.$strip>;
|
|
375
411
|
export declare const UpdateRoleJobInputSchema: z.ZodObject<{
|
|
376
|
-
jobId: z.ZodOptional<z.ZodCUID2>;
|
|
377
412
|
experienceLevel: z.ZodOptional<z.ZodEnum<{
|
|
378
413
|
"0-1 year": "0-1 year";
|
|
379
414
|
"1-3 years": "1-3 years";
|
|
@@ -412,7 +447,6 @@ export declare const UpdateRoleJobInputSchema: z.ZodObject<{
|
|
|
412
447
|
}>>>;
|
|
413
448
|
}, z.core.$strip>;
|
|
414
449
|
export declare const UpdateGigJobInputSchema: z.ZodObject<{
|
|
415
|
-
jobId: z.ZodOptional<z.ZodCUID2>;
|
|
416
450
|
overview: z.ZodOptional<z.ZodString>;
|
|
417
451
|
deliverables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
418
452
|
employeeRequirements: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
@@ -459,7 +493,7 @@ export declare const UpdateJobInputSchema: z.ZodObject<{
|
|
|
459
493
|
gigType: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
|
|
460
494
|
[x: string]: string;
|
|
461
495
|
}>>>;
|
|
462
|
-
location: z.ZodOptional<z.ZodDefault<z.
|
|
496
|
+
location: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
463
497
|
Africa: "Africa";
|
|
464
498
|
Asia: "Asia";
|
|
465
499
|
Europe: "Europe";
|
|
@@ -472,6 +506,127 @@ export declare const UpdateJobInputSchema: z.ZodObject<{
|
|
|
472
506
|
Remote: "Remote";
|
|
473
507
|
EMEA: "EMEA";
|
|
474
508
|
"Asia Pacific": "Asia Pacific";
|
|
475
|
-
}
|
|
509
|
+
}>>>;
|
|
476
510
|
id: z.ZodCUID2;
|
|
477
511
|
}, z.core.$strip>;
|
|
512
|
+
export declare const NormalizedJobOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
513
|
+
title: z.ZodString;
|
|
514
|
+
brandId: z.ZodCUID2;
|
|
515
|
+
brandName: z.ZodCUID2;
|
|
516
|
+
brandImgUrl: z.ZodOptional<z.ZodCUID2>;
|
|
517
|
+
workMode: z.ZodEnum<{
|
|
518
|
+
[x: string]: string;
|
|
519
|
+
}>;
|
|
520
|
+
location: z.ZodEnum<{
|
|
521
|
+
Africa: "Africa";
|
|
522
|
+
Asia: "Asia";
|
|
523
|
+
Europe: "Europe";
|
|
524
|
+
"North America": "North America";
|
|
525
|
+
"South America": "South America";
|
|
526
|
+
"Middle East": "Middle East";
|
|
527
|
+
Oceania: "Oceania";
|
|
528
|
+
Global: "Global";
|
|
529
|
+
Other: "Other";
|
|
530
|
+
Remote: "Remote";
|
|
531
|
+
EMEA: "EMEA";
|
|
532
|
+
"Asia Pacific": "Asia Pacific";
|
|
533
|
+
}>;
|
|
534
|
+
createdAt: z.ZodDate;
|
|
535
|
+
updatedAt: z.ZodDate;
|
|
536
|
+
id: z.ZodCUID2;
|
|
537
|
+
jobType: z.ZodLiteral<string>;
|
|
538
|
+
employmentType: z.ZodNull;
|
|
539
|
+
gigType: z.ZodEnum<{
|
|
540
|
+
[x: string]: string;
|
|
541
|
+
}>;
|
|
542
|
+
overview: z.ZodString;
|
|
543
|
+
deliverables: z.ZodArray<z.ZodString>;
|
|
544
|
+
employeeRequirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
545
|
+
aboutCompany: z.ZodOptional<z.ZodString>;
|
|
546
|
+
requiredSkills: z.ZodArray<z.ZodString>;
|
|
547
|
+
wagesMin: z.ZodOptional<z.ZodNumber>;
|
|
548
|
+
wagesMax: z.ZodOptional<z.ZodNumber>;
|
|
549
|
+
wagesCurrency: z.ZodOptional<z.ZodEnum<{
|
|
550
|
+
USD: "USD";
|
|
551
|
+
EUR: "EUR";
|
|
552
|
+
GBP: "GBP";
|
|
553
|
+
NGN: "NGN";
|
|
554
|
+
CAD: "CAD";
|
|
555
|
+
AUD: "AUD";
|
|
556
|
+
JPY: "JPY";
|
|
557
|
+
CHF: "CHF";
|
|
558
|
+
INR: "INR";
|
|
559
|
+
ZAR: "ZAR";
|
|
560
|
+
}>>;
|
|
561
|
+
wagesType: z.ZodOptional<z.ZodEnum<{
|
|
562
|
+
HOURLY: "HOURLY";
|
|
563
|
+
DAILY: "DAILY";
|
|
564
|
+
WEEKLY: "WEEKLY";
|
|
565
|
+
MONTHLY: "MONTHLY";
|
|
566
|
+
PROJECT_BASED: "PROJECT_BASED";
|
|
567
|
+
}>>;
|
|
568
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
569
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
570
|
+
title: z.ZodString;
|
|
571
|
+
brandId: z.ZodCUID2;
|
|
572
|
+
brandName: z.ZodCUID2;
|
|
573
|
+
brandImgUrl: z.ZodOptional<z.ZodCUID2>;
|
|
574
|
+
workMode: z.ZodEnum<{
|
|
575
|
+
[x: string]: string;
|
|
576
|
+
}>;
|
|
577
|
+
location: z.ZodEnum<{
|
|
578
|
+
Africa: "Africa";
|
|
579
|
+
Asia: "Asia";
|
|
580
|
+
Europe: "Europe";
|
|
581
|
+
"North America": "North America";
|
|
582
|
+
"South America": "South America";
|
|
583
|
+
"Middle East": "Middle East";
|
|
584
|
+
Oceania: "Oceania";
|
|
585
|
+
Global: "Global";
|
|
586
|
+
Other: "Other";
|
|
587
|
+
Remote: "Remote";
|
|
588
|
+
EMEA: "EMEA";
|
|
589
|
+
"Asia Pacific": "Asia Pacific";
|
|
590
|
+
}>;
|
|
591
|
+
createdAt: z.ZodDate;
|
|
592
|
+
updatedAt: z.ZodDate;
|
|
593
|
+
id: z.ZodCUID2;
|
|
594
|
+
jobType: z.ZodLiteral<string>;
|
|
595
|
+
gigType: z.ZodNull;
|
|
596
|
+
employmentType: z.ZodEnum<{
|
|
597
|
+
[x: string]: string;
|
|
598
|
+
}>;
|
|
599
|
+
experienceLevel: z.ZodEnum<{
|
|
600
|
+
"0-1 year": "0-1 year";
|
|
601
|
+
"1-3 years": "1-3 years";
|
|
602
|
+
"3-5 years": "3-5 years";
|
|
603
|
+
"5+ years": "5+ years";
|
|
604
|
+
}>;
|
|
605
|
+
overview: z.ZodString;
|
|
606
|
+
keyResponsibilities: z.ZodArray<z.ZodString>;
|
|
607
|
+
requiredSkills: z.ZodArray<z.ZodString>;
|
|
608
|
+
employeeRequirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
609
|
+
companyBenefits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
610
|
+
wagesMin: z.ZodOptional<z.ZodNumber>;
|
|
611
|
+
wagesMax: z.ZodOptional<z.ZodNumber>;
|
|
612
|
+
wagesCurrency: z.ZodOptional<z.ZodEnum<{
|
|
613
|
+
USD: "USD";
|
|
614
|
+
EUR: "EUR";
|
|
615
|
+
GBP: "GBP";
|
|
616
|
+
NGN: "NGN";
|
|
617
|
+
CAD: "CAD";
|
|
618
|
+
AUD: "AUD";
|
|
619
|
+
JPY: "JPY";
|
|
620
|
+
CHF: "CHF";
|
|
621
|
+
INR: "INR";
|
|
622
|
+
ZAR: "ZAR";
|
|
623
|
+
}>>;
|
|
624
|
+
wagesType: z.ZodOptional<z.ZodEnum<{
|
|
625
|
+
HOURLY: "HOURLY";
|
|
626
|
+
DAILY: "DAILY";
|
|
627
|
+
WEEKLY: "WEEKLY";
|
|
628
|
+
MONTHLY: "MONTHLY";
|
|
629
|
+
PROJECT_BASED: "PROJECT_BASED";
|
|
630
|
+
}>>;
|
|
631
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
632
|
+
}, z.core.$strip>], "jobType">;
|
package/dist/schemas/job.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateJobInputSchema = exports.UpdateGigJobInputSchema = exports.UpdateRoleJobInputSchema = exports.CreateGigJobInputSchema = exports.CreateRoleJobInputSchema = exports.CreateJobInputSchema = exports.
|
|
3
|
+
exports.NormalizedJobOutputSchema = exports.UpdateJobInputSchema = exports.UpdateGigJobInputSchema = exports.UpdateRoleJobInputSchema = exports.CreateGigJobInputSchema = exports.CreateRoleJobInputSchema = exports.CreateJobInputSchema = exports.GetJobWithRoleDetailsOutputSchema = exports.RoleJobEntitySchema = exports.GetJobWithGigDetailsOutputSchema = exports.GigJobEntitySchema = exports.JobEntitySchema = exports.JobIdSchema = exports.BaseJobEntitySchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
+
exports.BaseJobEntitySchema = zod_1.z.object({
|
|
7
|
+
id: zod_1.z.cuid2(),
|
|
8
|
+
title: zod_1.z.string(),
|
|
9
|
+
brandId: zod_1.z.cuid2(),
|
|
10
|
+
jobType: zod_1.z.enum(Object.values(constants_1.JOB_TYPE)),
|
|
11
|
+
employmentType: zod_1.z
|
|
12
|
+
.enum(Object.values(constants_1.EMPLOYMENT_TYPE))
|
|
13
|
+
.optional(),
|
|
14
|
+
workMode: zod_1.z.enum(Object.values(constants_1.WORK_MODE)),
|
|
15
|
+
gigType: zod_1.z
|
|
16
|
+
.enum(Object.values(constants_1.GIG_TYPE))
|
|
17
|
+
.optional(),
|
|
18
|
+
location: zod_1.z.enum(Object.values(constants_1.JOB_LOCATIONS)),
|
|
19
|
+
createdAt: zod_1.z.date(),
|
|
20
|
+
updatedAt: zod_1.z.date(),
|
|
21
|
+
});
|
|
22
|
+
exports.JobIdSchema = zod_1.z.object({
|
|
23
|
+
jobId: zod_1.z.cuid2(),
|
|
24
|
+
});
|
|
6
25
|
exports.JobEntitySchema = zod_1.z.object({
|
|
7
26
|
id: zod_1.z.cuid2(),
|
|
8
27
|
title: zod_1.z.string(),
|
|
@@ -43,8 +62,9 @@ exports.GigJobEntitySchema = exports.JobEntitySchema.extend({
|
|
|
43
62
|
.array(zod_1.z.string())
|
|
44
63
|
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
45
64
|
});
|
|
46
|
-
exports.
|
|
65
|
+
exports.GetJobWithGigDetailsOutputSchema = exports.JobEntitySchema.extend(exports.GigJobEntitySchema.shape);
|
|
47
66
|
exports.RoleJobEntitySchema = exports.JobEntitySchema.extend({
|
|
67
|
+
id: zod_1.z.cuid2(),
|
|
48
68
|
jobType: zod_1.z.literal(constants_1.JOB_TYPE.ROLE),
|
|
49
69
|
gigType: zod_1.z.null(), // enforce null for ROLE
|
|
50
70
|
employmentType: zod_1.z.enum(Object.values(constants_1.EMPLOYMENT_TYPE)),
|
|
@@ -66,13 +86,12 @@ exports.RoleJobEntitySchema = exports.JobEntitySchema.extend({
|
|
|
66
86
|
.array(zod_1.z.string())
|
|
67
87
|
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
68
88
|
});
|
|
69
|
-
exports.
|
|
89
|
+
exports.GetJobWithRoleDetailsOutputSchema = exports.JobEntitySchema.extend(exports.RoleJobEntitySchema.shape);
|
|
70
90
|
exports.CreateJobInputSchema = zod_1.z
|
|
71
91
|
.object({
|
|
72
92
|
title: zod_1.z.string(),
|
|
73
93
|
brandId: zod_1.z.cuid2(),
|
|
74
94
|
jobType: zod_1.z.enum(Object.values(constants_1.JOB_TYPE)),
|
|
75
|
-
// status: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
|
|
76
95
|
employmentType: zod_1.z
|
|
77
96
|
.enum(Object.values(constants_1.EMPLOYMENT_TYPE))
|
|
78
97
|
.optional(),
|
|
@@ -81,9 +100,8 @@ exports.CreateJobInputSchema = zod_1.z
|
|
|
81
100
|
.enum(Object.values(constants_1.GIG_TYPE))
|
|
82
101
|
.optional(),
|
|
83
102
|
location: zod_1.z
|
|
84
|
-
.
|
|
85
|
-
.
|
|
86
|
-
.default([constants_1.JOB_LOCATIONS.REMOTE]),
|
|
103
|
+
.enum(Object.values(constants_1.JOB_LOCATIONS))
|
|
104
|
+
.default(constants_1.JOB_LOCATIONS.REMOTE),
|
|
87
105
|
})
|
|
88
106
|
.superRefine((data, ctx) => {
|
|
89
107
|
if (data.jobType === constants_1.JOB_TYPE.ROLE) {
|
|
@@ -120,7 +138,7 @@ exports.CreateJobInputSchema = zod_1.z
|
|
|
120
138
|
}
|
|
121
139
|
});
|
|
122
140
|
exports.CreateRoleJobInputSchema = zod_1.z.object({
|
|
123
|
-
|
|
141
|
+
id: zod_1.z.cuid2(),
|
|
124
142
|
experienceLevel: zod_1.z.enum(Object.values(constants_1.EXPERIENCE_LEVELS)),
|
|
125
143
|
overview: zod_1.z.string(),
|
|
126
144
|
keyResponsibilities: zod_1.z.array(zod_1.z.string()),
|
|
@@ -137,7 +155,7 @@ exports.CreateRoleJobInputSchema = zod_1.z.object({
|
|
|
137
155
|
.optional(),
|
|
138
156
|
});
|
|
139
157
|
exports.CreateGigJobInputSchema = zod_1.z.object({
|
|
140
|
-
|
|
158
|
+
id: zod_1.z.cuid2(),
|
|
141
159
|
overview: zod_1.z.string(),
|
|
142
160
|
deliverables: zod_1.z.array(zod_1.z.string()),
|
|
143
161
|
employeeRequirements: zod_1.z.array(zod_1.z.string()).optional(),
|
|
@@ -186,3 +204,7 @@ exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial().exte
|
|
|
186
204
|
exports.UpdateJobInputSchema = exports.CreateJobInputSchema.partial().extend({
|
|
187
205
|
id: zod_1.z.cuid2(),
|
|
188
206
|
});
|
|
207
|
+
exports.NormalizedJobOutputSchema = zod_1.z.discriminatedUnion("jobType", [
|
|
208
|
+
exports.GetJobWithGigDetailsOutputSchema,
|
|
209
|
+
exports.GetJobWithRoleDetailsOutputSchema,
|
|
210
|
+
]);
|
package/dist/types/job.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { JobEntitySchema, GigJobEntitySchema, RoleJobEntitySchema, CreateJobInputSchema, CreateRoleJobInputSchema, CreateGigJobInputSchema, UpdateRoleJobInputSchema, UpdateGigJobInputSchema, UpdateJobInputSchema,
|
|
2
|
+
import { JobEntitySchema, GigJobEntitySchema, RoleJobEntitySchema, CreateJobInputSchema, CreateRoleJobInputSchema, CreateGigJobInputSchema, UpdateRoleJobInputSchema, UpdateGigJobInputSchema, UpdateJobInputSchema, GetJobWithGigDetailsOutputSchema, GetJobWithRoleDetailsOutputSchema, BaseJobEntitySchema, JobIdSchema } from "../schemas/job";
|
|
3
|
+
export type BaseJobEntity = z.infer<typeof BaseJobEntitySchema>;
|
|
4
|
+
export type JobIdInput = z.infer<typeof JobIdSchema>;
|
|
3
5
|
export type JobEntity = z.infer<typeof JobEntitySchema>;
|
|
4
6
|
export type GigJobEntity = z.infer<typeof GigJobEntitySchema>;
|
|
5
7
|
export type RoleJobEntity = z.infer<typeof RoleJobEntitySchema>;
|
|
6
|
-
export type JobWithGigDetailsEntity = z.infer<typeof JobWithGigDetailsEntitySchema>;
|
|
7
|
-
export type JobWithRoleDetailsEntity = z.infer<typeof JobWithRoleDetailsEntitySchema>;
|
|
8
8
|
export type CreateJobInput = z.infer<typeof CreateJobInputSchema>;
|
|
9
|
+
export type CreateJobOutput = z.infer<typeof BaseJobEntitySchema>;
|
|
9
10
|
export type CreateRoleJobInput = z.infer<typeof CreateRoleJobInputSchema>;
|
|
11
|
+
export type CreateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
10
12
|
export type CreateGigJobInput = z.infer<typeof CreateGigJobInputSchema>;
|
|
13
|
+
export type CreateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
11
14
|
export type UpdateRoleJobInput = z.infer<typeof UpdateRoleJobInputSchema>;
|
|
15
|
+
export type UpdateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
12
16
|
export type UpdateGigJobInput = z.infer<typeof UpdateGigJobInputSchema>;
|
|
17
|
+
export type UpdateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
13
18
|
export type UpdateJobInput = z.infer<typeof UpdateJobInputSchema>;
|
|
19
|
+
export type UpdateJobOutput = z.infer<typeof BaseJobEntitySchema>;
|
|
20
|
+
export type GetJobOutput = z.infer<typeof BaseJobEntitySchema>;
|
|
21
|
+
export type GetJobWithGigDetailsOutput = z.infer<typeof GetJobWithGigDetailsOutputSchema>;
|
|
22
|
+
export type GetJobWithRoleDetailsOutput = z.infer<typeof GetJobWithRoleDetailsOutputSchema>;
|
package/package.json
CHANGED
package/src/schemas/job.ts
CHANGED
|
@@ -21,6 +21,31 @@ import {
|
|
|
21
21
|
WorkMode,
|
|
22
22
|
} from "../constants";
|
|
23
23
|
|
|
24
|
+
export const BaseJobEntitySchema = z.object({
|
|
25
|
+
id: z.cuid2(),
|
|
26
|
+
title: z.string(),
|
|
27
|
+
brandId: z.cuid2(),
|
|
28
|
+
jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
|
|
29
|
+
employmentType: z
|
|
30
|
+
.enum(
|
|
31
|
+
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
|
|
32
|
+
)
|
|
33
|
+
.optional(),
|
|
34
|
+
workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
|
|
35
|
+
gigType: z
|
|
36
|
+
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
37
|
+
.optional(),
|
|
38
|
+
location: z.enum(
|
|
39
|
+
Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]]
|
|
40
|
+
),
|
|
41
|
+
createdAt: z.date(),
|
|
42
|
+
updatedAt: z.date(),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const JobIdSchema = z.object({
|
|
46
|
+
jobId: z.cuid2(),
|
|
47
|
+
});
|
|
48
|
+
|
|
24
49
|
export const JobEntitySchema = z.object({
|
|
25
50
|
id: z.cuid2(),
|
|
26
51
|
title: z.string(),
|
|
@@ -67,11 +92,12 @@ export const GigJobEntitySchema = JobEntitySchema.extend({
|
|
|
67
92
|
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
68
93
|
});
|
|
69
94
|
|
|
70
|
-
export const
|
|
95
|
+
export const GetJobWithGigDetailsOutputSchema = JobEntitySchema.extend(
|
|
71
96
|
GigJobEntitySchema.shape
|
|
72
97
|
);
|
|
73
98
|
|
|
74
99
|
export const RoleJobEntitySchema = JobEntitySchema.extend({
|
|
100
|
+
id: z.cuid2(),
|
|
75
101
|
jobType: z.literal(JOB_TYPE.ROLE),
|
|
76
102
|
gigType: z.null(), // enforce null for ROLE
|
|
77
103
|
employmentType: z.enum(
|
|
@@ -98,7 +124,7 @@ export const RoleJobEntitySchema = JobEntitySchema.extend({
|
|
|
98
124
|
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
99
125
|
});
|
|
100
126
|
|
|
101
|
-
export const
|
|
127
|
+
export const GetJobWithRoleDetailsOutputSchema = JobEntitySchema.extend(
|
|
102
128
|
RoleJobEntitySchema.shape
|
|
103
129
|
);
|
|
104
130
|
|
|
@@ -107,7 +133,6 @@ export const CreateJobInputSchema = z
|
|
|
107
133
|
title: z.string(),
|
|
108
134
|
brandId: z.cuid2(),
|
|
109
135
|
jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
|
|
110
|
-
// status: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
|
|
111
136
|
employmentType: z
|
|
112
137
|
.enum(
|
|
113
138
|
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
|
|
@@ -118,11 +143,8 @@ export const CreateJobInputSchema = z
|
|
|
118
143
|
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
119
144
|
.optional(),
|
|
120
145
|
location: z
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
)
|
|
124
|
-
.nonempty("At least one job location must be selected")
|
|
125
|
-
.default([JOB_LOCATIONS.REMOTE]),
|
|
146
|
+
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
147
|
+
.default(JOB_LOCATIONS.REMOTE),
|
|
126
148
|
})
|
|
127
149
|
.superRefine((data, ctx) => {
|
|
128
150
|
if (data.jobType === JOB_TYPE.ROLE) {
|
|
@@ -161,7 +183,7 @@ export const CreateJobInputSchema = z
|
|
|
161
183
|
});
|
|
162
184
|
|
|
163
185
|
export const CreateRoleJobInputSchema = z.object({
|
|
164
|
-
|
|
186
|
+
id: z.cuid2(),
|
|
165
187
|
experienceLevel: z.enum(
|
|
166
188
|
Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]]
|
|
167
189
|
),
|
|
@@ -181,7 +203,7 @@ export const CreateRoleJobInputSchema = z.object({
|
|
|
181
203
|
});
|
|
182
204
|
|
|
183
205
|
export const CreateGigJobInputSchema = z.object({
|
|
184
|
-
|
|
206
|
+
id: z.cuid2(),
|
|
185
207
|
overview: z.string(),
|
|
186
208
|
deliverables: z.array(z.string()),
|
|
187
209
|
employeeRequirements: z.array(z.string()).optional(),
|
|
@@ -249,3 +271,8 @@ export const UpdateGigJobInputSchema = CreateGigJobInputSchema.partial().extend(
|
|
|
249
271
|
export const UpdateJobInputSchema = CreateJobInputSchema.partial().extend({
|
|
250
272
|
id: z.cuid2(),
|
|
251
273
|
});
|
|
274
|
+
|
|
275
|
+
export const NormalizedJobOutputSchema = z.discriminatedUnion("jobType", [
|
|
276
|
+
GetJobWithGigDetailsOutputSchema,
|
|
277
|
+
GetJobWithRoleDetailsOutputSchema,
|
|
278
|
+
]);
|
package/src/types/job.ts
CHANGED
|
@@ -9,32 +9,52 @@ import {
|
|
|
9
9
|
UpdateRoleJobInputSchema,
|
|
10
10
|
UpdateGigJobInputSchema,
|
|
11
11
|
UpdateJobInputSchema,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
GetJobWithGigDetailsOutputSchema,
|
|
13
|
+
GetJobWithRoleDetailsOutputSchema,
|
|
14
|
+
BaseJobEntitySchema,
|
|
15
|
+
JobIdSchema,
|
|
14
16
|
} from "../schemas/job";
|
|
15
17
|
|
|
18
|
+
export type BaseJobEntity = z.infer<typeof BaseJobEntitySchema>;
|
|
19
|
+
|
|
20
|
+
export type JobIdInput = z.infer<typeof JobIdSchema>;
|
|
21
|
+
|
|
16
22
|
export type JobEntity = z.infer<typeof JobEntitySchema>;
|
|
17
23
|
|
|
18
24
|
export type GigJobEntity = z.infer<typeof GigJobEntitySchema>;
|
|
19
25
|
|
|
20
26
|
export type RoleJobEntity = z.infer<typeof RoleJobEntitySchema>;
|
|
21
27
|
|
|
22
|
-
export type JobWithGigDetailsEntity = z.infer<
|
|
23
|
-
typeof JobWithGigDetailsEntitySchema
|
|
24
|
-
>;
|
|
25
|
-
|
|
26
|
-
export type JobWithRoleDetailsEntity = z.infer<
|
|
27
|
-
typeof JobWithRoleDetailsEntitySchema
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
28
|
export type CreateJobInput = z.infer<typeof CreateJobInputSchema>;
|
|
31
29
|
|
|
30
|
+
export type CreateJobOutput = z.infer<typeof BaseJobEntitySchema>;
|
|
31
|
+
|
|
32
32
|
export type CreateRoleJobInput = z.infer<typeof CreateRoleJobInputSchema>;
|
|
33
33
|
|
|
34
|
+
export type CreateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
35
|
+
|
|
34
36
|
export type CreateGigJobInput = z.infer<typeof CreateGigJobInputSchema>;
|
|
35
37
|
|
|
38
|
+
export type CreateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
39
|
+
|
|
36
40
|
export type UpdateRoleJobInput = z.infer<typeof UpdateRoleJobInputSchema>;
|
|
37
41
|
|
|
42
|
+
export type UpdateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
43
|
+
|
|
38
44
|
export type UpdateGigJobInput = z.infer<typeof UpdateGigJobInputSchema>;
|
|
39
45
|
|
|
46
|
+
export type UpdateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
47
|
+
|
|
40
48
|
export type UpdateJobInput = z.infer<typeof UpdateJobInputSchema>;
|
|
49
|
+
|
|
50
|
+
export type UpdateJobOutput = z.infer<typeof BaseJobEntitySchema>;
|
|
51
|
+
|
|
52
|
+
export type GetJobOutput = z.infer<typeof BaseJobEntitySchema>;
|
|
53
|
+
|
|
54
|
+
export type GetJobWithGigDetailsOutput = z.infer<
|
|
55
|
+
typeof GetJobWithGigDetailsOutputSchema
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
export type GetJobWithRoleDetailsOutput = z.infer<
|
|
59
|
+
typeof GetJobWithRoleDetailsOutputSchema
|
|
60
|
+
>;
|