@zyacreatives/shared 2.5.54 → 2.5.56
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/schemas/activity.d.ts +1 -0
- package/dist/schemas/auth.d.ts +2 -0
- package/dist/schemas/bookmark.d.ts +62 -7
- package/dist/schemas/bookmark.js +32 -30
- package/dist/schemas/brand.d.ts +3 -3
- package/dist/schemas/chat.d.ts +96 -52
- package/dist/schemas/chat.js +44 -18
- package/dist/schemas/comment.d.ts +65 -21
- package/dist/schemas/comment.js +48 -54
- package/dist/schemas/common.d.ts +15 -11
- package/dist/schemas/creative.d.ts +3 -3
- package/dist/schemas/discipline.d.ts +63 -12
- package/dist/schemas/discipline.js +62 -65
- package/dist/schemas/entity-stats.d.ts +35 -3
- package/dist/schemas/entity-stats.js +24 -38
- package/dist/schemas/feed.d.ts +50 -3
- package/dist/schemas/feed.js +43 -13
- package/dist/schemas/file.d.ts +65 -24
- package/dist/schemas/file.js +60 -49
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/investor-shortlist.d.ts +68 -11
- package/dist/schemas/investor-shortlist.js +46 -24
- package/dist/schemas/investor-signal.d.ts +52 -12
- package/dist/schemas/investor-signal.js +59 -39
- package/dist/schemas/investor.d.ts +3 -3
- package/dist/schemas/job-application.d.ts +291 -279
- package/dist/schemas/job-application.js +59 -95
- package/dist/schemas/job.d.ts +200 -659
- package/dist/schemas/job.js +98 -231
- package/dist/schemas/like.d.ts +3 -0
- package/dist/schemas/message.d.ts +125 -94
- package/dist/schemas/message.js +54 -55
- package/dist/schemas/notification.d.ts +99 -32
- package/dist/schemas/notification.js +46 -42
- package/dist/schemas/payout-method.d.ts +51 -31
- package/dist/schemas/payout-method.js +48 -58
- package/dist/schemas/post.d.ts +295 -204
- package/dist/schemas/post.js +148 -272
- package/dist/schemas/product.d.ts +308 -229
- package/dist/schemas/product.js +111 -94
- package/dist/schemas/project.d.ts +512 -449
- package/dist/schemas/project.js +144 -102
- package/dist/schemas/seller.d.ts +10 -10
- package/dist/schemas/user-strike.d.ts +3 -0
- package/dist/schemas/user.d.ts +127 -136
- package/dist/schemas/username.d.ts +1 -0
- package/dist/schemas/view.d.ts +1 -0
- package/dist/types/activity.d.ts +1 -3
- package/dist/types/auth.d.ts +1 -4
- package/dist/types/bookmark.d.ts +1 -3
- package/dist/types/chat.d.ts +1 -11
- package/dist/types/comment.d.ts +1 -5
- package/dist/types/common.d.ts +2 -8
- package/dist/types/discipline.d.ts +1 -11
- package/dist/types/entity-stats.d.ts +1 -3
- package/dist/types/feed.d.ts +1 -5
- package/dist/types/investor-shortlist.d.ts +1 -6
- package/dist/types/investor-signal.d.ts +1 -7
- package/dist/types/like.d.ts +1 -3
- package/dist/types/message.d.ts +1 -9
- package/dist/types/notification.d.ts +1 -9
- package/dist/types/user-strike.d.ts +1 -5
- package/dist/types/username.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +4 -5
- package/src/schemas/activity.ts +5 -4
- package/src/schemas/auth.ts +14 -10
- package/src/schemas/bookmark.ts +48 -29
- package/src/schemas/chat.ts +79 -18
- package/src/schemas/comment.ts +63 -49
- package/src/schemas/common.ts +8 -3
- package/src/schemas/discipline.ts +103 -71
- package/src/schemas/entity-stats.ts +32 -38
- package/src/schemas/feed.ts +62 -15
- package/src/schemas/file.ts +85 -58
- package/src/schemas/index.ts +1 -0
- package/src/schemas/investor-shortlist.ts +57 -8
- package/src/schemas/investor-signal.ts +79 -27
- package/src/schemas/job-application.ts +81 -115
- package/src/schemas/job.ts +160 -301
- package/src/schemas/like.ts +5 -1
- package/src/schemas/message.ts +71 -64
- package/src/schemas/notification.ts +63 -51
- package/src/schemas/payout-method.ts +47 -63
- package/src/schemas/post.ts +211 -272
- package/src/schemas/product.ts +202 -139
- package/src/schemas/project.ts +265 -147
- package/src/schemas/user-strike.ts +7 -1
- package/src/schemas/user.ts +2 -6
- package/src/schemas/username.ts +5 -3
- package/src/schemas/view.ts +0 -50
- package/src/types/activity.ts +0 -4
- package/src/types/auth.ts +0 -5
- package/src/types/bookmark.ts +0 -4
- package/src/types/chat.ts +0 -31
- package/src/types/comment.ts +0 -12
- package/src/types/common.ts +0 -14
- package/src/types/discipline.ts +0 -32
- package/src/types/entity-stats.ts +0 -4
- package/src/types/feed.ts +0 -10
- package/src/types/index.ts +0 -16
- package/src/types/investor-shortlist.ts +0 -18
- package/src/types/investor-signal.ts +0 -26
- package/src/types/like.ts +0 -4
- package/src/types/message.ts +0 -26
- package/src/types/notification.ts +0 -34
- package/src/types/user-strike.ts +0 -10
- package/src/types/username.ts +0 -4
package/src/schemas/job.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
EMPLOYMENT_TYPE,
|
|
4
5
|
EmploymentType,
|
|
@@ -21,163 +22,137 @@ import {
|
|
|
21
22
|
WorkMode,
|
|
22
23
|
} from "../constants";
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* --------------------------------
|
|
27
|
+
* ENUMS
|
|
28
|
+
* --------------------------------
|
|
29
|
+
*/
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
const JobTypeSchema = z.enum(
|
|
32
|
+
Object.values(JOB_TYPE) as [JobType, ...JobType[]],
|
|
33
|
+
);
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
|
|
40
|
-
.openapi({ example: "ROLE" }),
|
|
41
|
-
employmentType: z
|
|
42
|
-
.enum(
|
|
43
|
-
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
|
|
44
|
-
)
|
|
45
|
-
.optional()
|
|
46
|
-
.openapi({ example: "FULL_TIME" }),
|
|
47
|
-
workMode: z
|
|
48
|
-
.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
|
|
49
|
-
.openapi({ example: "REMOTE" }),
|
|
50
|
-
status: z
|
|
51
|
-
.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
|
|
52
|
-
.openapi({ example: "OPEN" }),
|
|
53
|
-
gigType: z
|
|
54
|
-
.enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
|
|
55
|
-
.optional()
|
|
56
|
-
.openapi({ example: "PROJECT_BASED" }),
|
|
57
|
-
location: z
|
|
58
|
-
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
59
|
-
.openapi({ example: "LAGOS" }),
|
|
60
|
-
jobSections: z
|
|
61
|
-
.array(JobSectionEnum)
|
|
62
|
-
.default([
|
|
63
|
-
JOB_SECTIONS.PERSONAL_INFORMATION,
|
|
64
|
-
JOB_SECTIONS.PROFESSIONAL_INFORMATION,
|
|
65
|
-
JOB_SECTIONS.RESUME,
|
|
66
|
-
JOB_SECTIONS.COVER_LETTER,
|
|
67
|
-
])
|
|
68
|
-
.openapi({
|
|
69
|
-
example: [
|
|
70
|
-
"PERSONAL_INFORMATION",
|
|
71
|
-
"PROFESSIONAL_INFORMATION",
|
|
72
|
-
"RESUME",
|
|
73
|
-
"COVER_LETTER",
|
|
74
|
-
],
|
|
75
|
-
}),
|
|
76
|
-
createdAt: z.date().openapi({ example: "2026-04-09T12:00:00.000Z" }),
|
|
77
|
-
version: z.number().int().openapi({ example: 1 }),
|
|
78
|
-
updatedAt: z.date().openapi({ example: "2026-04-09T12:00:00.000Z" }),
|
|
79
|
-
});
|
|
35
|
+
const EmploymentTypeSchema = z.enum(
|
|
36
|
+
Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const WorkModeSchema = z.enum(
|
|
40
|
+
Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]],
|
|
41
|
+
);
|
|
80
42
|
|
|
81
|
-
|
|
43
|
+
const JobStatusSchema = z.enum(
|
|
44
|
+
Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const GigTypeSchema = z.enum(
|
|
48
|
+
Object.values(GIG_TYPE) as [GigType, ...GigType[]],
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const LocationSchema = z.enum(
|
|
52
|
+
Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const ExperienceLevelSchema = z.enum(
|
|
56
|
+
Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]],
|
|
57
|
+
);
|
|
82
58
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
59
|
+
const WageCurrencySchema = z.enum(
|
|
60
|
+
Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const WageTypeSchema = z.enum(
|
|
64
|
+
Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]],
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* --------------------------------
|
|
69
|
+
* SHAPE
|
|
70
|
+
* --------------------------------
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
const JobShape = z.object({
|
|
74
|
+
title: z.string().min(3).max(255),
|
|
75
|
+
brandId: z.cuid2(),
|
|
76
|
+
jobType: JobTypeSchema,
|
|
77
|
+
employmentType: EmploymentTypeSchema.optional(),
|
|
78
|
+
workMode: WorkModeSchema,
|
|
79
|
+
gigType: GigTypeSchema.optional(),
|
|
80
|
+
location: LocationSchema,
|
|
81
|
+
jobSections: z.array(
|
|
82
|
+
z.enum(Object.values(JOB_SECTIONS) as [string, ...string[]]),
|
|
83
|
+
),
|
|
91
84
|
});
|
|
92
85
|
|
|
86
|
+
export type JobShapeType = z.infer<typeof JobShape>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* --------------------------------
|
|
90
|
+
* BASE ENTITY
|
|
91
|
+
* --------------------------------
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
export const JobEntitySchema = z
|
|
95
|
+
.object({
|
|
96
|
+
id: z.cuid2(),
|
|
97
|
+
...JobShape.shape,
|
|
98
|
+
|
|
99
|
+
status: JobStatusSchema,
|
|
100
|
+
|
|
101
|
+
brandName: z.string(),
|
|
102
|
+
brandImgUrl: z.string().nullable().optional(),
|
|
103
|
+
|
|
104
|
+
isApplied: z.boolean().default(false),
|
|
105
|
+
isBookmarked: z.boolean(),
|
|
106
|
+
|
|
107
|
+
createdAt: z.iso.datetime(),
|
|
108
|
+
updatedAt: z.iso.datetime(),
|
|
109
|
+
version: z.int(),
|
|
110
|
+
})
|
|
111
|
+
.openapi("Job");
|
|
112
|
+
|
|
93
113
|
export type JobEntity = z.infer<typeof JobEntitySchema>;
|
|
94
114
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
employeeRequirements: z
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
.openapi({ example: "A fast-growing fintech startup." }),
|
|
112
|
-
requiredSkills: z
|
|
113
|
-
.array(z.string())
|
|
114
|
-
.openapi({ example: ["Figma", "UI Design"] }),
|
|
115
|
-
wagesMin: z.number().optional().nullable().openapi({ example: 500 }),
|
|
116
|
-
wagesMax: z.number().optional().nullable().openapi({ example: 1000 }),
|
|
117
|
-
wagesCurrency: z
|
|
118
|
-
.enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
|
|
119
|
-
.optional()
|
|
120
|
-
.openapi({ example: "USD" }),
|
|
121
|
-
wagesType: z
|
|
122
|
-
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
123
|
-
.optional()
|
|
124
|
-
.openapi({ example: "FIXED" }),
|
|
115
|
+
/**
|
|
116
|
+
* --------------------------------
|
|
117
|
+
* ROLE / GIG DETAILS
|
|
118
|
+
* --------------------------------
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
const GigDetailsSchema = z.object({
|
|
122
|
+
overview: z.string(),
|
|
123
|
+
deliverables: z.string(),
|
|
124
|
+
employeeRequirements: z.string().optional(),
|
|
125
|
+
aboutCompany: z.string().optional(),
|
|
126
|
+
requiredSkills: z.array(z.string()),
|
|
127
|
+
wagesMin: z.number().nullable().optional(),
|
|
128
|
+
wagesMax: z.number().nullable().optional(),
|
|
129
|
+
wagesCurrency: WageCurrencySchema.optional(),
|
|
130
|
+
wagesType: WageTypeSchema.optional(),
|
|
125
131
|
});
|
|
126
132
|
|
|
127
|
-
|
|
133
|
+
const RoleDetailsSchema = z.object({
|
|
134
|
+
experienceLevel: ExperienceLevelSchema,
|
|
135
|
+
overview: z.string(),
|
|
136
|
+
keyResponsibilities: z.string(),
|
|
137
|
+
requiredSkills: z.array(z.string()),
|
|
138
|
+
employeeRequirements: z.string().optional(),
|
|
139
|
+
companyBenefits: z.string().optional(),
|
|
140
|
+
wagesMin: z.number().nullable().optional(),
|
|
141
|
+
wagesMax: z.number().nullable().optional(),
|
|
142
|
+
wagesCurrency: WageCurrencySchema.optional(),
|
|
143
|
+
wagesType: WageTypeSchema.optional(),
|
|
144
|
+
});
|
|
128
145
|
|
|
129
146
|
export const JobWithGigDetailsEntitySchema = JobEntitySchema.extend(
|
|
130
|
-
|
|
147
|
+
GigDetailsSchema.shape,
|
|
131
148
|
);
|
|
132
149
|
|
|
133
150
|
export type JobWithGigDetailsEntity = z.infer<
|
|
134
151
|
typeof JobWithGigDetailsEntitySchema
|
|
135
152
|
>;
|
|
136
153
|
|
|
137
|
-
export const RoleJobEntitySchema = z.object({
|
|
138
|
-
id: z.cuid2().openapi({ example: "ckj1a2b3c0000rol1" }),
|
|
139
|
-
jobType: z.literal(JOB_TYPE.ROLE).openapi({ example: "ROLE" }),
|
|
140
|
-
experienceLevel: z
|
|
141
|
-
.enum(
|
|
142
|
-
Object.values(EXPERIENCE_LEVELS) as [
|
|
143
|
-
ExperienceLevel,
|
|
144
|
-
...ExperienceLevel[],
|
|
145
|
-
],
|
|
146
|
-
)
|
|
147
|
-
.openapi({ example: "SENIOR" }),
|
|
148
|
-
overview: z
|
|
149
|
-
.string()
|
|
150
|
-
.openapi({ example: "Lead the development of our core product." }),
|
|
151
|
-
keyResponsibilities: z
|
|
152
|
-
.string()
|
|
153
|
-
.openapi({ example: "Architect systems, mentor juniors." }),
|
|
154
|
-
requiredSkills: z
|
|
155
|
-
.array(z.string())
|
|
156
|
-
.openapi({ example: ["React", "TypeScript", "Node.js"] }),
|
|
157
|
-
employeeRequirements: z
|
|
158
|
-
.string()
|
|
159
|
-
.optional()
|
|
160
|
-
.openapi({ example: "BS in Computer Science." }),
|
|
161
|
-
companyBenefits: z
|
|
162
|
-
.string()
|
|
163
|
-
.optional()
|
|
164
|
-
.openapi({ example: "Health insurance, remote work." }),
|
|
165
|
-
wagesMin: z.number().optional().nullable().openapi({ example: 80000 }),
|
|
166
|
-
wagesMax: z.number().optional().nullable().openapi({ example: 120000 }),
|
|
167
|
-
wagesCurrency: z
|
|
168
|
-
.enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
|
|
169
|
-
.optional()
|
|
170
|
-
.openapi({ example: "USD" }),
|
|
171
|
-
wagesType: z
|
|
172
|
-
.enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
|
|
173
|
-
.optional()
|
|
174
|
-
.openapi({ example: "YEARLY" }),
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
export type RoleJobEntity = z.infer<typeof RoleJobEntitySchema>;
|
|
178
|
-
|
|
179
154
|
export const JobWithRoleDetailsEntitySchema = JobEntitySchema.extend(
|
|
180
|
-
|
|
155
|
+
RoleDetailsSchema.shape,
|
|
181
156
|
);
|
|
182
157
|
|
|
183
158
|
export type JobWithRoleDetailsEntity = z.infer<
|
|
@@ -192,124 +167,54 @@ export const NormalizedJobSchema = z.union([
|
|
|
192
167
|
|
|
193
168
|
export type NormalizedJobEntity = z.infer<typeof NormalizedJobSchema>;
|
|
194
169
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
jobType
|
|
203
|
-
.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
.optional()
|
|
217
|
-
.openapi({ example: "PROJECT_BASED" }),
|
|
218
|
-
location: z
|
|
219
|
-
.enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
|
|
220
|
-
.default(JOB_LOCATIONS.REMOTE)
|
|
221
|
-
.openapi({ example: "REMOTE" }),
|
|
222
|
-
jobSections: z
|
|
223
|
-
.array(JobSectionEnum)
|
|
224
|
-
.min(1, { message: "At least one job section must be provided." })
|
|
225
|
-
.openapi({ example: ["PERSONAL_INFORMATION", "RESUME"] }),
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
export const CreateJobInputSchema = CreateJobInputBaseSchema.superRefine(
|
|
229
|
-
(data, ctx) => {
|
|
230
|
-
if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
|
|
231
|
-
ctx.addIssue({
|
|
232
|
-
path: ["employmentType"],
|
|
233
|
-
code: "custom",
|
|
234
|
-
message: "employmentType is required for ROLE jobs",
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
|
|
238
|
-
ctx.addIssue({
|
|
239
|
-
path: ["gigType"],
|
|
240
|
-
code: "custom",
|
|
241
|
-
message: "gigType is required for GIG jobs",
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
).transform((data) => {
|
|
246
|
-
if (data.jobType === JOB_TYPE.ROLE) return { ...data, gigType: undefined };
|
|
247
|
-
if (data.jobType === JOB_TYPE.GIG)
|
|
248
|
-
return { ...data, employmentType: undefined };
|
|
249
|
-
return data;
|
|
170
|
+
/**
|
|
171
|
+
* --------------------------------
|
|
172
|
+
* INPUTS
|
|
173
|
+
* --------------------------------
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
export const CreateJobInputSchema = JobShape.superRefine((data, ctx) => {
|
|
177
|
+
if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
path: ["employmentType"],
|
|
180
|
+
code: "custom",
|
|
181
|
+
message: "employmentType is required for ROLE jobs",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
|
|
185
|
+
ctx.addIssue({
|
|
186
|
+
path: ["gigType"],
|
|
187
|
+
code: "custom",
|
|
188
|
+
message: "gigType is required for GIG jobs",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
250
191
|
});
|
|
251
192
|
|
|
252
193
|
export type CreateJobInput = z.infer<typeof CreateJobInputSchema>;
|
|
253
194
|
|
|
254
|
-
export const
|
|
255
|
-
id:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
.extend({ id: z.cuid2() })
|
|
259
|
-
.refine(
|
|
260
|
-
({ wagesMin, wagesMax }) =>
|
|
261
|
-
wagesMin == null || wagesMax == null || wagesMax > wagesMin,
|
|
262
|
-
{
|
|
263
|
-
message: "wagesMax must be greater than wagesMin",
|
|
264
|
-
path: ["wagesMax"],
|
|
265
|
-
},
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
export type CreateRoleJobInput = z.infer<typeof CreateRoleJobInputSchema>;
|
|
269
|
-
|
|
270
|
-
export const CreateGigJobInputSchema = GigJobEntitySchema.omit({
|
|
271
|
-
id: true,
|
|
272
|
-
jobType: true,
|
|
273
|
-
})
|
|
274
|
-
.extend({ id: z.cuid2() })
|
|
275
|
-
.refine(
|
|
276
|
-
({ wagesMin, wagesMax }) =>
|
|
277
|
-
wagesMin == null || wagesMax == null || wagesMax > wagesMin,
|
|
278
|
-
{
|
|
279
|
-
message: "wagesMax must be greater than wagesMin",
|
|
280
|
-
path: ["wagesMax"],
|
|
281
|
-
},
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
export type CreateGigJobInput = z.infer<typeof CreateGigJobInputSchema>;
|
|
285
|
-
|
|
286
|
-
export const UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
|
|
287
|
-
id: z.cuid2().openapi({ example: "ckj1a2b3c0000job1" }),
|
|
288
|
-
status: z
|
|
289
|
-
.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
|
|
290
|
-
.optional(),
|
|
291
|
-
version: z.number().int().openapi({ example: 2 }),
|
|
195
|
+
export const UpdateJobInputSchema = CreateJobInputSchema.partial().extend({
|
|
196
|
+
id: z.cuid2(),
|
|
197
|
+
status: JobStatusSchema.optional(),
|
|
198
|
+
version: z.int(),
|
|
292
199
|
});
|
|
293
200
|
|
|
294
201
|
export type UpdateJobInput = z.infer<typeof UpdateJobInputSchema>;
|
|
295
202
|
|
|
296
203
|
export const GetJobsInputSchema = z.object({
|
|
297
|
-
q: z.string().optional()
|
|
298
|
-
jobType:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
.enum(Object.values(JOB_LOCATIONS) as [string, ...string[]])
|
|
302
|
-
.optional(),
|
|
303
|
-
employmentType: z.string().optional().describe("Comma-separated values"),
|
|
304
|
-
gigType: z.enum(Object.values(GIG_TYPE) as [string, ...string[]]).optional(),
|
|
305
|
-
requiredSkills: z.string().optional().describe("Comma-separated skills"),
|
|
306
|
-
status: z.string().optional(),
|
|
307
|
-
page: z.coerce.number().int().min(1).default(1),
|
|
308
|
-
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
204
|
+
q: z.string().optional(),
|
|
205
|
+
jobType: JobTypeSchema.optional(),
|
|
206
|
+
page: z.coerce.number().min(1).default(1),
|
|
207
|
+
limit: z.coerce.number().min(1).max(100).default(20),
|
|
309
208
|
});
|
|
310
209
|
|
|
311
210
|
export type GetJobsInput = z.infer<typeof GetJobsInputSchema>;
|
|
312
211
|
|
|
212
|
+
/**
|
|
213
|
+
* --------------------------------
|
|
214
|
+
* OUTPUTS
|
|
215
|
+
* --------------------------------
|
|
216
|
+
*/
|
|
217
|
+
|
|
313
218
|
export const GetJobsOutputSchema = z.object({
|
|
314
219
|
jobs: z.array(NormalizedJobSchema),
|
|
315
220
|
total: z.number(),
|
|
@@ -322,64 +227,18 @@ export const GetJobsOutputSchema = z.object({
|
|
|
322
227
|
|
|
323
228
|
export type GetJobsOutput = z.infer<typeof GetJobsOutputSchema>;
|
|
324
229
|
|
|
325
|
-
export const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
230
|
+
export const JobSearchDocumentSchema = z.object({
|
|
231
|
+
id: z.cuid2(),
|
|
232
|
+
title: z.string(),
|
|
233
|
+
brandId: z.cuid2(),
|
|
234
|
+
brandName: z.string(),
|
|
235
|
+
brandImgUrl: z.string().nullable().optional(),
|
|
236
|
+
jobType: z.enum(["GIG", "ROLE"]),
|
|
237
|
+
location: z.string(),
|
|
238
|
+
overview: z.string(),
|
|
239
|
+
requiredSkills: z.array(z.string()),
|
|
240
|
+
createdAt: z.iso.datetime(),
|
|
241
|
+
updatedAt: z.iso.datetime(),
|
|
330
242
|
});
|
|
331
243
|
|
|
332
|
-
export type GetCreatedJobsOutput = z.infer<typeof GetCreatedJobsOutputSchema>;
|
|
333
|
-
|
|
334
|
-
export const JobSearchDocumentSchema = z
|
|
335
|
-
.object({
|
|
336
|
-
id: z.cuid2(),
|
|
337
|
-
title: z.string(),
|
|
338
|
-
isApplied: z.boolean().default(false).optional(),
|
|
339
|
-
brandId: z.cuid2(),
|
|
340
|
-
brandName: z.string(),
|
|
341
|
-
brandImgUrl: z.string().nullable().optional(),
|
|
342
|
-
jobType: z.enum(["GIG", "ROLE"]),
|
|
343
|
-
status: z.string().optional(),
|
|
344
|
-
employmentType: z.string().nullable().optional(),
|
|
345
|
-
workMode: z.string(),
|
|
346
|
-
gigType: z.string().nullable().optional(),
|
|
347
|
-
location: z.string(),
|
|
348
|
-
overview: z.string(),
|
|
349
|
-
requiredSkills: z.array(z.string()),
|
|
350
|
-
wagesMin: z.number().nullable().optional(),
|
|
351
|
-
wagesMax: z.number().nullable().optional(),
|
|
352
|
-
wagesCurrency: z.string().nullable().optional(),
|
|
353
|
-
wagesType: z.string().nullable().optional(),
|
|
354
|
-
createdAt: z.string(),
|
|
355
|
-
updatedAt: z.string(),
|
|
356
|
-
})
|
|
357
|
-
.openapi("JobSearchDocument");
|
|
358
|
-
|
|
359
244
|
export type JobSearchDocument = z.infer<typeof JobSearchDocumentSchema>;
|
|
360
|
-
|
|
361
|
-
export const UpdateRoleJobInputSchema = CreateRoleJobInputSchema.partial()
|
|
362
|
-
.extend({
|
|
363
|
-
version: z.number().int().openapi({ example: 2 }),
|
|
364
|
-
})
|
|
365
|
-
.required({
|
|
366
|
-
id: true,
|
|
367
|
-
});
|
|
368
|
-
export type CreateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
369
|
-
export type CreateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
370
|
-
|
|
371
|
-
export type UpdateRoleJobInput = z.infer<typeof UpdateRoleJobInputSchema>;
|
|
372
|
-
|
|
373
|
-
export const UpdateGigJobInputSchema = CreateGigJobInputSchema.partial()
|
|
374
|
-
.extend({
|
|
375
|
-
version: z.number().int().openapi({ example: 2 }),
|
|
376
|
-
})
|
|
377
|
-
.required({
|
|
378
|
-
id: true,
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
export type UpdateGigJobInput = z.infer<typeof UpdateGigJobInputSchema>;
|
|
382
|
-
|
|
383
|
-
export type UpdateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
384
|
-
|
|
385
|
-
export type UpdateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
package/src/schemas/like.ts
CHANGED
|
@@ -35,4 +35,8 @@ export const LikeInputSchema = z.object({
|
|
|
35
35
|
userId: z.string(),
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
export const LikeOutputSchema = LikeEntitySchema;
|
|
38
|
+
export const LikeOutputSchema = LikeEntitySchema;
|
|
39
|
+
|
|
40
|
+
export type LikeEntity = z.infer<typeof LikeEntitySchema>;
|
|
41
|
+
export type LikeInput = z.infer<typeof LikeInputSchema>;
|
|
42
|
+
export type LikeOutput = z.infer<typeof LikeOutputSchema>;
|