@zyacreatives/shared 2.2.64 → 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 +16 -16
- package/dist/schemas/job.d.ts +67 -43
- package/dist/schemas/job.js +295 -152
- 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 +273 -130
- 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/user.ts
CHANGED
|
@@ -52,9 +52,9 @@ export const UserEntitySchema = z
|
|
|
52
52
|
.openapi({
|
|
53
53
|
example: "DONE",
|
|
54
54
|
}),
|
|
55
|
-
createdAt: z.coerce.date().openapi({ example: "
|
|
56
|
-
version: z.int(),
|
|
57
|
-
updatedAt: z.coerce.date().openapi({ example: "
|
|
55
|
+
createdAt: z.coerce.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
56
|
+
version: z.int().openapi({ example: 1 }),
|
|
57
|
+
updatedAt: z.coerce.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
58
58
|
})
|
|
59
59
|
.openapi("BaseUserEntity");
|
|
60
60
|
|
|
@@ -68,13 +68,18 @@ export const MinimalUserSchema = UserEntitySchema.pick({
|
|
|
68
68
|
}).openapi("MinimalUser");
|
|
69
69
|
|
|
70
70
|
export const UserStatsEntitySchema = z.object({
|
|
71
|
-
followerCount: z.int(),
|
|
72
|
-
followingCount: z.int(),
|
|
73
|
-
followingIds: z
|
|
71
|
+
followerCount: z.int().openapi({ example: 1540 }),
|
|
72
|
+
followingCount: z.int().openapi({ example: 234 }),
|
|
73
|
+
followingIds: z
|
|
74
|
+
.array(z.cuid2())
|
|
75
|
+
.openapi({ example: ["cksd0v6q0000s9a5y8z7p3x9", "clm1a2b3c0000abc"] }),
|
|
74
76
|
});
|
|
75
77
|
|
|
76
78
|
export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
77
|
-
profileType: z
|
|
79
|
+
profileType: z
|
|
80
|
+
.enum(["creative", "brand", "investor"])
|
|
81
|
+
.optional()
|
|
82
|
+
.openapi({ example: "creative" }),
|
|
78
83
|
brand: BrandEntitySchema,
|
|
79
84
|
creative: CreativeEntitySchema,
|
|
80
85
|
investor: InvestorEntitySchema,
|
|
@@ -82,78 +87,88 @@ export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
|
82
87
|
|
|
83
88
|
export const UserWithProjectsEntitySchema = z
|
|
84
89
|
.object({
|
|
85
|
-
userId: z.cuid2(),
|
|
86
|
-
projects: z
|
|
90
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
91
|
+
projects: z
|
|
92
|
+
.array(ProjectEntitySchema.omit({ overview: true }))
|
|
93
|
+
.openapi({ example: [] }),
|
|
87
94
|
})
|
|
88
95
|
.openapi("UserWithProjectsEntity");
|
|
89
96
|
|
|
90
97
|
export const UserWithProjectLikesEntitySchema = z.object({
|
|
91
|
-
userId: z.cuid2(),
|
|
92
|
-
projectLikes: z
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
99
|
+
projectLikes: z
|
|
100
|
+
.array(
|
|
101
|
+
LikeEntitySchema.extend({
|
|
102
|
+
project: ProjectEntitySchema.pick({
|
|
103
|
+
id: true,
|
|
104
|
+
title: true,
|
|
105
|
+
description: true,
|
|
106
|
+
tags: true,
|
|
107
|
+
startDate: true,
|
|
108
|
+
endDate: true,
|
|
109
|
+
imagePlaceholderUrl: true,
|
|
110
|
+
}),
|
|
102
111
|
}),
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
)
|
|
113
|
+
.openapi({ example: [] }),
|
|
105
114
|
});
|
|
106
115
|
|
|
107
116
|
export const UserWithPostLikesEntitySchema = z.object({
|
|
108
|
-
userId: z.cuid2(),
|
|
109
|
-
postLikes: z
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
118
|
+
postLikes: z
|
|
119
|
+
.array(
|
|
120
|
+
LikeEntitySchema.extend({
|
|
121
|
+
post: PostEntitySchema.pick({
|
|
122
|
+
id: true,
|
|
123
|
+
parentId: true,
|
|
124
|
+
title: true, // Note: Make sure 'title' exists on PostEntitySchema in your post.ts!
|
|
125
|
+
content: true,
|
|
126
|
+
tags: true,
|
|
127
|
+
createdAt: true,
|
|
128
|
+
updatedAt: true, // Note: Make sure 'updatedAt' exists on PostEntitySchema as well!
|
|
129
|
+
}),
|
|
119
130
|
}),
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
)
|
|
132
|
+
.openapi({ example: [] }),
|
|
122
133
|
});
|
|
123
134
|
|
|
124
135
|
export const UserWithPostBookmarksEntitySchema = z.object({
|
|
125
|
-
userId: z.cuid2(),
|
|
126
|
-
postBookmarks: z
|
|
127
|
-
|
|
128
|
-
post: PostEntitySchema.pick({
|
|
129
|
-
id: true,
|
|
130
|
-
parentId: true,
|
|
131
|
-
title: true,
|
|
132
|
-
content: true,
|
|
133
|
-
tags: true,
|
|
134
|
-
createdAt: true,
|
|
135
|
-
updatedAt: true,
|
|
136
|
-
}),
|
|
137
|
-
}),
|
|
138
|
-
),
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
export const UserWithProjectBookmarksEntitySchema = z
|
|
142
|
-
.object({
|
|
143
|
-
userId: z.cuid2(),
|
|
144
|
-
projectBookmarks: z.array(
|
|
136
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
137
|
+
postBookmarks: z
|
|
138
|
+
.array(
|
|
145
139
|
BookmarkEntitySchema.extend({
|
|
146
|
-
|
|
140
|
+
post: PostEntitySchema.pick({
|
|
147
141
|
id: true,
|
|
142
|
+
parentId: true,
|
|
148
143
|
title: true,
|
|
149
|
-
|
|
144
|
+
content: true,
|
|
150
145
|
tags: true,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
imagePlaceholderUrl: true,
|
|
146
|
+
createdAt: true,
|
|
147
|
+
updatedAt: true,
|
|
154
148
|
}),
|
|
155
149
|
}),
|
|
156
|
-
)
|
|
150
|
+
)
|
|
151
|
+
.openapi({ example: [] }),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export const UserWithProjectBookmarksEntitySchema = z
|
|
155
|
+
.object({
|
|
156
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
157
|
+
projectBookmarks: z
|
|
158
|
+
.array(
|
|
159
|
+
BookmarkEntitySchema.extend({
|
|
160
|
+
project: ProjectEntitySchema.pick({
|
|
161
|
+
id: true,
|
|
162
|
+
title: true,
|
|
163
|
+
description: true,
|
|
164
|
+
tags: true,
|
|
165
|
+
startDate: true,
|
|
166
|
+
endDate: true,
|
|
167
|
+
imagePlaceholderUrl: true,
|
|
168
|
+
}),
|
|
169
|
+
}),
|
|
170
|
+
)
|
|
171
|
+
.openapi({ example: [] }),
|
|
157
172
|
})
|
|
158
173
|
.openapi("UserWithProjectBookmarksEntity");
|
|
159
174
|
|
|
@@ -166,116 +181,159 @@ export const GetUserFollowersInputSchema = z.object({
|
|
|
166
181
|
searchQuery: z.string().optional().openapi({ example: "design systems" }),
|
|
167
182
|
offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
168
183
|
});
|
|
184
|
+
|
|
169
185
|
export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
|
|
170
186
|
following: z
|
|
171
187
|
.array(
|
|
172
188
|
MinimalUserSchema.extend({
|
|
173
|
-
isFollowing: z.boolean().optional(),
|
|
174
|
-
followsYou: z.boolean().optional(),
|
|
189
|
+
isFollowing: z.boolean().optional().openapi({ example: true }),
|
|
190
|
+
followsYou: z.boolean().optional().openapi({ example: false }),
|
|
175
191
|
}),
|
|
176
192
|
)
|
|
177
|
-
.openapi({
|
|
193
|
+
.openapi({
|
|
194
|
+
description: "List of users this user is following.",
|
|
195
|
+
example: [],
|
|
196
|
+
}),
|
|
178
197
|
}).openapi("UserWithFollowingEntity");
|
|
179
198
|
|
|
180
199
|
export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
|
|
181
200
|
followers: z
|
|
182
201
|
.array(
|
|
183
202
|
MinimalUserSchema.extend({
|
|
184
|
-
isFollowing: z.boolean().optional(),
|
|
185
|
-
followsYou: z.boolean().optional(),
|
|
203
|
+
isFollowing: z.boolean().optional().openapi({ example: false }),
|
|
204
|
+
followsYou: z.boolean().optional().openapi({ example: true }),
|
|
186
205
|
}),
|
|
187
206
|
)
|
|
188
|
-
.openapi({
|
|
207
|
+
.openapi({
|
|
208
|
+
description: "List of users who follow this user.",
|
|
209
|
+
example: [],
|
|
210
|
+
}),
|
|
189
211
|
}).openapi("UserWithFollowersEntity");
|
|
190
212
|
|
|
191
213
|
export const GetUserFollowersOutputSchema = z.object({
|
|
192
|
-
nextCursor: z.string(),
|
|
193
|
-
followers: z
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
214
|
+
nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
215
|
+
followers: z
|
|
216
|
+
.array(
|
|
217
|
+
MinimalUserSchema.extend({
|
|
218
|
+
isFollowing: z.boolean().optional().openapi({ example: false }),
|
|
219
|
+
followsYou: z.boolean().optional().openapi({ example: true }),
|
|
220
|
+
}),
|
|
221
|
+
)
|
|
222
|
+
.openapi({ example: [] }),
|
|
199
223
|
});
|
|
200
224
|
|
|
201
225
|
export const GetUserFollowingOutputSchema = z.object({
|
|
202
|
-
nextCursor: z.string(),
|
|
203
|
-
following: z
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
226
|
+
nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
227
|
+
following: z
|
|
228
|
+
.array(
|
|
229
|
+
MinimalUserSchema.extend({
|
|
230
|
+
isFollowing: z.boolean().optional().openapi({ example: true }),
|
|
231
|
+
followsYou: z.boolean().optional().openapi({ example: false }),
|
|
232
|
+
}),
|
|
233
|
+
)
|
|
234
|
+
.openapi({ example: [] }),
|
|
209
235
|
});
|
|
210
236
|
|
|
211
237
|
export const UserWithPostsEntitySchema = z
|
|
212
238
|
.object({
|
|
213
|
-
userId: z.cuid2(),
|
|
214
|
-
posts: z.array(PostWithFilesEntitySchema),
|
|
239
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
240
|
+
posts: z.array(PostWithFilesEntitySchema).openapi({ example: [] }),
|
|
215
241
|
})
|
|
216
242
|
.openapi("UserWithPostsEntity");
|
|
217
243
|
|
|
218
244
|
export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
|
|
219
|
-
|
|
220
245
|
export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
|
|
221
|
-
|
|
222
246
|
export const GetAuthenticatedUserWithProjectsOutputSchema =
|
|
223
247
|
UserWithProjectsEntitySchema;
|
|
224
|
-
|
|
225
248
|
export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
|
|
226
249
|
UserWithProjectBookmarksEntitySchema;
|
|
227
|
-
|
|
228
250
|
export const GetAuthenticatedUserWithUserFollowingOutputSchema =
|
|
229
251
|
UserWithFollowingEntitySchema;
|
|
230
|
-
|
|
231
252
|
export const GetAuthenticatedUserWithUserFollowersOutputSchema =
|
|
232
253
|
UserWithFollowersEntitySchema;
|
|
233
|
-
|
|
234
254
|
export const GetAuthenticatedUserWithProjectLikesOutputSchema =
|
|
235
255
|
UserWithProjectLikesEntitySchema;
|
|
236
256
|
|
|
237
257
|
export const GetUserActivityInputSchema = z.object({
|
|
238
|
-
activityType: z
|
|
239
|
-
Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]]
|
|
240
|
-
|
|
258
|
+
activityType: z
|
|
259
|
+
.enum(Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]])
|
|
260
|
+
.openapi({ example: "LIKE" }),
|
|
241
261
|
});
|
|
242
262
|
|
|
243
|
-
export const GetUserActivityOutputSchema = z
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
)
|
|
263
|
+
export const GetUserActivityOutputSchema = z
|
|
264
|
+
.array(
|
|
265
|
+
z.object({
|
|
266
|
+
parentId: z.cuid2().openapi({ example: "ckj1a2b3c0000prt" }),
|
|
267
|
+
parentType: z
|
|
268
|
+
.enum(
|
|
269
|
+
Object.values(ACTIVITY_PARENT_TYPES) as [
|
|
270
|
+
ActivityParentType,
|
|
271
|
+
...ActivityParentType[],
|
|
272
|
+
],
|
|
273
|
+
)
|
|
274
|
+
.openapi({ example: "POST" }),
|
|
275
|
+
}),
|
|
276
|
+
)
|
|
277
|
+
.openapi({ example: [] });
|
|
254
278
|
|
|
255
279
|
export const SearchUsersInputSchema = z.object({
|
|
256
280
|
query: z.string().default("").openapi({
|
|
257
281
|
example: "john",
|
|
258
282
|
description: "Search by name, email, username, or discipline",
|
|
259
283
|
}),
|
|
260
|
-
role: z
|
|
284
|
+
role: z
|
|
285
|
+
.enum(Object.values(ROLES) as [Role, ...Role[]])
|
|
286
|
+
.optional()
|
|
287
|
+
.openapi({ example: "CREATIVE" }),
|
|
261
288
|
limit: z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
|
|
262
289
|
cursor: z.string().optional().openapi({
|
|
263
|
-
example:
|
|
290
|
+
example: "cksd0v6q0000cursor",
|
|
264
291
|
description: "The offset/cursor for pagination",
|
|
265
292
|
}),
|
|
266
293
|
});
|
|
267
294
|
|
|
268
295
|
export const SearchUsersOutputSchema = z.object({
|
|
269
|
-
users: z
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
296
|
+
users: z
|
|
297
|
+
.array(
|
|
298
|
+
MinimalUserSchema.extend({
|
|
299
|
+
isFollowing: z.boolean().optional().openapi({ example: false }),
|
|
300
|
+
followsYou: z.boolean().optional().openapi({ example: true }),
|
|
301
|
+
noOfFollowers: z
|
|
302
|
+
.number()
|
|
303
|
+
.int()
|
|
304
|
+
.nonnegative()
|
|
305
|
+
.optional()
|
|
306
|
+
.openapi({ example: 1200 }),
|
|
307
|
+
disciplines: z
|
|
308
|
+
.array(z.string())
|
|
309
|
+
.optional()
|
|
310
|
+
.openapi({ example: ["UI/UX", "Frontend"] }),
|
|
311
|
+
}),
|
|
312
|
+
)
|
|
313
|
+
.openapi({ example: [] }),
|
|
277
314
|
nextCursor: z.string().optional().openapi({
|
|
278
|
-
example: "
|
|
315
|
+
example: "abc123nxt",
|
|
279
316
|
description: "The next cursor for pagination",
|
|
280
317
|
}),
|
|
281
318
|
});
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
export const UserSearchDocumentSchema = z.object({
|
|
322
|
+
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
323
|
+
email: z.email().openapi({ example: "user@example.com" }),
|
|
324
|
+
username: z.string().nullable().openapi({ example: "johndoe" }),
|
|
325
|
+
name: z.string().nullable().openapi({ example: "John Doe" }),
|
|
326
|
+
image: z.string().nullable().openapi({ example: "https://example.com/avatar.png" }),
|
|
327
|
+
role: z
|
|
328
|
+
.enum(Object.values(ROLES) as [Role, ...Role[]])
|
|
329
|
+
.openapi({ example: "CREATIVE" }),
|
|
330
|
+
bio: z.string().nullable().openapi({ example: "Passionate designer and developer based in Lagos." }),
|
|
331
|
+
location: z.string().nullable().openapi({ example: "Lagos, Nigeria" }),
|
|
332
|
+
disciplines: z.array(z.string()).nullable().openapi({ example: ["Design Systems", "Web Development"] }),
|
|
333
|
+
updatedAt: z.string().nullable().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
334
|
+
createdAt: z.string().nullable().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
335
|
+
}).openapi({
|
|
336
|
+
title: "User Search Document",
|
|
337
|
+
description: "Flattened schema used for indexing users in search engines.",
|
|
338
|
+
});
|
|
339
|
+
|
package/src/types/job.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
GetJobsOutputSchema,
|
|
17
17
|
GetJobsInputSchema,
|
|
18
18
|
GetCreatedJobsOutputSchema,
|
|
19
|
+
JobSearchDocumentSchema,
|
|
19
20
|
} from "../schemas/job";
|
|
20
21
|
|
|
21
22
|
export type BaseJobEntity = z.infer<typeof BaseJobEntitySchema>;
|
|
@@ -63,9 +64,14 @@ export type JobWithRoleDetailsEntity = z.infer<
|
|
|
63
64
|
>;
|
|
64
65
|
|
|
65
66
|
export type GetJobsInput = z.infer<typeof GetJobsInputSchema>;
|
|
67
|
+
|
|
66
68
|
export type GetJobsOutput = z.infer<typeof GetJobsOutputSchema>;
|
|
69
|
+
|
|
67
70
|
export type GetCreatedJobsOutput = z.infer<typeof GetCreatedJobsOutputSchema>;
|
|
71
|
+
|
|
68
72
|
export type NormalizedJobEntity =
|
|
69
73
|
| JobEntity
|
|
70
74
|
| JobWithGigDetailsEntity
|
|
71
75
|
| JobWithRoleDetailsEntity;
|
|
76
|
+
|
|
77
|
+
export type JobSearchDocument = z.infer<typeof JobSearchDocumentSchema>;
|
package/src/types/post.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
PostEntitySchema,
|
|
16
16
|
PostFileEntitySchema,
|
|
17
17
|
PostIdSchema,
|
|
18
|
+
PostSearchDocumentSchema,
|
|
18
19
|
PostWithBookmarksEntitySchema,
|
|
19
20
|
PostWithCommentsEntitySchema,
|
|
20
21
|
PostWithFilesEntitySchema,
|
|
@@ -61,3 +62,5 @@ export type GetPostWithBookmarksOutput = z.infer<
|
|
|
61
62
|
export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
|
|
62
63
|
|
|
63
64
|
export type PostAnalyticsOutput = z.infer<typeof PostAnalyticsOutputSchema>;
|
|
65
|
+
|
|
66
|
+
export type PostSearchDocument = z.infer<typeof PostSearchDocumentSchema>;
|
package/src/types/user.ts
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
SearchUsersOutputSchema,
|
|
27
27
|
UserWithPostBookmarksEntitySchema,
|
|
28
28
|
UserWithPostLikesEntitySchema,
|
|
29
|
+
UserSearchDocumentSchema,
|
|
29
30
|
} from "../schemas/user";
|
|
30
31
|
|
|
31
32
|
import { z } from "@hono/zod-openapi";
|
|
@@ -94,3 +95,4 @@ export type UserStatsEntity = z.infer<typeof UserStatsEntitySchema>;
|
|
|
94
95
|
|
|
95
96
|
export type SearchUsersInput = z.infer<typeof SearchUsersInputSchema>;
|
|
96
97
|
export type SearchUsersOutput = z.infer<typeof SearchUsersOutputSchema>;
|
|
98
|
+
export type UserSearchDocument = z.infer<typeof UserSearchDocumentSchema>;
|