@zyacreatives/shared 2.1.98 → 2.2.0

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.
@@ -276,6 +276,7 @@ export declare const TrackedJobApplicationEntitySchema: z.ZodObject<{
276
276
  Monthly: "Monthly";
277
277
  "Project Based": "Project Based";
278
278
  }>>;
279
+ version: z.ZodInt;
279
280
  }, z.core.$strip>, z.ZodObject<{
280
281
  id: z.ZodCUID2;
281
282
  title: z.ZodString;
@@ -326,6 +327,7 @@ export declare const TrackedJobApplicationEntitySchema: z.ZodObject<{
326
327
  }>>>;
327
328
  isBookmarked: z.ZodBoolean;
328
329
  createdAt: z.ZodDate;
330
+ version: z.ZodInt;
329
331
  updatedAt: z.ZodDate;
330
332
  }, z.core.$strip>, z.ZodObject<{
331
333
  title: z.ZodString;
@@ -407,6 +409,7 @@ export declare const TrackedJobApplicationEntitySchema: z.ZodObject<{
407
409
  Monthly: "Monthly";
408
410
  "Project Based": "Project Based";
409
411
  }>>;
412
+ version: z.ZodInt;
410
413
  }, z.core.$strip>]>;
411
414
  }, z.core.$strip>;
412
415
  export declare const UpdateJobApplicationInputSchema: z.ZodObject<{
@@ -571,6 +574,7 @@ export declare const GetTrackedJobApplicationsOutputSchema: z.ZodObject<{
571
574
  Monthly: "Monthly";
572
575
  "Project Based": "Project Based";
573
576
  }>>;
577
+ version: z.ZodInt;
574
578
  }, z.core.$strip>, z.ZodObject<{
575
579
  id: z.ZodCUID2;
576
580
  title: z.ZodString;
@@ -621,6 +625,7 @@ export declare const GetTrackedJobApplicationsOutputSchema: z.ZodObject<{
621
625
  }>>>;
622
626
  isBookmarked: z.ZodBoolean;
623
627
  createdAt: z.ZodDate;
628
+ version: z.ZodInt;
624
629
  updatedAt: z.ZodDate;
625
630
  }, z.core.$strip>, z.ZodObject<{
626
631
  title: z.ZodString;
@@ -702,6 +707,7 @@ export declare const GetTrackedJobApplicationsOutputSchema: z.ZodObject<{
702
707
  Monthly: "Monthly";
703
708
  "Project Based": "Project Based";
704
709
  }>>;
710
+ version: z.ZodInt;
705
711
  }, z.core.$strip>]>;
706
712
  }, z.core.$strip>>;
707
713
  total: z.ZodNumber;
@@ -55,6 +55,7 @@ export declare const BaseJobEntitySchema: z.ZodObject<{
55
55
  [x: string]: string;
56
56
  }>>>;
57
57
  createdAt: z.ZodDate;
58
+ version: z.ZodInt;
58
59
  updatedAt: z.ZodDate;
59
60
  }, z.core.$strip>;
60
61
  export declare const JobIdSchema: z.ZodObject<{
@@ -110,6 +111,7 @@ export declare const JobEntitySchema: z.ZodObject<{
110
111
  }>>>;
111
112
  isBookmarked: z.ZodBoolean;
112
113
  createdAt: z.ZodDate;
114
+ version: z.ZodInt;
113
115
  updatedAt: z.ZodDate;
114
116
  }, z.core.$strip>;
115
117
  export declare const GigJobEntitySchema: z.ZodObject<{
@@ -141,6 +143,7 @@ export declare const GigJobEntitySchema: z.ZodObject<{
141
143
  Monthly: "Monthly";
142
144
  "Project Based": "Project Based";
143
145
  }>>;
146
+ version: z.ZodInt;
144
147
  }, z.core.$strip>;
145
148
  export declare const JobWithGigDetailsEntitySchema: z.ZodObject<{
146
149
  title: z.ZodString;
@@ -216,6 +219,7 @@ export declare const JobWithGigDetailsEntitySchema: z.ZodObject<{
216
219
  Monthly: "Monthly";
217
220
  "Project Based": "Project Based";
218
221
  }>>;
222
+ version: z.ZodInt;
219
223
  }, z.core.$strip>;
220
224
  export declare const RoleJobEntitySchema: z.ZodObject<{
221
225
  id: z.ZodCUID2;
@@ -252,6 +256,7 @@ export declare const RoleJobEntitySchema: z.ZodObject<{
252
256
  Monthly: "Monthly";
253
257
  "Project Based": "Project Based";
254
258
  }>>;
259
+ version: z.ZodInt;
255
260
  }, z.core.$strip>;
