@zyacreatives/shared 2.2.65 → 2.2.66
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-application.d.ts +12 -12
- package/dist/schemas/job.d.ts +49 -25
- package/dist/schemas/job.js +293 -150
- package/dist/schemas/post.d.ts +69 -19
- package/dist/schemas/post.js +178 -81
- package/dist/schemas/user.d.ts +23 -5
- package/dist/schemas/user.js +118 -56
- package/dist/types/job.d.ts +2 -1
- package/dist/types/post.d.ts +2 -1
- package/dist/types/user.d.ts +2 -1
- package/package.json +1 -1
- package/src/schemas/job.ts +271 -128
- package/src/schemas/post.ts +182 -81
- package/src/schemas/user.ts +172 -114
- package/src/types/job.ts +6 -0
- package/src/types/post.ts +3 -0
- package/src/types/user.ts +2 -0
package/src/schemas/job.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import {
|
|
3
3
|
EMPLOYMENT_TYPE,
|
|
4
4
|
EmploymentType,
|
|
@@ -13,43 +13,53 @@ import {
|
|
|
13
13
|
JobLocation,
|
|
14
14
|
JobStatus,
|
|
15
15
|
JobType,
|
|
16
|
-
WAGE_TYPES,
|
|
17
16
|
WAGES_CURRENCY,
|
|
18
17
|
WagesCurrency,
|
|
18
|
+
WAGE_TYPES,
|
|
19
19
|
WageTypes,
|
|
20
20
|
WORK_MODE,
|
|
21
21
|
WorkMode,
|
|
22
22
|
} from "../constants";
|
|
23
23
|
|
|
24
|
-
const JobSectionEnum = z
|
|
25
|
-
Object.values(JOB_SECTIONS) as [string, ...string[]]
|
|
26
|
-
);
|
|
24
|
+
const JobSectionEnum = z
|
|
25
|
+
.enum(Object.values(JOB_SECTIONS) as [string, ...string[]])
|
|
26
|
+
.openapi({ example: "PROFESSIONAL_INFORMATION" });
|
|
27
27
|
|
|
28
28
|
export const MinimalJobEntitySchema = z.object({
|
|
29
|
-
id: z.cuid2(),
|
|
30
|
-
title: z.string(),
|
|
31
|
-
brandId: z.cuid2(),
|
|
32
|
-
jobType: z
|
|
29
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000job1" }),
|
|
30
|
+
title: z.string().openapi({ example: "Senior Frontend Engineer" }),
|
|
31
|
+
brandId: z.cuid2().openapi({ example: "ckj1a2b3c0000brnd" }),
|
|
32
|
+
jobType: z
|
|
33
|
+
.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
|
|
34
|
+
.openapi({ example: "ROLE" }),
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
export const BaseJobEntitySchema = z.object({
|
|
36
|
-
id: z.cuid2(),
|
|
37
|
-
title: z.string(),
|
|
38
|
-
brandId: z.cuid2(),
|
|
39
|
-
jobType: z
|
|
38
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000job1" }),
|
|
39
|
+
title: z.string().openapi({ example: "Senior Frontend Engineer" }),
|
|
40
|
+
brandId: z.cuid2().openapi({ example: "ckj1a2b3c0000brnd" }),
|
|
41
|
+
jobType: z
|
|
42
|
+
.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
|
|
43
|
+
.openapi({ example: "ROLE" }),
|
|
40
44
|
employmentType: z
|
|
41
45
|
.enum(
|
|
42
46
|
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
|
|
43
47
|
)
|
|
44
|
-
.optional()
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
.optional()
|
|
49
|
+
.openapi({ example: "FULL_TIME" }),
|
|
50
|
+
workMode: z
|
|
51
|
+
.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
|
|
52
|
+
.openapi({ example: "REMOTE" }),
|
|
53
|
+
status: z
|
|
54
|
+
.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
|
|
55
|
+
.openapi({ example: "OPEN" }),
|
|
47
56
|
gigType: z
|
|
48
57
|
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
49
|
-
.optional()
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
.optional()
|
|
59
|
+
.openapi({ example: "PROJECT_BASED" }),
|
|
60
|
+
location: z
|
|
61
|
+
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
62
|
+
.openapi({ example: "LAGOS" }),
|
|
53
63
|
jobSections: z
|
|
54
64
|
.array(JobSectionEnum)
|
|
55
65
|
.default([
|
|
@@ -57,36 +67,56 @@ export const BaseJobEntitySchema = z.object({
|
|
|
57
67
|
JOB_SECTIONS.PROFESSIONAL_INFORMATION,
|
|
58
68
|
JOB_SECTIONS.RESUME,
|
|
59
69
|
JOB_SECTIONS.COVER_LETTER,
|
|
60
|
-
])
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
])
|
|
71
|
+
.openapi({
|
|
72
|
+
example: [
|
|
73
|
+
"PERSONAL_INFORMATION",
|
|
74
|
+
"PROFESSIONAL_INFORMATION",
|
|
75
|
+
"RESUME",
|
|
76
|
+
"COVER_LETTER",
|
|
77
|
+
],
|
|
78
|
+
}),
|
|
79
|
+
createdAt: z.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
80
|
+
version: z.int().openapi({ example: 1 }),
|
|
81
|
+
updatedAt: z.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
64
82
|
});
|
|
65
83
|
|
|
66
84
|
export const JobIdSchema = z.object({
|
|
67
|
-
jobId: z.cuid2(),
|
|
85
|
+
jobId: z.cuid2().openapi({ example: "ckj1a2b3c0000job1" }),
|
|
68
86
|
});
|
|
69
87
|
|
|
70
88
|
export const JobEntitySchema = z.object({
|
|
71
|
-
id: z.cuid2(),
|
|
72
|
-
title: z.string(),
|
|
73
|
-
brandId: z.cuid2(),
|
|
74
|
-
brandName: z.
|
|
75
|
-
brandImgUrl: z
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000job1" }),
|
|
90
|
+
title: z.string().openapi({ example: "Senior Frontend Engineer" }),
|
|
91
|
+
brandId: z.cuid2().openapi({ example: "ckj1a2b3c0000brnd" }),
|
|
92
|
+
brandName: z.string().openapi({ example: "Acme Corp" }),
|
|
93
|
+
brandImgUrl: z
|
|
94
|
+
.string()
|
|
95
|
+
.url()
|
|
96
|
+
.optional()
|
|
97
|
+
.openapi({ example: "https://example.com/logo.png" }),
|
|
98
|
+
jobType: z
|
|
99
|
+
.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
|
|
100
|
+
.openapi({ example: "ROLE" }),
|
|
101
|
+
status: z
|
|
102
|
+
.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
|
|
103
|
+
.openapi({ example: "OPEN" }),
|
|
78
104
|
employmentType: z
|
|
79
105
|
.enum(
|
|
80
106
|
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
|
|
81
107
|
)
|
|
82
|
-
.optional()
|
|
83
|
-
|
|
108
|
+
.optional()
|
|
109
|
+
.openapi({ example: "FULL_TIME" }),
|
|
110
|
+
workMode: z
|
|
111
|
+
.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
|
|
112
|
+
.openapi({ example: "REMOTE" }),
|
|
84
113
|
gigType: z
|
|
85
114
|
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
86
|
-
.optional()
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
115
|
+
.optional()
|
|
116
|
+
.openapi({ example: "PROJECT_BASED" }),
|
|
117
|
+
location: z
|
|
118
|
+
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
119
|
+
.openapi({ example: "LAGOS" }),
|
|
90
120
|
jobSections: z
|
|
91
121
|
.array(JobSectionEnum)
|
|
92
122
|
.default([
|
|
@@ -94,29 +124,44 @@ export const JobEntitySchema = z.object({
|
|
|
94
124
|
JOB_SECTIONS.PROFESSIONAL_INFORMATION,
|
|
95
125
|
JOB_SECTIONS.RESUME,
|
|
96
126
|
JOB_SECTIONS.COVER_LETTER,
|
|
97
|
-
])
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
127
|
+
])
|
|
128
|
+
.openapi({ example: ["PERSONAL_INFORMATION", "RESUME"] }),
|
|
129
|
+
isBookmarked: z.boolean().openapi({ example: false }),
|
|
130
|
+
createdAt: z.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
131
|
+
version: z.int().openapi({ example: 1 }),
|
|
132
|
+
updatedAt: z.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
102
133
|
});
|
|
103
134
|
|
|
104
135
|
export const GigJobEntitySchema = z.object({
|
|
105
|
-
id: z.cuid2(),
|
|
106
|
-
jobType: z.literal(JOB_TYPE.GIG),
|
|
107
|
-
overview: z
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
136
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000gig1" }),
|
|
137
|
+
jobType: z.literal(JOB_TYPE.GIG).openapi({ example: "GIG" }),
|
|
138
|
+
overview: z
|
|
139
|
+
.string()
|
|
140
|
+
.openapi({ example: "We need a landing page redesigned." }),
|
|
141
|
+
deliverables: z
|
|
142
|
+
.string()
|
|
143
|
+
.openapi({ example: "Figma files and exported assets." }),
|
|
144
|
+
employeeRequirements: z
|
|
145
|
+
.string()
|
|
146
|
+
.optional()
|
|
147
|
+
.openapi({ example: "Must have 3+ years in UI/UX." }),
|
|
148
|
+
aboutCompany: z
|
|
149
|
+
.string()
|
|
150
|
+
.optional()
|
|
151
|
+
.openapi({ example: "A fast-growing fintech startup." }),
|
|
152
|
+
requiredSkills: z
|
|
153
|
+
.array(z.string())
|
|
154
|
+
.openapi({ example: ["Figma", "UI Design"] }),
|
|
155
|
+
wagesMin: z.number().optional().openapi({ example: 500 }),
|
|
156
|
+
wagesMax: z.number().optional().openapi({ example: 1000 }),
|
|
114
157
|
wagesCurrency: z
|
|
115
158
|
.enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
|
|
116
|
-
.optional()
|
|
159
|
+
.optional()
|
|
160
|
+
.openapi({ example: "USD" }),
|
|
117
161
|
wagesType: z
|
|
118
162
|
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
119
|
-
.optional()
|
|
163
|
+
.optional()
|
|
164
|
+
.openapi({ example: "FIXED" }),
|
|
120
165
|
});
|
|
121
166
|
|
|
122
167
|
export const JobWithGigDetailsEntitySchema = JobEntitySchema.extend(
|
|
@@ -124,24 +169,43 @@ export const JobWithGigDetailsEntitySchema = JobEntitySchema.extend(
|
|
|
124
169
|
);
|
|
125
170
|
|
|
126
171
|
export const RoleJobEntitySchema = z.object({
|
|
127
|
-
id: z.cuid2(),
|
|
128
|
-
jobType: z.literal(JOB_TYPE.ROLE),
|
|
129
|
-
experienceLevel: z
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
172
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000rol1" }),
|
|
173
|
+
jobType: z.literal(JOB_TYPE.ROLE).openapi({ example: "ROLE" }),
|
|
174
|
+
experienceLevel: z
|
|
175
|
+
.enum(
|
|
176
|
+
Object.values(EXPERIENCE_LEVELS) as [
|
|
177
|
+
ExperienceLevel,
|
|
178
|
+
...ExperienceLevel[],
|
|
179
|
+
],
|
|
180
|
+
)
|
|
181
|
+
.openapi({ example: "SENIOR" }),
|
|
182
|
+
overview: z
|
|
183
|
+
.string()
|
|
184
|
+
.openapi({ example: "Lead the development of our core product." }),
|
|
185
|
+
keyResponsibilities: z
|
|
186
|
+
.string()
|
|
187
|
+
.openapi({ example: "Architect systems, mentor juniors." }),
|
|
188
|
+
requiredSkills: z
|
|
189
|
+
.array(z.string())
|
|
190
|
+
.openapi({ example: ["React", "TypeScript", "Node.js"] }),
|
|
191
|
+
employeeRequirements: z
|
|
192
|
+
.string()
|
|
193
|
+
.optional()
|
|
194
|
+
.openapi({ example: "BS in Computer Science." }),
|
|
195
|
+
companyBenefits: z
|
|
196
|
+
.string()
|
|
197
|
+
.optional()
|
|
198
|
+
.openapi({ example: "Health insurance, remote work." }),
|
|
199
|
+
wagesMin: z.number().optional().nullable().openapi({ example: 80000 }),
|
|
200
|
+
wagesMax: z.number().optional().nullable().openapi({ example: 120000 }),
|
|
139
201
|
wagesCurrency: z
|
|
140
202
|
.enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
|
|
141
|
-
.optional()
|
|
203
|
+
.optional()
|
|
204
|
+
.openapi({ example: "USD" }),
|
|
142
205
|
wagesType: z
|
|
143
206
|
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
144
|
-
.optional()
|
|
207
|
+
.optional()
|
|
208
|
+
.openapi({ example: "YEARLY" }),
|
|
145
209
|
});
|
|
146
210
|
|
|
147
211
|
export const JobWithRoleDetailsEntitySchema = JobEntitySchema.extend(
|
|
@@ -149,29 +213,37 @@ export const JobWithRoleDetailsEntitySchema = JobEntitySchema.extend(
|
|
|
149
213
|
);
|
|
150
214
|
|
|
151
215
|
const CreateJobInputBaseSchema = z.object({
|
|
152
|
-
title: z.string(),
|
|
153
|
-
brandId: z.cuid2(),
|
|
154
|
-
jobType: z
|
|
216
|
+
title: z.string().openapi({ example: "Senior Frontend Engineer" }),
|
|
217
|
+
brandId: z.cuid2().openapi({ example: "ckj1a2b3c0000brnd" }),
|
|
218
|
+
jobType: z
|
|
219
|
+
.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
|
|
220
|
+
.openapi({ example: "ROLE" }),
|
|
155
221
|
|
|
156
222
|
employmentType: z
|
|
157
223
|
.enum(
|
|
158
224
|
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
|
|
159
225
|
)
|
|
160
|
-
.optional()
|
|
226
|
+
.optional()
|
|
227
|
+
.openapi({ example: "FULL_TIME" }),
|
|
161
228
|
|
|
162
|
-
workMode: z
|
|
229
|
+
workMode: z
|
|
230
|
+
.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
|
|
231
|
+
.openapi({ example: "REMOTE" }),
|
|
163
232
|
|
|
164
233
|
gigType: z
|
|
165
234
|
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
166
|
-
.optional()
|
|
235
|
+
.optional()
|
|
236
|
+
.openapi({ example: "PROJECT_BASED" }),
|
|
167
237
|
|
|
168
238
|
location: z
|
|
169
239
|
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
170
|
-
.default(JOB_LOCATIONS.REMOTE)
|
|
240
|
+
.default(JOB_LOCATIONS.REMOTE)
|
|
241
|
+
.openapi({ example: "REMOTE" }),
|
|
171
242
|
|
|
172
243
|
jobSections: z
|
|
173
244
|
.array(JobSectionEnum)
|
|
174
|
-
.min(1, { message: "At least one job section must be provided." })
|
|
245
|
+
.min(1, { message: "At least one job section must be provided." })
|
|
246
|
+
.openapi({ example: ["PERSONAL_INFORMATION", "RESUME"] }),
|
|
175
247
|
});
|
|
176
248
|
|
|
177
249
|
export const CreateJobInputSchema = CreateJobInputBaseSchema.superRefine(
|
|
@@ -206,28 +278,44 @@ export const CreateJobInputSchema = CreateJobInputBaseSchema.superRefine(
|
|
|
206
278
|
|
|
207
279
|
export const CreateRoleJobInputSchema = z
|
|
208
280
|
.object({
|
|
209
|
-
id: z.cuid2(),
|
|
210
|
-
experienceLevel: z
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
281
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000rol1" }),
|
|
282
|
+
experienceLevel: z
|
|
283
|
+
.enum(
|
|
284
|
+
Object.values(EXPERIENCE_LEVELS) as [
|
|
285
|
+
ExperienceLevel,
|
|
286
|
+
...ExperienceLevel[],
|
|
287
|
+
],
|
|
288
|
+
)
|
|
289
|
+
.openapi({ example: "MID_LEVEL" }),
|
|
290
|
+
overview: z
|
|
291
|
+
.string()
|
|
292
|
+
.openapi({ example: "Build cool features for our app." }),
|
|
293
|
+
keyResponsibilities: z
|
|
294
|
+
.string()
|
|
295
|
+
.openapi({ example: "Write code, review PRs." }),
|
|
296
|
+
requiredSkills: z
|
|
297
|
+
.array(z.string())
|
|
298
|
+
.openapi({ example: ["JavaScript", "React"] }),
|
|
299
|
+
employeeRequirements: z
|
|
300
|
+
.string()
|
|
301
|
+
.optional()
|
|
302
|
+
.openapi({ example: "Good communication skills." }),
|
|
303
|
+
companyBenefits: z
|
|
304
|
+
.string()
|
|
305
|
+
.optional()
|
|
306
|
+
.openapi({ example: "Unlimited PTO." }),
|
|
307
|
+
wagesMin: z.number().optional().nullable().openapi({ example: 60000 }),
|
|
308
|
+
wagesMax: z.number().optional().nullable().openapi({ example: 90000 }),
|
|
223
309
|
wagesCurrency: z
|
|
224
310
|
.enum(
|
|
225
311
|
Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]],
|
|
226
312
|
)
|
|
227
|
-
.optional()
|
|
313
|
+
.optional()
|
|
314
|
+
.openapi({ example: "USD" }),
|
|
228
315
|
wagesType: z
|
|
229
316
|
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
230
|
-
.optional()
|
|
317
|
+
.optional()
|
|
318
|
+
.openapi({ example: "YEARLY" }),
|
|
231
319
|
})
|
|
232
320
|
.refine(
|
|
233
321
|
({ wagesMin, wagesMax }) =>
|
|
@@ -240,22 +328,36 @@ export const CreateRoleJobInputSchema = z
|
|
|
240
328
|
|
|
241
329
|
export const CreateGigJobInputSchema = z
|
|
242
330
|
.object({
|
|
243
|
-
id: z.cuid2(),
|
|
244
|
-
overview: z
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
331
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000gig1" }),
|
|
332
|
+
overview: z
|
|
333
|
+
.string()
|
|
334
|
+
.openapi({ example: "Need a logo designed for a new brand." }),
|
|
335
|
+
deliverables: z
|
|
336
|
+
.string()
|
|
337
|
+
.openapi({ example: "Vector files, PNGs, and a brand guide." }),
|
|
338
|
+
employeeRequirements: z
|
|
339
|
+
.string()
|
|
340
|
+
.optional()
|
|
341
|
+
.openapi({ example: "Portfolio required." }),
|
|
342
|
+
aboutCompany: z
|
|
343
|
+
.string()
|
|
344
|
+
.optional()
|
|
345
|
+
.openapi({ example: "E-commerce store." }),
|
|
346
|
+
requiredSkills: z
|
|
347
|
+
.array(z.string())
|
|
348
|
+
.openapi({ example: ["Graphic Design", "Illustrator"] }),
|
|
349
|
+
wagesMin: z.number().optional().nullable().openapi({ example: 100 }),
|
|
350
|
+
wagesMax: z.number().optional().nullable().openapi({ example: 500 }),
|
|
251
351
|
wagesCurrency: z
|
|
252
352
|
.enum(
|
|
253
353
|
Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]],
|
|
254
354
|
)
|
|
255
|
-
.optional()
|
|
355
|
+
.optional()
|
|
356
|
+
.openapi({ example: "USD" }),
|
|
256
357
|
wagesType: z
|
|
257
358
|
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
258
|
-
.optional()
|
|
359
|
+
.optional()
|
|
360
|
+
.openapi({ example: "FIXED" }),
|
|
259
361
|
})
|
|
260
362
|
.refine(
|
|
261
363
|
({ wagesMin, wagesMax }) =>
|
|
@@ -267,19 +369,20 @@ export const CreateGigJobInputSchema = z
|
|
|
267
369
|
);
|
|
268
370
|
|
|
269
371
|
export const UpdateRoleJobInputSchema = CreateRoleJobInputSchema.partial()
|
|
270
|
-
.extend({ version: z.int() })
|
|
372
|
+
.extend({ version: z.int().openapi({ example: 2 }) })
|
|
271
373
|
.required({ id: true });
|
|
272
374
|
|
|
273
375
|
export const UpdateGigJobInputSchema = CreateGigJobInputSchema.partial()
|
|
274
|
-
.extend({ version: z.int() })
|
|
376
|
+
.extend({ version: z.int().openapi({ example: 2 }) })
|
|
275
377
|
.required({ id: true });
|
|
276
378
|
|
|
277
379
|
export const UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
|
|
278
|
-
id: z.cuid2(),
|
|
380
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000job1" }),
|
|
279
381
|
status: z
|
|
280
382
|
.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
|
|
281
|
-
.optional()
|
|
282
|
-
|
|
383
|
+
.optional()
|
|
384
|
+
.openapi({ example: "CLOSED" }),
|
|
385
|
+
version: z.int().openapi({ example: 2 }),
|
|
283
386
|
});
|
|
284
387
|
|
|
285
388
|
export const NormalizedJobSchema = z.union([
|
|
@@ -289,39 +392,79 @@ export const NormalizedJobSchema = z.union([
|
|
|
289
392
|
]);
|
|
290
393
|
|
|
291
394
|
export const GetCreatedJobsOutputSchema = z.object({
|
|
292
|
-
jobs: z.array(NormalizedJobSchema),
|
|
293
|
-
noOfJobs: z.number(),
|
|
294
|
-
noOfActiveJobs: z.number(),
|
|
295
|
-
noOfArchivedJobs: z.number(),
|
|
395
|
+
jobs: z.array(NormalizedJobSchema).openapi({ example: [] }),
|
|
396
|
+
noOfJobs: z.number().openapi({ example: 45 }),
|
|
397
|
+
noOfActiveJobs: z.number().openapi({ example: 12 }),
|
|
398
|
+
noOfArchivedJobs: z.number().openapi({ example: 33 }),
|
|
296
399
|
});
|
|
297
400
|
|
|
298
401
|
export const GetJobsInputSchema = z.object({
|
|
299
|
-
q: z.string().optional(),
|
|
300
|
-
jobType: z
|
|
402
|
+
q: z.string().optional().openapi({ example: "frontend engineer" }),
|
|
403
|
+
jobType: z
|
|
404
|
+
.enum(Object.values(JOB_TYPE) as [string, ...string[]])
|
|
405
|
+
.optional()
|
|
406
|
+
.openapi({ example: "ROLE" }),
|
|
301
407
|
workMode: z
|
|
302
408
|
.string()
|
|
303
409
|
.optional()
|
|
304
|
-
.describe("Comma-separated values, e.g. 'Remote,Hybrid'")
|
|
410
|
+
.describe("Comma-separated values, e.g. 'Remote,Hybrid'")
|
|
411
|
+
.openapi({ example: "Remote,Hybrid" }),
|
|
305
412
|
location: z
|
|
306
413
|
.enum(Object.values(JOB_LOCATIONS) as [string, ...string[]])
|
|
307
|
-
.optional()
|
|
414
|
+
.optional()
|
|
415
|
+
.openapi({ example: "LAGOS" }),
|
|
308
416
|
employmentType: z
|
|
309
417
|
.string()
|
|
310
418
|
.optional()
|
|
311
|
-
.describe("Comma-separated values, e.g. 'Full Time,Freelance'")
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
419
|
+
.describe("Comma-separated values, e.g. 'Full Time,Freelance'")
|
|
420
|
+
.openapi({ example: "Full Time,Freelance" }),
|
|
421
|
+
gigType: z
|
|
422
|
+
.enum(Object.values(GIG_TYPE) as [string, ...string[]])
|
|
423
|
+
.optional()
|
|
424
|
+
.openapi({ example: "PROJECT_BASED" }),
|
|
425
|
+
requiredSkills: z
|
|
426
|
+
.string()
|
|
427
|
+
.optional()
|
|
428
|
+
.describe("Comma-separated skills")
|
|
429
|
+
.openapi({ example: "React,TypeScript" }),
|
|
430
|
+
status: z.string().optional().openapi({ example: "OPEN" }),
|
|
431
|
+
page: z.coerce.number().min(1).default(1).openapi({ example: 1 }),
|
|
432
|
+
limit: z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
|
|
317
433
|
});
|
|
318
434
|
|
|
319
435
|
export const GetJobsOutputSchema = z.object({
|
|
320
|
-
jobs: z.array(NormalizedJobSchema),
|
|
321
|
-
total: z.number(),
|
|
322
|
-
page: z.number(),
|
|
323
|
-
limit: z.number(),
|
|
324
|
-
totalPages: z.number(),
|
|
325
|
-
hasNextPage: z.boolean(),
|
|
326
|
-
hasPrevPage: z.boolean(),
|
|
436
|
+
jobs: z.array(NormalizedJobSchema).openapi({ example: [] }),
|
|
437
|
+
total: z.number().openapi({ example: 150 }),
|
|
438
|
+
page: z.number().openapi({ example: 1 }),
|
|
439
|
+
limit: z.number().openapi({ example: 20 }),
|
|
440
|
+
totalPages: z.number().openapi({ example: 8 }),
|
|
441
|
+
hasNextPage: z.boolean().openapi({ example: true }),
|
|
442
|
+
hasPrevPage: z.boolean().openapi({ example: false }),
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
export const JobSearchDocumentSchema = z.object({
|
|
448
|
+
id: z.cuid2().openapi({ example: "ckj1a2b3c0000doc" }),
|
|
449
|
+
title: z.string().openapi({ example: "Senior Frontend Engineer" }),
|
|
450
|
+
brandId: z.cuid2().openapi({ example: "ckj1a2b3c0000brnd" }),
|
|
451
|
+
brandName: z.string().openapi({ example: "Acme Corp" }),
|
|
452
|
+
brandImgUrl: z.string().nullable().optional().openapi({ example: "https://example.com/logo.png" }),
|
|
453
|
+
jobType: z.enum(["GIG", "ROLE"]).openapi({ example: "ROLE" }),
|
|
454
|
+
status: z.string().optional().openapi({ example: "OPEN" }),
|
|
455
|
+
employmentType: z.string().nullable().optional().openapi({ example: "FULL_TIME" }),
|
|
456
|
+
workMode: z.string().openapi({ example: "REMOTE" }),
|
|
457
|
+
gigType: z.string().nullable().optional().openapi({ example: "PROJECT_BASED" }),
|
|
458
|
+
location: z.string().openapi({ example: "LAGOS" }),
|
|
459
|
+
overview: z.string().openapi({ example: "Looking for a seasoned engineer to lead our product development." }),
|
|
460
|
+
requiredSkills: z.array(z.string()).openapi({ example: ["React", "TypeScript", "Next.js"] }),
|
|
461
|
+
wagesMin: z.number().nullable().optional().openapi({ example: 80000 }),
|
|
462
|
+
wagesMax: z.number().nullable().optional().openapi({ example: 120000 }),
|
|
463
|
+
wagesCurrency: z.string().nullable().optional().openapi({ example: "USD" }),
|
|
464
|
+
wagesType: z.string().nullable().optional().openapi({ example: "YEARLY" }),
|
|
465
|
+
createdAt: z.string().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
466
|
+
updatedAt: z.string().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
467
|
+
}).openapi({
|
|
468
|
+
title: "Job Search Document",
|
|
469
|
+
description: "Flattened schema used for indexing jobs in search engines.",
|
|
327
470
|
});
|