@zyacreatives/shared 1.9.91 → 1.9.93
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 +165 -4
- package/dist/schemas/job.js +36 -5
- package/dist/types/job.d.ts +12 -3
- package/package.json +1 -1
- package/src/schemas/job.ts +44 -6
- 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;
|
|
@@ -90,8 +126,9 @@ export declare const GigJobEntitySchema: z.ZodObject<{
|
|
|
90
126
|
MONTHLY: "MONTHLY";
|
|
91
127
|
PROJECT_BASED: "PROJECT_BASED";
|
|
92
128
|
}>>;
|
|
129
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
93
130
|
}, z.core.$strip>;
|
|
94
|
-
export declare const
|
|
131
|
+
export declare const GetJobWithGigDetailsOutputSchema: z.ZodObject<{
|
|
95
132
|
title: z.ZodString;
|
|
96
133
|
brandId: z.ZodCUID2;
|
|
97
134
|
brandName: z.ZodCUID2;
|
|
@@ -147,9 +184,9 @@ export declare const JobWithGigDetailsEntitySchema: z.ZodObject<{
|
|
|
147
184
|
MONTHLY: "MONTHLY";
|
|
148
185
|
PROJECT_BASED: "PROJECT_BASED";
|
|
149
186
|
}>>;
|
|
187
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
150
188
|
}, z.core.$strip>;
|
|
151
189
|
export declare const RoleJobEntitySchema: z.ZodObject<{
|
|
152
|
-
id: z.ZodCUID2;
|
|
153
190
|
title: z.ZodString;
|
|
154
191
|
brandId: z.ZodCUID2;
|
|
155
192
|
brandName: z.ZodCUID2;
|
|
@@ -173,6 +210,7 @@ export declare const RoleJobEntitySchema: z.ZodObject<{
|
|
|
173
210
|
}>;
|
|
174
211
|
createdAt: z.ZodDate;
|
|
175
212
|
updatedAt: z.ZodDate;
|
|
213
|
+
id: z.ZodCUID2;
|
|
176
214
|
jobType: z.ZodLiteral<string>;
|
|
177
215
|
gigType: z.ZodNull;
|
|
178
216
|
employmentType: z.ZodEnum<{
|
|
@@ -210,9 +248,9 @@ export declare const RoleJobEntitySchema: z.ZodObject<{
|
|
|
210
248
|
MONTHLY: "MONTHLY";
|
|
211
249
|
PROJECT_BASED: "PROJECT_BASED";
|
|
212
250
|
}>>;
|
|
251
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
213
252
|
}, z.core.$strip>;
|
|
214
|
-
export declare const
|
|
215
|
-
id: z.ZodCUID2;
|
|
253
|
+
export declare const GetJobWithRoleDetailsOutputSchema: z.ZodObject<{
|
|
216
254
|
title: z.ZodString;
|
|
217
255
|
brandId: z.ZodCUID2;
|
|
218
256
|
brandName: z.ZodCUID2;
|
|
@@ -236,6 +274,7 @@ export declare const JobWithRoleDetailsEntitySchema: z.ZodObject<{
|
|
|
236
274
|
}>;
|
|
237
275
|
createdAt: z.ZodDate;
|
|
238
276
|
updatedAt: z.ZodDate;
|
|
277
|
+
id: z.ZodCUID2;
|
|
239
278
|
jobType: z.ZodLiteral<string>;
|
|
240
279
|
gigType: z.ZodNull;
|
|
241
280
|
employmentType: z.ZodEnum<{
|
|
@@ -273,6 +312,7 @@ export declare const JobWithRoleDetailsEntitySchema: z.ZodObject<{
|
|
|
273
312
|
MONTHLY: "MONTHLY";
|
|
274
313
|
PROJECT_BASED: "PROJECT_BASED";
|
|
275
314
|
}>>;
|
|
315
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
276
316
|
}, z.core.$strip>;
|
|
277
317
|
export declare const CreateJobInputSchema: z.ZodObject<{
|
|
278
318
|
title: z.ZodString;
|
|
@@ -471,3 +511,124 @@ export declare const UpdateJobInputSchema: z.ZodObject<{
|
|
|
471
511
|
}>>>>;
|
|
472
512
|
id: z.ZodCUID2;
|
|
473
513
|
}, z.core.$strip>;
|
|
514
|
+
export declare const NormalizedJobOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
515
|
+
title: z.ZodString;
|
|
516
|
+
brandId: z.ZodCUID2;
|
|
517
|
+
brandName: z.ZodCUID2;
|
|
518
|
+
brandImgUrl: z.ZodOptional<z.ZodCUID2>;
|
|
519
|
+
workMode: z.ZodEnum<{
|
|
520
|
+
[x: string]: string;
|
|
521
|
+
}>;
|
|
522
|
+
location: z.ZodEnum<{
|
|
523
|
+
Africa: "Africa";
|
|
524
|
+
Asia: "Asia";
|
|
525
|
+
Europe: "Europe";
|
|
526
|
+
"North America": "North America";
|
|
527
|
+
"South America": "South America";
|
|
528
|
+
"Middle East": "Middle East";
|
|
529
|
+
Oceania: "Oceania";
|
|
530
|
+
Global: "Global";
|
|
531
|
+
Other: "Other";
|
|
532
|
+
Remote: "Remote";
|
|
533
|
+
EMEA: "EMEA";
|
|
534
|
+
"Asia Pacific": "Asia Pacific";
|
|
535
|
+
}>;
|
|
536
|
+
createdAt: z.ZodDate;
|
|
537
|
+
updatedAt: z.ZodDate;
|
|
538
|
+
id: z.ZodCUID2;
|
|
539
|
+
jobType: z.ZodLiteral<string>;
|
|
540
|
+
employmentType: z.ZodNull;
|
|
541
|
+
gigType: z.ZodEnum<{
|
|
542
|
+
[x: string]: string;
|
|
543
|
+
}>;
|
|
544
|
+
overview: z.ZodString;
|
|
545
|
+
deliverables: z.ZodArray<z.ZodString>;
|
|
546
|
+
employeeRequirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
547
|
+
aboutCompany: z.ZodOptional<z.ZodString>;
|
|
548
|
+
requiredSkills: z.ZodArray<z.ZodString>;
|
|
549
|
+
wagesMin: z.ZodOptional<z.ZodNumber>;
|
|
550
|
+
wagesMax: z.ZodOptional<z.ZodNumber>;
|
|
551
|
+
wagesCurrency: z.ZodOptional<z.ZodEnum<{
|
|
552
|
+
USD: "USD";
|
|
553
|
+
EUR: "EUR";
|
|
554
|
+
GBP: "GBP";
|
|
555
|
+
NGN: "NGN";
|
|
556
|
+
CAD: "CAD";
|
|
557
|
+
AUD: "AUD";
|
|
558
|
+
JPY: "JPY";
|
|
559
|
+
CHF: "CHF";
|
|
560
|
+
INR: "INR";
|
|
561
|
+
ZAR: "ZAR";
|
|
562
|
+
}>>;
|
|
563
|
+
wagesType: z.ZodOptional<z.ZodEnum<{
|
|
564
|
+
HOURLY: "HOURLY";
|
|
565
|
+
DAILY: "DAILY";
|
|
566
|
+
WEEKLY: "WEEKLY";
|
|
567
|
+
MONTHLY: "MONTHLY";
|
|
568
|
+
PROJECT_BASED: "PROJECT_BASED";
|
|
569
|
+
}>>;
|
|
570
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
571
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
572
|
+
title: z.ZodString;
|
|
573
|
+
brandId: z.ZodCUID2;
|
|
574
|
+
brandName: z.ZodCUID2;
|
|
575
|
+
brandImgUrl: z.ZodOptional<z.ZodCUID2>;
|
|
576
|
+
workMode: z.ZodEnum<{
|
|
577
|
+
[x: string]: string;
|
|
578
|
+
}>;
|
|
579
|
+
location: z.ZodEnum<{
|
|
580
|
+
Africa: "Africa";
|
|
581
|
+
Asia: "Asia";
|
|
582
|
+
Europe: "Europe";
|
|
583
|
+
"North America": "North America";
|
|
584
|
+
"South America": "South America";
|
|
585
|
+
"Middle East": "Middle East";
|
|
586
|
+
Oceania: "Oceania";
|
|
587
|
+
Global: "Global";
|
|
588
|
+
Other: "Other";
|
|
589
|
+
Remote: "Remote";
|
|
590
|
+
EMEA: "EMEA";
|
|
591
|
+
"Asia Pacific": "Asia Pacific";
|
|
592
|
+
}>;
|
|
593
|
+
createdAt: z.ZodDate;
|
|
594
|
+
updatedAt: z.ZodDate;
|
|
595
|
+
id: z.ZodCUID2;
|
|
596
|
+
jobType: z.ZodLiteral<string>;
|
|
597
|
+
gigType: z.ZodNull;
|
|
598
|
+
employmentType: z.ZodEnum<{
|
|
599
|
+
[x: string]: string;
|
|
600
|
+
}>;
|
|
601
|
+
experienceLevel: z.ZodEnum<{
|
|
602
|
+
"0-1 year": "0-1 year";
|
|
603
|
+
"1-3 years": "1-3 years";
|
|
604
|
+
"3-5 years": "3-5 years";
|
|
605
|
+
"5+ years": "5+ years";
|
|
606
|
+
}>;
|
|
607
|
+
overview: z.ZodString;
|
|
608
|
+
keyResponsibilities: z.ZodArray<z.ZodString>;
|
|
609
|
+
requiredSkills: z.ZodArray<z.ZodString>;
|
|
610
|
+
employeeRequirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
611
|
+
companyBenefits: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
612
|
+
wagesMin: z.ZodOptional<z.ZodNumber>;
|
|
613
|
+
wagesMax: z.ZodOptional<z.ZodNumber>;
|
|
614
|
+
wagesCurrency: z.ZodOptional<z.ZodEnum<{
|
|
615
|
+
USD: "USD";
|
|
616
|
+
EUR: "EUR";
|
|
617
|
+
GBP: "GBP";
|
|
618
|
+
NGN: "NGN";
|
|
619
|
+
CAD: "CAD";
|
|
620
|
+
AUD: "AUD";
|
|
621
|
+
JPY: "JPY";
|
|
622
|
+
CHF: "CHF";
|
|
623
|
+
INR: "INR";
|
|
624
|
+
ZAR: "ZAR";
|
|
625
|
+
}>>;
|
|
626
|
+
wagesType: z.ZodOptional<z.ZodEnum<{
|
|
627
|
+
HOURLY: "HOURLY";
|
|
628
|
+
DAILY: "DAILY";
|
|
629
|
+
WEEKLY: "WEEKLY";
|
|
630
|
+
MONTHLY: "MONTHLY";
|
|
631
|
+
PROJECT_BASED: "PROJECT_BASED";
|
|
632
|
+
}>>;
|
|
633
|
+
jobSections: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
634
|
+
}, 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(),
|
|
@@ -39,9 +58,13 @@ exports.GigJobEntitySchema = exports.JobEntitySchema.extend({
|
|
|
39
58
|
wagesType: zod_1.z
|
|
40
59
|
.enum(Object.values(constants_1.WAGE_TYPES))
|
|
41
60
|
.optional(),
|
|
61
|
+
jobSections: zod_1.z
|
|
62
|
+
.array(zod_1.z.string())
|
|
63
|
+
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
42
64
|
});
|
|
43
|
-
exports.
|
|
65
|
+
exports.GetJobWithGigDetailsOutputSchema = exports.JobEntitySchema.extend(exports.GigJobEntitySchema.shape);
|
|
44
66
|
exports.RoleJobEntitySchema = exports.JobEntitySchema.extend({
|
|
67
|
+
id: zod_1.z.cuid2(),
|
|
45
68
|
jobType: zod_1.z.literal(constants_1.JOB_TYPE.ROLE),
|
|
46
69
|
gigType: zod_1.z.null(), // enforce null for ROLE
|
|
47
70
|
employmentType: zod_1.z.enum(Object.values(constants_1.EMPLOYMENT_TYPE)),
|
|
@@ -59,15 +82,19 @@ exports.RoleJobEntitySchema = exports.JobEntitySchema.extend({
|
|
|
59
82
|
wagesType: zod_1.z
|
|
60
83
|
.enum(Object.values(constants_1.WAGE_TYPES))
|
|
61
84
|
.optional(),
|
|
85
|
+
jobSections: zod_1.z
|
|
86
|
+
.array(zod_1.z.string())
|
|
87
|
+
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
62
88
|
});
|
|
63
|
-
exports.
|
|
89
|
+
exports.GetJobWithRoleDetailsOutputSchema = exports.JobEntitySchema.extend(exports.RoleJobEntitySchema.shape);
|
|
64
90
|
exports.CreateJobInputSchema = zod_1.z
|
|
65
91
|
.object({
|
|
66
92
|
title: zod_1.z.string(),
|
|
67
93
|
brandId: zod_1.z.cuid2(),
|
|
68
94
|
jobType: zod_1.z.enum(Object.values(constants_1.JOB_TYPE)),
|
|
69
|
-
|
|
70
|
-
|
|
95
|
+
employmentType: zod_1.z
|
|
96
|
+
.enum(Object.values(constants_1.EMPLOYMENT_TYPE))
|
|
97
|
+
.optional(),
|
|
71
98
|
workMode: zod_1.z.enum(Object.values(constants_1.WORK_MODE)),
|
|
72
99
|
gigType: zod_1.z
|
|
73
100
|
.enum(Object.values(constants_1.GIG_TYPE))
|
|
@@ -178,3 +205,7 @@ exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial().exte
|
|
|
178
205
|
exports.UpdateJobInputSchema = exports.CreateJobInputSchema.partial().extend({
|
|
179
206
|
id: zod_1.z.cuid2(),
|
|
180
207
|
});
|
|
208
|
+
exports.NormalizedJobOutputSchema = zod_1.z.discriminatedUnion("jobType", [
|
|
209
|
+
exports.GetJobWithGigDetailsOutputSchema,
|
|
210
|
+
exports.GetJobWithRoleDetailsOutputSchema,
|
|
211
|
+
]);
|
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(),
|
|
@@ -62,13 +87,17 @@ export const GigJobEntitySchema = JobEntitySchema.extend({
|
|
|
62
87
|
wagesType: z
|
|
63
88
|
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
64
89
|
.optional(),
|
|
90
|
+
jobSections: z
|
|
91
|
+
.array(z.string())
|
|
92
|
+
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
65
93
|
});
|
|
66
94
|
|
|
67
|
-
export const
|
|
95
|
+
export const GetJobWithGigDetailsOutputSchema = JobEntitySchema.extend(
|
|
68
96
|
GigJobEntitySchema.shape
|
|
69
97
|
);
|
|
70
98
|
|
|
71
99
|
export const RoleJobEntitySchema = JobEntitySchema.extend({
|
|
100
|
+
id: z.cuid2(),
|
|
72
101
|
jobType: z.literal(JOB_TYPE.ROLE),
|
|
73
102
|
gigType: z.null(), // enforce null for ROLE
|
|
74
103
|
employmentType: z.enum(
|
|
@@ -90,9 +119,12 @@ export const RoleJobEntitySchema = JobEntitySchema.extend({
|
|
|
90
119
|
wagesType: z
|
|
91
120
|
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
92
121
|
.optional(),
|
|
122
|
+
jobSections: z
|
|
123
|
+
.array(z.string())
|
|
124
|
+
.default(["PERSONAL_INFORMATION", "PROFESSIONAL_INFORMATION", "RESUME"]),
|
|
93
125
|
});
|
|
94
126
|
|
|
95
|
-
export const
|
|
127
|
+
export const GetJobWithRoleDetailsOutputSchema = JobEntitySchema.extend(
|
|
96
128
|
RoleJobEntitySchema.shape
|
|
97
129
|
);
|
|
98
130
|
|
|
@@ -101,10 +133,11 @@ export const CreateJobInputSchema = z
|
|
|
101
133
|
title: z.string(),
|
|
102
134
|
brandId: z.cuid2(),
|
|
103
135
|
jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
136
|
+
employmentType: z
|
|
137
|
+
.enum(
|
|
138
|
+
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
|
|
139
|
+
)
|
|
140
|
+
.optional(),
|
|
108
141
|
workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
|
|
109
142
|
gigType: z
|
|
110
143
|
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
@@ -241,3 +274,8 @@ export const UpdateGigJobInputSchema = CreateGigJobInputSchema.partial().extend(
|
|
|
241
274
|
export const UpdateJobInputSchema = CreateJobInputSchema.partial().extend({
|
|
242
275
|
id: z.cuid2(),
|
|
243
276
|
});
|
|
277
|
+
|
|
278
|
+
export const NormalizedJobOutputSchema = z.discriminatedUnion("jobType", [
|
|
279
|
+
GetJobWithGigDetailsOutputSchema,
|
|
280
|
+
GetJobWithRoleDetailsOutputSchema,
|
|
281
|
+
]);
|
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
|
+
>;
|