256
261
  export declare const JobWithRoleDetailsEntitySchema: z.ZodObject<{
257
262
  title: z.ZodString;
@@ -333,6 +338,7 @@ export declare const JobWithRoleDetailsEntitySchema: z.ZodObject<{
333
338
  Monthly: "Monthly";
334
339
  "Project Based": "Project Based";
335
340
  }>>;
341
+ version: z.ZodInt;
336
342
  }, z.core.$strip>;
337
343
  export declare const CreateJobInputSchema: z.ZodPipe<z.ZodObject<{
338
344
  title: z.ZodString;
@@ -490,6 +496,7 @@ export declare const UpdateRoleJobInputSchema: z.ZodObject<{
490
496
  Monthly: "Monthly";
491
497
  "Project Based": "Project Based";
492
498
  }>>>;
499
+ version: z.ZodInt;
493
500
  }, z.core.$strip>;
494
501
  export declare const UpdateGigJobInputSchema: z.ZodObject<{
495
502
  id: z.ZodNonOptional<z.ZodOptional<z.ZodCUID2>>;
@@ -519,6 +526,7 @@ export declare const UpdateGigJobInputSchema: z.ZodObject<{
519
526
  Monthly: "Monthly";
520
527
  "Project Based": "Project Based";
521
528
  }>>>;
529
+ version: z.ZodInt;
522
530
  }, z.core.$strip>;
523
531
  export declare const UpdateJobInputSchema: z.ZodObject<{
524
532
  title: z.ZodOptional<z.ZodString>;
@@ -566,6 +574,7 @@ export declare const UpdateJobInputSchema: z.ZodObject<{
566
574
  DRAFT: "DRAFT";
567
575
  ARCHIVED: "ARCHIVED";
568
576
  }>>;
577
+ version: z.ZodInt;
569
578
  }, z.core.$strip>;
570
579
  export declare const NormalizedJobSchema: z.ZodUnion<readonly [z.ZodObject<{
571
580
  title: z.ZodString;
@@ -641,6 +650,7 @@ export declare const NormalizedJobSchema: z.ZodUnion<readonly [z.ZodObject<{
641
650
  Monthly: "Monthly";
642
651
  "Project Based": "Project Based";
643
652
  }>>;
653
+ version: z.ZodInt;
644
654
  }, z.core.$strip>, z.ZodObject<{
645
655
  id: z.ZodCUID2;
646
656
  title: z.ZodString;
@@ -691,6 +701,7 @@ export declare const NormalizedJobSchema: z.ZodUnion<readonly [z.ZodObject<{
691
701
  }>>>;
692
702
  isBookmarked: z.ZodBoolean;
693
703
  createdAt: z.ZodDate;
704
+ version: z.ZodInt;
694
705
  updatedAt: z.ZodDate;
695
706
  }, z.core.$strip>, z.ZodObject<{
696
707
  title: z.ZodString;
@@ -772,6 +783,7 @@ export declare const NormalizedJobSchema: z.ZodUnion<readonly [z.ZodObject<{
772
783
  Monthly: "Monthly";
773
784
  "Project Based": "Project Based";
774
785
  }>>;
786
+ version: z.ZodInt;
775
787
  }, z.core.$strip>]>;
776
788
  export declare const GetCreatedJobsOutputSchema: z.ZodObject<{
777
789
  jobs: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
@@ -848,6 +860,7 @@ export declare const GetCreatedJobsOutputSchema: z.ZodObject<{
848
860
  Monthly: "Monthly";
849
861
  "Project Based": "Project Based";
850
862
  }>>;
863
+ version: z.ZodInt;
851
864
  }, z.core.$strip>, z.ZodObject<{
852
865
  id: z.ZodCUID2;
853
866
  title: z.ZodString;
@@ -898,6 +911,7 @@ export declare const GetCreatedJobsOutputSchema: z.ZodObject<{
898
911
  }>>>;
899
912
  isBookmarked: z.ZodBoolean;
900
913
  createdAt: z.ZodDate;
914
+ version: z.ZodInt;
901
915
  updatedAt: z.ZodDate;
902
916
  }, z.core.$strip>, z.ZodObject<{
903
917
  title: z.ZodString;
@@ -979,6 +993,7 @@ export declare const GetCreatedJobsOutputSchema: z.ZodObject<{
979
993
  Monthly: "Monthly";
980
994
  "Project Based": "Project Based";
981
995
  }>>;
996
+ version: z.ZodInt;
982
997
  }, z.core.$strip>]>>;
983
998
  noOfJobs: z.ZodNumber;
984
999
  noOfActiveJobs: z.ZodNumber;
@@ -1099,6 +1114,7 @@ export declare const GetJobsOutputSchema: z.ZodObject<{
1099
1114
  Monthly: "Monthly";
1100
1115
  "Project Based": "Project Based";
1101
1116
  }>>;
1117
+ version: z.ZodInt;
1102
1118
  }, z.core.$strip>, z.ZodObject<{
1103
1119
  id: z.ZodCUID2;
1104
1120
  title: z.ZodString;
@@ -1149,6 +1165,7 @@ export declare const GetJobsOutputSchema: z.ZodObject<{
1149
1165
  }>>>;
1150
1166
  isBookmarked: z.ZodBoolean;
1151
1167
  createdAt: z.ZodDate;
1168
+ version: z.ZodInt;
1152
1169
  updatedAt: z.ZodDate;
1153
1170
  }, z.core.$strip>, z.ZodObject<{
1154
1171
  title: z.ZodString;
@@ -1230,6 +1247,7 @@ export declare const GetJobsOutputSchema: z.ZodObject<{
1230
1247
  Monthly: "Monthly";
1231
1248
  "Project Based": "Project Based";
1232
1249
  }>>;
1250
+ version: z.ZodInt;
1233
1251
  }, z.core.$strip>]>>;
1234
1252
  total: z.ZodNumber;
1235
1253
  page: z.ZodNumber;
@@ -33,6 +33,7 @@ exports.BaseJobEntitySchema = zod_1.z.object({
33
33
  constants_1.JOB_SECTIONS.COVER_LETTER,
34
34
  ]),
35
35
  createdAt: zod_1.z.date(),
36
+ version: zod_1.z.int(),
36
37
  updatedAt: zod_1.z.date(),
37
38
  });
38
39
  exports.JobIdSchema = zod_1.z.object({
@@ -64,6 +65,7 @@ exports.JobEntitySchema = zod_1.z.object({
64
65
  ]),
65
66
  isBookmarked: zod_1.z.boolean(),
66
67
  createdAt: zod_1.z.date(),
68
+ version: zod_1.z.int(),
67
69
  updatedAt: zod_1.z.date(),
68
70
  });
69
71
  exports.GigJobEntitySchema = zod_1.z.object({
@@ -82,6 +84,7 @@ exports.GigJobEntitySchema = zod_1.z.object({
82
84
  wagesType: zod_1.z
83
85
  .enum(Object.values(constants_1.WAGE_TYPES))
84
86
  .optional(),
87
+ version: zod_1.z.int(),
85
88
  });
86
89
  exports.JobWithGigDetailsEntitySchema = exports.JobEntitySchema.extend(exports.GigJobEntitySchema.shape);
87
90
  exports.RoleJobEntitySchema = zod_1.z.object({
@@ -101,6 +104,7 @@ exports.RoleJobEntitySchema = zod_1.z.object({
101
104
  wagesType: zod_1.z
102
105
  .enum(Object.values(constants_1.WAGE_TYPES))
103
106
  .optional(),
107
+ version: zod_1.z.int(),
104
108
  });
105
109
  exports.JobWithRoleDetailsEntitySchema = exports.JobEntitySchema.extend(exports.RoleJobEntitySchema.shape);
106
110
  const CreateJobInputBaseSchema = zod_1.z.object({
@@ -163,9 +167,7 @@ exports.CreateRoleJobInputSchema = zod_1.z
163
167
  .enum(Object.values(constants_1.WAGE_TYPES))
164
168
  .optional(),
165
169
  })
166
- .refine(({ wagesMin, wagesMax }) => wagesMin === undefined ||
167
- wagesMax === undefined ||
168
- wagesMax > wagesMin, {
170
+ .refine(({ wagesMin, wagesMax }) => wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin, {
169
171
  message: "wagesMax must be greater than wagesMin",
170
172
  path: ["wagesMax"],
171
173
  });
@@ -186,19 +188,22 @@ exports.CreateGigJobInputSchema = zod_1.z
186
188
  .enum(Object.values(constants_1.WAGE_TYPES))
187
189
  .optional(),
188
190
  })
189
- .refine(({ wagesMin, wagesMax }) => wagesMin === undefined ||
190
- wagesMax === undefined ||
191
- wagesMax > wagesMin, {
191
+ .refine(({ wagesMin, wagesMax }) => wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin, {
192
192
  message: "wagesMax must be greater than wagesMin",
193
193
  path: ["wagesMax"],
194
194
  });
195
- exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema.partial().required({ id: true });
196
- exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial().required({ id: true });
195
+ exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema.partial()
196
+ .extend({ version: zod_1.z.int() })
197
+ .required({ id: true });
198
+ exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial()
199
+ .extend({ version: zod_1.z.int() })
200
+ .required({ id: true });
197
201
  exports.UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
198
202
  id: zod_1.z.cuid2(),
199
203
  status: zod_1.z
200
204
  .enum(Object.values(constants_1.JOB_STATUS))
201
205
  .optional(),
206
+ version: zod_1.z.int(),
202
207
  });
203
208
  exports.NormalizedJobSchema = zod_1.z.union([
204
209
  exports.JobWithGigDetailsEntitySchema,
@@ -2,3 +2,7 @@ import z from "zod";
2
2
  import { ProjectSocialGraphEntitySchema } from "../schemas";
3
3
  export type ProjectSocialGraphEntity = z.infer<typeof ProjectSocialGraphEntitySchema>;
4
4
  export type PostSocialGraphEntity = z.infer<typeof ProjectSocialGraphEntitySchema>;
5
+ export type Cursor = {
6
+ id: string;
7
+ createdAt: string;
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.98",
3
+ "version": "2.2.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,364 +1,336 @@
1
1
  import { z } from "zod";
2
2
  import {
3
- EMPLOYMENT_TYPE,
4
- EmploymentType,
5
- EXPERIENCE_LEVELS,
6
- ExperienceLevel,
7
- GIG_TYPE,
8
- GigType,
9
- JOB_LOCATIONS,
10
- JOB_SECTIONS,
11
- JOB_STATUS,
12
- JOB_TYPE,
13
- JobLocation,
14
- JobStatus,
15
- JobType,
16
- WAGE_TYPES,
17
- WAGES_CURRENCY,
18
- WagesCurrency,
19
- WageTypes,
20
- WORK_MODE,
21
- WorkMode,
3
+ EMPLOYMENT_TYPE,
4
+ EmploymentType,
5
+ EXPERIENCE_LEVELS,
6
+ ExperienceLevel,
7
+ GIG_TYPE,
8
+ GigType,
9
+ JOB_LOCATIONS,
10
+ JOB_SECTIONS,
11
+ JOB_STATUS,
12
+ JOB_TYPE,
13
+ JobLocation,
14
+ JobStatus,
15
+ JobType,
16
+ WAGE_TYPES,
17
+ WAGES_CURRENCY,
18
+ WagesCurrency,
19
+ WageTypes,
20
+ WORK_MODE,
21
+ WorkMode,
22
22
  } from "../constants";
23
23
 
24
24
  const JobSectionEnum = z.enum(
25
- Object.values(JOB_SECTIONS) as [string, ...string[]],
25
+ Object.values(JOB_SECTIONS) as [string, ...string[]],
26
26
  );
27
27
 
28
28
  export const MinimalJobEntitySchema = z.object({
29
- id: z.cuid2(),
30
- title: z.string(),
31
- brandId: z.cuid2(),
32
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
29
+ id: z.cuid2(),
30
+ title: z.string(),
31
+ brandId: z.cuid2(),
32
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
33
33
  });
34
34
 
35
35
  export const BaseJobEntitySchema = z.object({
36
- id: z.cuid2(),
37
- title: z.string(),
38
- brandId: z.cuid2(),
39
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
40
- employmentType: z
41
- .enum(
42
- Object.values(EMPLOYMENT_TYPE) as [
43
- EmploymentType,
44
- ...EmploymentType[],
45
- ],
46
- )
47
- .optional(),
48
- workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
49
- status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
50
- gigType: z
51
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
52
- .optional(),
53
- location: z.enum(
54
- Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
55
- ),
56
- jobSections: z
57
- .array(JobSectionEnum)
58
- .default([
59
- JOB_SECTIONS.PERSONAL_INFORMATION,
60
- JOB_SECTIONS.PROFESSIONAL_INFORMATION,
61
- JOB_SECTIONS.RESUME,
62
- JOB_SECTIONS.COVER_LETTER,
63
- ]),
64
- createdAt: z.date(),
65
- updatedAt: z.date(),
36
+ id: z.cuid2(),
37
+ title: z.string(),
38
+ brandId: z.cuid2(),
39
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
40
+ employmentType: z
41
+ .enum(
42
+ Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
43
+ )
44
+ .optional(),
45
+ workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
46
+ status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
47
+ gigType: z
48
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
49
+ .optional(),
50
+ location: z.enum(
51
+ Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
52
+ ),
53
+ jobSections: z
54
+ .array(JobSectionEnum)
55
+ .default([
56
+ JOB_SECTIONS.PERSONAL_INFORMATION,
57
+ JOB_SECTIONS.PROFESSIONAL_INFORMATION,
58
+ JOB_SECTIONS.RESUME,
59
+ JOB_SECTIONS.COVER_LETTER,
60
+ ]),
61
+ createdAt: z.date(),
62
+ version: z.int(),
63
+ updatedAt: z.date(),
66
64
  });
67
65
 
68
66
  export const JobIdSchema = z.object({
69
- jobId: z.cuid2(),
67
+ jobId: z.cuid2(),
70
68
  });
71
69
 
72
70
  export const JobEntitySchema = z.object({
73
- id: z.cuid2(),
74
- title: z.string(),
75
- brandId: z.cuid2(),
76
- brandName: z.cuid2(),
77
- brandImgUrl: z.cuid2().optional(),
78
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
79
- status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
80
- employmentType: z
81
- .enum(
82
- Object.values(EMPLOYMENT_TYPE) as [
83
- EmploymentType,
84
- ...EmploymentType[],
85
- ],
86
- )
87
- .optional(),
88
- workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
89
- gigType: z
90
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
91
- .optional(),
92
- location: z.enum(
93
- Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
94
- ),
95
- jobSections: z
96
- .array(JobSectionEnum)
97
- .default([
98
- JOB_SECTIONS.PERSONAL_INFORMATION,
99
- JOB_SECTIONS.PROFESSIONAL_INFORMATION,
100
- JOB_SECTIONS.RESUME,
101
- JOB_SECTIONS.COVER_LETTER,
102
- ]),
103
- isBookmarked: z.boolean(),
104
- createdAt: z.date(),
105
- updatedAt: z.date(),
71
+ id: z.cuid2(),
72
+ title: z.string(),
73
+ brandId: z.cuid2(),
74
+ brandName: z.cuid2(),
75
+ brandImgUrl: z.cuid2().optional(),
76
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
77
+ status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
78
+ employmentType: z
79
+ .enum(
80
+ Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
81
+ )
82
+ .optional(),
83
+ workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
84
+ gigType: z
85
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
86
+ .optional(),
87
+ location: z.enum(
88
+ Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
89
+ ),
90
+ jobSections: z
91
+ .array(JobSectionEnum)
92
+ .default([
93
+ JOB_SECTIONS.PERSONAL_INFORMATION,
94
+ JOB_SECTIONS.PROFESSIONAL_INFORMATION,
95
+ JOB_SECTIONS.RESUME,
96
+ JOB_SECTIONS.COVER_LETTER,
97
+ ]),
98
+ isBookmarked: z.boolean(),
99
+ createdAt: z.date(),
100
+ version: z.int(),
101
+ updatedAt: z.date(),
106
102
  });
107
103
 
108
104
  export const GigJobEntitySchema = z.object({
109
- id: z.cuid2(),
110
- jobType: z.literal(JOB_TYPE.GIG),
111
- overview: z.string(),
112
- deliverables: z.string(),
113
- employeeRequirements: z.string().optional(),
114
- aboutCompany: z.string().optional(),
115
- requiredSkills: z.array(z.string()),
116
- wagesMin: z.number().optional(),
117
- wagesMax: z.number().optional(),
118
- wagesCurrency: z
119
- .enum(
120
- Object.values(WAGES_CURRENCY) as [
121
- WagesCurrency,
122
- ...WagesCurrency[],
123
- ],
124
- )
125
- .optional(),
126
- wagesType: z
127
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
128
- .optional(),
105
+ id: z.cuid2(),
106
+ jobType: z.literal(JOB_TYPE.GIG),
107
+ overview: z.string(),
108
+ deliverables: z.string(),
109
+ employeeRequirements: z.string().optional(),
110
+ aboutCompany: z.string().optional(),
111
+ requiredSkills: z.array(z.string()),
112
+ wagesMin: z.number().optional(),
113
+ wagesMax: z.number().optional(),
114
+ wagesCurrency: z
115
+ .enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
116
+ .optional(),
117
+ wagesType: z
118
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
119
+ .optional(),
120
+ version: z.int(),
129
121
  });
130
122
 
131
123
  export const JobWithGigDetailsEntitySchema = JobEntitySchema.extend(
132
- GigJobEntitySchema.shape,
124
+ GigJobEntitySchema.shape,
133
125
  );
134
126
 
135
127
  export const RoleJobEntitySchema = z.object({
136
- id: z.cuid2(),
137
- jobType: z.literal(JOB_TYPE.ROLE),
138
- experienceLevel: z.enum(
139
- Object.values(EXPERIENCE_LEVELS) as [
140
- ExperienceLevel,
141
- ...ExperienceLevel[],
142
- ],
143
- ),
144
- overview: z.string(),
145
- keyResponsibilities: z.string(),
146
- requiredSkills: z.array(z.string()),
147
- employeeRequirements: z.string().optional(),
148
- companyBenefits: z.string().optional(),
149
- wagesMin: z.number().optional(),
150
- wagesMax: z.number().optional(),
151
- wagesCurrency: z
152
- .enum(
153
- Object.values(WAGES_CURRENCY) as [
154
- WagesCurrency,
155
- ...WagesCurrency[],
156
- ],
157
- )
158
- .optional(),
159
- wagesType: z
160
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
161
- .optional(),
128
+ id: z.cuid2(),
129
+ jobType: z.literal(JOB_TYPE.ROLE),
130
+ experienceLevel: z.enum(
131
+ Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]],
132
+ ),
133
+ overview: z.string(),
134
+ keyResponsibilities: z.string(),
135
+ requiredSkills: z.array(z.string()),
136
+ employeeRequirements: z.string().optional(),
137
+ companyBenefits: z.string().optional(),
138
+ wagesMin: z.number().optional(),
139
+ wagesMax: z.number().optional(),
140
+ wagesCurrency: z
141
+ .enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
142
+ .optional(),
143
+ wagesType: z
144
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
145
+ .optional(),
146
+ version: z.int(),
162
147
  });
163
148
 
164
149
  export const JobWithRoleDetailsEntitySchema = JobEntitySchema.extend(
165
- RoleJobEntitySchema.shape,
150
+ RoleJobEntitySchema.shape,
166
151
  );
167
152
 
168
153
  const CreateJobInputBaseSchema = z.object({
169
- title: z.string(),
170
- brandId: z.cuid2(),
171
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
154
+ title: z.string(),
155
+ brandId: z.cuid2(),
156
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
172
157
 
173
- employmentType: z
174
- .enum(
175
- Object.values(EMPLOYMENT_TYPE) as [
176
- EmploymentType,
177
- ...EmploymentType[],
178
- ],
179
- )
180
- .optional(),
158
+ employmentType: z
159
+ .enum(
160
+ Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
161
+ )
162
+ .optional(),
181
163
 
182
- workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
164
+ workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
183
165
 
184
- gigType: z
185
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
186
- .optional(),
166
+ gigType: z
167
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
168
+ .optional(),
187
169
 
188
- location: z
189
- .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
190
- .default(JOB_LOCATIONS.REMOTE),
170
+ location: z
171
+ .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
172
+ .default(JOB_LOCATIONS.REMOTE),
191
173
 
192
- jobSections: z
193
- .array(JobSectionEnum)
194
- .min(1, { message: "At least one job section must be provided." }),
174
+ jobSections: z
175
+ .array(JobSectionEnum)
176
+ .min(1, { message: "At least one job section must be provided." }),
195
177
  });
196
178
 
197
179
  export const CreateJobInputSchema = CreateJobInputBaseSchema.superRefine(
198
- (data, ctx) => {
199
- if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
200
- ctx.addIssue({
201
- path: ["employmentType"],
202
- code: "custom",
203
- message: "employmentType is required for ROLE jobs",
204
- });
205
- }
206
-
207
- if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
208
- ctx.addIssue({
209
- path: ["gigType"],
210
- code: "custom",
211
- message: "gigType is required for GIG jobs",
212
- });
213
- }
214
- },
215
- ).transform((data) => {
216
- if (data.jobType === JOB_TYPE.ROLE) {
217
- return { ...data, gigType: undefined };
180
+ (data, ctx) => {
181
+ if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
182
+ ctx.addIssue({
183
+ path: ["employmentType"],
184
+ code: "custom",
185
+ message: "employmentType is required for ROLE jobs",
186
+ });
218
187
  }
219
188
 
220
- if (data.jobType === JOB_TYPE.GIG) {
221
- return { ...data, employmentType: undefined };
189
+ if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
190
+ ctx.addIssue({
191
+ path: ["gigType"],
192
+ code: "custom",
193
+ message: "gigType is required for GIG jobs",
194
+ });
222
195
  }
196
+ },
197
+ ).transform((data) => {
198
+ if (data.jobType === JOB_TYPE.ROLE) {
199
+ return { ...data, gigType: undefined };
200
+ }
223
201
 
224
- return data;
202
+ if (data.jobType === JOB_TYPE.GIG) {
203
+ return { ...data, employmentType: undefined };
204
+ }
205
+
206
+ return data;
225
207
  });
226
208
 
227
209
  export const CreateRoleJobInputSchema = z
228
- .object({
229
- id: z.cuid2(),
230
- experienceLevel: z.enum(
231
- Object.values(EXPERIENCE_LEVELS) as [
232
- ExperienceLevel,
233
- ...ExperienceLevel[],
234
- ],
235
- ),
236
- overview: z.string(),
237
- keyResponsibilities: z.string(),
238
- requiredSkills: z.array(z.string()),
239
- employeeRequirements: z.string().optional(),
240
- companyBenefits: z.string().optional(),
241
- wagesMin: z.number().optional(),
242
- wagesMax: z.number().optional(),
243
- wagesCurrency: z
244
- .enum(
245
- Object.values(WAGES_CURRENCY) as [
246
- WagesCurrency,
247
- ...WagesCurrency[],
248
- ],
249
- )
250
- .optional(),
251
- wagesType: z
252
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
253
- .optional(),
254
- })
255
- .refine(
256
- ({ wagesMin, wagesMax }) =>
257
- wagesMin === undefined ||
258
- wagesMax === undefined ||
259
- wagesMax > wagesMin,
260
- {
261
- message: "wagesMax must be greater than wagesMin",
262
- path: ["wagesMax"],
263
- },
264
- );
210
+ .object({
211
+ id: z.cuid2(),
212
+ experienceLevel: z.enum(
213
+ Object.values(EXPERIENCE_LEVELS) as [
214
+ ExperienceLevel,
215
+ ...ExperienceLevel[],
216
+ ],
217
+ ),
218
+ overview: z.string(),
219
+ keyResponsibilities: z.string(),
220
+ requiredSkills: z.array(z.string()),
221
+ employeeRequirements: z.string().optional(),
222
+ companyBenefits: z.string().optional(),
223
+ wagesMin: z.number().optional(),
224
+ wagesMax: z.number().optional(),
225
+ wagesCurrency: z
226
+ .enum(
227
+ Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]],
228
+ )
229
+ .optional(),
230
+ wagesType: z
231
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
232
+ .optional(),
233
+ })
234
+ .refine(
235
+ ({ wagesMin, wagesMax }) =>
236
+ wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin,
237
+ {
238
+ message: "wagesMax must be greater than wagesMin",
239
+ path: ["wagesMax"],
240
+ },
241
+ );
265
242
 
266
243
  export const CreateGigJobInputSchema = z
267
- .object({
268
- id: z.cuid2(),
269
- overview: z.string(),
270
- deliverables: z.string(),
271
- employeeRequirements: z.string().optional(),
272
- aboutCompany: z.string().optional(),
273
- requiredSkills: z.array(z.string()),
274
- wagesMin: z.number().optional(),
275
- wagesMax: z.number().optional(),
276
- wagesCurrency: z
277
- .enum(
278
- Object.values(WAGES_CURRENCY) as [
279
- WagesCurrency,
280
- ...WagesCurrency[],
281
- ],
282
- )
283
- .optional(),
284
- wagesType: z
285
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
286
- .optional(),
287
- })
288
- .refine(
289
- ({ wagesMin, wagesMax }) =>
290
- wagesMin === undefined ||
291
- wagesMax === undefined ||
292
- wagesMax > wagesMin,
293
- {
294
- message: "wagesMax must be greater than wagesMin",
295
- path: ["wagesMax"],
296
- },
297
- );
244
+ .object({
245
+ id: z.cuid2(),
246
+ overview: z.string(),
247
+ deliverables: z.string(),
248
+ employeeRequirements: z.string().optional(),
249
+ aboutCompany: z.string().optional(),
250
+ requiredSkills: z.array(z.string()),
251
+ wagesMin: z.number().optional(),
252
+ wagesMax: z.number().optional(),
253
+ wagesCurrency: z
254
+ .enum(
255
+ Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]],
256
+ )
257
+ .optional(),
258
+ wagesType: z
259
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
260
+ .optional(),
261
+ })
262
+ .refine(
263
+ ({ wagesMin, wagesMax }) =>
264
+ wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin,
265
+ {
266
+ message: "wagesMax must be greater than wagesMin",
267
+ path: ["wagesMax"],
268
+ },
269
+ );
298
270
 
299
- export const UpdateRoleJobInputSchema =
300
- CreateRoleJobInputSchema.partial().required({ id: true });
271
+ export const UpdateRoleJobInputSchema = CreateRoleJobInputSchema.partial()
272
+ .extend({ version: z.int() })
273
+ .required({ id: true });
301
274
 
302
- export const UpdateGigJobInputSchema =
303
- CreateGigJobInputSchema.partial().required({ id: true });
275
+ export const UpdateGigJobInputSchema = CreateGigJobInputSchema.partial()
276
+ .extend({ version: z.int() })
277
+ .required({ id: true });
304
278
 
305
279
  export const UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
306
- id: z.cuid2(),
307
- status: z
308
- .enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
309
- .optional(),
280
+ id: z.cuid2(),
281
+ status: z
282
+ .enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
283
+ .optional(),
284
+ version: z.int(),
310
285
  });
311
286
 
312
287
  export const NormalizedJobSchema = z.union([
313
- JobWithGigDetailsEntitySchema,
314
- JobEntitySchema,
315
- JobWithRoleDetailsEntitySchema,
288
+ JobWithGigDetailsEntitySchema,
289
+ JobEntitySchema,
290
+ JobWithRoleDetailsEntitySchema,
316
291
  ]);
317
292
 
318
293
  export const GetCreatedJobsOutputSchema = z.object({
319
- jobs: z.array(NormalizedJobSchema),
320
- noOfJobs: z.number(),
321
- noOfActiveJobs: z.number(),
322
- noOfArchivedJobs: z.number(),
294
+ jobs: z.array(NormalizedJobSchema),
295
+ noOfJobs: z.number(),
296
+ noOfActiveJobs: z.number(),
297
+ noOfArchivedJobs: z.number(),
323
298
  });
324
299
 
325
300
  export const GetJobsInputSchema = z.object({
326
- q: z.string().optional(),
327
- jobType: z
328
- .enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
329
- .optional(),
330
- workMode: z
331
- .enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
332
- .optional(),
333
- location: z
334
- .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
335
- .optional(),
336
- employmentType: z
337
- .enum(
338
- Object.values(EMPLOYMENT_TYPE) as [
339
- EmploymentType,
340
- ...EmploymentType[],
341
- ],
342
- )
343
- .optional(),
344
- gigType: z
345
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
346
- .optional(),
347
- requiredSkills: z
348
- .string()
349
- .optional()
350
- .describe("Comma-separated: React,Node.js"),
301
+ q: z.string().optional(),
302
+ jobType: z
303
+ .enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
304
+ .optional(),
305
+ workMode: z
306
+ .enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
307
+ .optional(),
308
+ location: z
309
+ .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
310
+ .optional(),
311
+ employmentType: z
312
+ .enum(
313
+ Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
314
+ )
315
+ .optional(),
316
+ gigType: z
317
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
318
+ .optional(),
319
+ requiredSkills: z
320
+ .string()
321
+ .optional()
322
+ .describe("Comma-separated: React,Node.js"),
351
323
 
352
- status: z.string().optional(),
353
- page: z.coerce.number().min(1).default(1),
354
- limit: z.coerce.number().min(1).max(100).default(20),
324
+ status: z.string().optional(),
325
+ page: z.coerce.number().min(1).default(1),
326
+ limit: z.coerce.number().min(1).max(100).default(20),
355
327
  });
356
328
 
357
329
  export const GetJobsOutputSchema = z.object({
358
- jobs: z.array(NormalizedJobSchema),
359
- total: z.number(),
360
- page: z.number(),
361
- totalPages: z.number(),
362
- hasNextPage: z.boolean(),
363
- hasPrevPage: z.boolean(),
330
+ jobs: z.array(NormalizedJobSchema),
331
+ total: z.number(),
332
+ page: z.number(),
333
+ totalPages: z.number(),
334
+ hasNextPage: z.boolean(),
335
+ hasPrevPage: z.boolean(),
364
336
  });
@@ -7,3 +7,8 @@ export type ProjectSocialGraphEntity = z.infer<
7
7
  export type PostSocialGraphEntity = z.infer<
8
8
  typeof ProjectSocialGraphEntitySchema
9
9
  >;
10
+
11
+ export type Cursor = {
12
+ id: string;
13
+ createdAt: string;
14
+ };