@zyacreatives/shared 2.5.49 → 2.5.51
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/brand.d.ts +134 -109
- package/dist/schemas/brand.js +49 -112
- package/dist/schemas/common.d.ts +25 -0
- package/dist/schemas/common.js +30 -1
- package/dist/schemas/creative.d.ts +224 -150
- package/dist/schemas/creative.js +91 -170
- package/dist/schemas/investor.d.ts +362 -261
- package/dist/schemas/investor.js +111 -211
- package/dist/schemas/job-application.d.ts +6 -6
- package/dist/schemas/notification.d.ts +12 -12
- package/dist/schemas/project.d.ts +20 -20
- package/dist/schemas/user.d.ts +265 -1161
- package/dist/schemas/user.js +141 -252
- package/package.json +1 -1
- package/src/schemas/brand.ts +73 -129
- package/src/schemas/common.ts +32 -0
- package/src/schemas/creative.ts +118 -187
- package/src/schemas/investor.ts +154 -278
- package/src/schemas/user.ts +186 -438
package/src/schemas/user.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ACTIVITY_TYPES,
|
|
8
8
|
ACTIVITY_PARENT_TYPES,
|
|
9
9
|
} from "../constants";
|
|
10
|
+
|
|
10
11
|
import type {
|
|
11
12
|
Role,
|
|
12
13
|
UserStatus,
|
|
@@ -26,48 +27,55 @@ import {
|
|
|
26
27
|
PostEntitySchema,
|
|
27
28
|
PostWithFilesEntitySchema,
|
|
28
29
|
} from "./post";
|
|
29
|
-
import {
|
|
30
|
+
import { JobSearchDocumentSchema } from "./job";
|
|
30
31
|
import { ProductEntitySchema } from "./product";
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* --------------------------------
|
|
35
|
+
* SHAPE
|
|
36
|
+
* --------------------------------
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
const UserShape = z.object({
|
|
40
|
+
email: z.email(),
|
|
41
|
+
emailVerified: z.boolean(),
|
|
42
|
+
name: z.string().default(""),
|
|
43
|
+
image: z.string().default(""),
|
|
44
|
+
username: z.string().default(""),
|
|
45
|
+
displayUsername: z.string().default(""),
|
|
46
|
+
role: z.enum(Object.values(ROLES) as [Role, ...Role[]]),
|
|
47
|
+
status: z.enum(Object.values(USER_STATUSES) as [UserStatus, ...UserStatus[]]),
|
|
48
|
+
onboardingPage: z.enum(
|
|
49
|
+
Object.values(ONBOARDING_PAGES) as [OnboardingPage, ...OnboardingPage[]],
|
|
50
|
+
),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
type UserShapeType = z.infer<typeof UserShape>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* --------------------------------
|
|
57
|
+
* BASE ENTITY
|
|
58
|
+
* --------------------------------
|
|
59
|
+
*/
|
|
60
|
+
|
|
32
61
|
export const UserEntitySchema = z
|
|
33
62
|
.object({
|
|
34
|
-
id: z.cuid2()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.string()
|
|
40
|
-
.optional()
|
|
41
|
-
.openapi({ example: "https://example.com/avatar.png" }),
|
|
42
|
-
username: z.string().optional().openapi({ example: "johndoe" }),
|
|
43
|
-
displayUsername: z.string().optional().openapi({ example: "@johndoe" }),
|
|
44
|
-
role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).openapi({
|
|
45
|
-
example: "CREATIVE",
|
|
46
|
-
}),
|
|
47
|
-
status: z
|
|
48
|
-
.enum(Object.values(USER_STATUSES) as [UserStatus, ...UserStatus[]])
|
|
49
|
-
.openapi({
|
|
50
|
-
example: "ACTIVE",
|
|
51
|
-
}),
|
|
52
|
-
onboardingPage: z
|
|
53
|
-
.enum(
|
|
54
|
-
Object.values(ONBOARDING_PAGES) as [
|
|
55
|
-
OnboardingPage,
|
|
56
|
-
...OnboardingPage[],
|
|
57
|
-
],
|
|
58
|
-
)
|
|
59
|
-
.openapi({
|
|
60
|
-
example: "DONE",
|
|
61
|
-
}),
|
|
62
|
-
createdAt: z.coerce.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
63
|
-
version: z.int().openapi({ example: 1 }),
|
|
64
|
-
updatedAt: z.coerce.date().openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
63
|
+
id: z.cuid2(),
|
|
64
|
+
...UserShape.shape,
|
|
65
|
+
createdAt: z.iso.datetime(),
|
|
66
|
+
updatedAt: z.iso.datetime(),
|
|
67
|
+
version: z.int(),
|
|
65
68
|
})
|
|
66
|
-
.openapi("
|
|
69
|
+
.openapi("User");
|
|
67
70
|
|
|
68
|
-
export type BaseUserEntity = z.infer<typeof UserEntitySchema>;
|
|
69
71
|
export type UserEntity = z.infer<typeof UserEntitySchema>;
|
|
70
72
|
|
|
73
|
+
/**
|
|
74
|
+
* --------------------------------
|
|
75
|
+
* DERIVED ENTITIES
|
|
76
|
+
* --------------------------------
|
|
77
|
+
*/
|
|
78
|
+
|
|
71
79
|
export const MinimalUserSchema = UserEntitySchema.pick({
|
|
72
80
|
id: true,
|
|
73
81
|
name: true,
|
|
@@ -80,377 +88,139 @@ export const MinimalUserSchema = UserEntitySchema.pick({
|
|
|
80
88
|
export type MinimalUser = z.infer<typeof MinimalUserSchema>;
|
|
81
89
|
|
|
82
90
|
export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
83
|
-
profileType: z
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
creative: CreativeEntitySchema,
|
|
89
|
-
investor: InvestorEntitySchema,
|
|
90
|
-
}).openapi("UserProfileEntity");
|
|
91
|
+
profileType: z.enum(["creative", "brand", "investor"]).optional(),
|
|
92
|
+
brand: BrandEntitySchema.optional(),
|
|
93
|
+
creative: CreativeEntitySchema.optional(),
|
|
94
|
+
investor: InvestorEntitySchema.optional(),
|
|
95
|
+
}).openapi("UserProfile");
|
|
91
96
|
|
|
92
97
|
export type UserProfileEntity = z.infer<typeof UserProfileEntitySchema>;
|
|
93
98
|
|
|
94
99
|
export const UserStatsEntitySchema = z.object({
|
|
95
|
-
followerCount: z.int()
|
|
96
|
-
followingCount: z.int()
|
|
97
|
-
followingIds: z
|
|
98
|
-
.array(z.cuid2())
|
|
99
|
-
.openapi({ example: ["cksd0v6q0000s9a5y8z7p3x9", "clm1a2b3c0000abc"] }),
|
|
100
|
+
followerCount: z.int(),
|
|
101
|
+
followingCount: z.int(),
|
|
102
|
+
followingIds: z.array(z.cuid2()),
|
|
100
103
|
});
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
projects: z
|
|
108
|
-
.array(ProjectEntitySchema.omit({ overview: true }))
|
|
109
|
-
.openapi({ example: [] }),
|
|
110
|
-
})
|
|
111
|
-
.openapi("UserWithProjectsEntity");
|
|
112
|
-
|
|
113
|
-
export type UserWithProjectsEntity = z.infer<
|
|
114
|
-
typeof UserWithProjectsEntitySchema
|
|
115
|
-
>;
|
|
105
|
+
/**
|
|
106
|
+
* --------------------------------
|
|
107
|
+
* COMPOSED ENTITIES
|
|
108
|
+
* --------------------------------
|
|
109
|
+
*/
|
|
116
110
|
|
|
117
|
-
|
|
118
|
-
.object({
|
|
119
|
-
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
120
|
-
posts: z.array(PostWithFilesEntitySchema).openapi({ example: [] }),
|
|
121
|
-
})
|
|
122
|
-
.openapi("UserWithPostsEntity");
|
|
111
|
+
const UserWithId = z.object({ userId: z.cuid2() });
|
|
123
112
|
|
|
124
|
-
export
|
|
125
|
-
|
|
126
|
-
export const UserAuthStatusEntitySchema = z.object({
|
|
127
|
-
exists: z.boolean(),
|
|
128
|
-
isOAuthOnly: z.boolean(),
|
|
129
|
-
providers: z.array(z.string()),
|
|
113
|
+
export const UserWithProjectsEntitySchema = UserWithId.extend({
|
|
114
|
+
projects: z.array(ProjectEntitySchema.omit({ overview: true })),
|
|
130
115
|
});
|
|
131
116
|
|
|
132
|
-
export
|
|
133
|
-
|
|
134
|
-
export const UserWithProjectLikesEntitySchema = z.object({
|
|
135
|
-
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
136
|
-
projectLikes: z
|
|
137
|
-
.array(
|
|
138
|
-
LikeEntitySchema.extend({
|
|
139
|
-
project: ProjectEntitySchema.pick({
|
|
140
|
-
id: true,
|
|
141
|
-
title: true,
|
|
142
|
-
description: true,
|
|
143
|
-
tags: true,
|
|
144
|
-
startDate: true,
|
|
145
|
-
endDate: true,
|
|
146
|
-
imagePlaceholderUrl: true,
|
|
147
|
-
}),
|
|
148
|
-
}),
|
|
149
|
-
)
|
|
150
|
-
.openapi({ example: [] }),
|
|
117
|
+
export const UserWithPostsEntitySchema = UserWithId.extend({
|
|
118
|
+
posts: z.array(PostWithFilesEntitySchema),
|
|
151
119
|
});
|
|
152
120
|
|
|
153
|
-
export
|
|
154
|
-
|
|
155
|
-
>;
|
|
156
|
-
|
|
157
|
-
export const UserWithPostLikesEntitySchema = z.object({
|
|
158
|
-
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
159
|
-
postLikes: z
|
|
160
|
-
.array(
|
|
161
|
-
LikeEntitySchema.extend({
|
|
162
|
-
post: PostEntitySchema.pick({
|
|
163
|
-
id: true,
|
|
164
|
-
parentId: true,
|
|
165
|
-
title: true,
|
|
166
|
-
content: true,
|
|
167
|
-
tags: true,
|
|
168
|
-
createdAt: true,
|
|
169
|
-
updatedAt: true,
|
|
170
|
-
}),
|
|
171
|
-
}),
|
|
172
|
-
)
|
|
173
|
-
.openapi({ example: [] }),
|
|
121
|
+
export const UserWithProductsEntitySchema = UserWithId.extend({
|
|
122
|
+
products: z.array(ProductEntitySchema),
|
|
174
123
|
});
|
|
175
124
|
|
|
176
|
-
export
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}),
|
|
125
|
+
export const UserWithProjectLikesEntitySchema = UserWithId.extend({
|
|
126
|
+
projectLikes: z.array(
|
|
127
|
+
LikeEntitySchema.extend({
|
|
128
|
+
project: ProjectEntitySchema.pick({
|
|
129
|
+
id: true,
|
|
130
|
+
title: true,
|
|
131
|
+
description: true,
|
|
132
|
+
tags: true,
|
|
133
|
+
startDate: true,
|
|
134
|
+
endDate: true,
|
|
135
|
+
imagePlaceholderUrl: true,
|
|
188
136
|
}),
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
export type UserWithJobBookmarksEntity = z.infer<
|
|
194
|
-
typeof UserWithJobBookmarksEntitySchema
|
|
195
|
-
>;
|
|
196
|
-
|
|
197
|
-
export const UserWithJobBookmarksInputSchema = z.object({
|
|
198
|
-
cursor: z.string().optional().nullable(),
|
|
199
|
-
limit: z.int().positive().optional().nullable(),
|
|
137
|
+
}),
|
|
138
|
+
),
|
|
200
139
|
});
|
|
201
140
|
|
|
202
|
-
export
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
141
|
+
export const UserWithPostLikesEntitySchema = UserWithId.extend({
|
|
142
|
+
postLikes: z.array(
|
|
143
|
+
LikeEntitySchema.extend({
|
|
144
|
+
post: PostEntitySchema.pick({
|
|
145
|
+
id: true,
|
|
146
|
+
parentId: true,
|
|
147
|
+
title: true,
|
|
148
|
+
content: true,
|
|
149
|
+
tags: true,
|
|
150
|
+
createdAt: true,
|
|
151
|
+
updatedAt: true,
|
|
152
|
+
}),
|
|
153
|
+
}),
|
|
154
|
+
),
|
|
209
155
|
});
|
|
210
156
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
.object({
|
|
217
|
-
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
218
|
-
projectBookmarks: z
|
|
219
|
-
.array(
|
|
220
|
-
BookmarkEntitySchema.extend({
|
|
221
|
-
project: ProjectSearchDocumentSchema,
|
|
222
|
-
}),
|
|
223
|
-
)
|
|
224
|
-
.openapi({ example: [] }),
|
|
225
|
-
})
|
|
226
|
-
.openapi("UserWithProjectBookmarksEntity");
|
|
227
|
-
|
|
228
|
-
export type UserWithProjectBookmarksEntity = z.infer<
|
|
229
|
-
typeof UserWithProjectBookmarksEntitySchema
|
|
230
|
-
>;
|
|
157
|
+
/**
|
|
158
|
+
* --------------------------------
|
|
159
|
+
* BOOKMARKS
|
|
160
|
+
* --------------------------------
|
|
161
|
+
*/
|
|
231
162
|
|
|
232
|
-
export const
|
|
233
|
-
|
|
234
|
-
postBookmarks: z.array(
|
|
163
|
+
export const UserWithJobBookmarksEntitySchema = UserWithId.extend({
|
|
164
|
+
jobBookmarks: z.array(
|
|
235
165
|
BookmarkEntitySchema.extend({
|
|
236
|
-
|
|
166
|
+
job: JobSearchDocumentSchema.extend({
|
|
167
|
+
isBookmarked: z.boolean().default(true),
|
|
168
|
+
}),
|
|
237
169
|
}),
|
|
238
170
|
),
|
|
239
171
|
});
|
|
240
172
|
|
|
241
|
-
export
|
|
242
|
-
|
|
243
|
-
>;
|
|
244
|
-
|
|
245
|
-
export const UserWithProductsEntitySchema = z.object({
|
|
246
|
-
userId: z.cuid2(),
|
|
247
|
-
products: z.array(ProductEntitySchema),
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
export type UserWithProductsEntity = z.infer<
|
|
251
|
-
typeof UserWithProductsEntitySchema
|
|
252
|
-
>;
|
|
253
|
-
|
|
254
|
-
export const GetUserWithProjectBookmarksInputSchema =
|
|
255
|
-
UserWithJobBookmarksInputSchema;
|
|
256
|
-
|
|
257
|
-
export type GetUserWithProjectBookmarksInput = z.infer<
|
|
258
|
-
typeof GetUserWithProjectBookmarksInputSchema
|
|
259
|
-
>;
|
|
260
|
-
|
|
261
|
-
export const GetUserWithPostBookmarksInputSchema =
|
|
262
|
-
UserWithJobBookmarksInputSchema;
|
|
263
|
-
|
|
264
|
-
export type GetUserWithPostBookmarksInput = z.infer<
|
|
265
|
-
typeof GetUserWithPostBookmarksInputSchema
|
|
266
|
-
>;
|
|
267
|
-
|
|
268
|
-
export const GetUserWithProjectBookmarksOutputSchema = z.object({
|
|
269
|
-
bookmarks: UserWithProjectBookmarksEntitySchema,
|
|
270
|
-
nextCursor: z.string().nullable(),
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
export type GetUserWithProjectBookmarksOutput = z.infer<
|
|
274
|
-
typeof GetUserWithProjectBookmarksOutputSchema
|
|
275
|
-
>;
|
|
276
|
-
|
|
277
|
-
export const GetUserWithProductsOutputSchema = z.object({
|
|
278
|
-
products: UserWithProductsEntitySchema,
|
|
279
|
-
noOfProducts: z.int().nullable(),
|
|
280
|
-
nextCursor: z.string().nullable(),
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
export type UserWithProductsOutput = z.infer<
|
|
284
|
-
typeof GetUserWithProductsOutputSchema
|
|
285
|
-
>;
|
|
286
|
-
|
|
287
|
-
export const GetUserWithPostBookmarksOutputSchema = z.object({
|
|
288
|
-
bookmarks: z.array(
|
|
173
|
+
export const UserWithProjectBookmarksEntitySchema = UserWithId.extend({
|
|
174
|
+
projectBookmarks: z.array(
|
|
289
175
|
BookmarkEntitySchema.extend({
|
|
290
|
-
|
|
176
|
+
project: ProjectSearchDocumentSchema,
|
|
291
177
|
}),
|
|
292
178
|
),
|
|
293
|
-
nextCursor: z.string().nullable(),
|
|
294
179
|
});
|
|
295
180
|
|
|
296
|
-
export
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
|
|
301
|
-
following: z
|
|
302
|
-
.array(
|
|
303
|
-
MinimalUserSchema.extend({
|
|
304
|
-
isFollowing: z.boolean().optional().openapi({ example: true }),
|
|
305
|
-
followsYou: z.boolean().optional().openapi({ example: false }),
|
|
306
|
-
}),
|
|
307
|
-
)
|
|
308
|
-
.openapi({
|
|
309
|
-
description: "List of users this user is following.",
|
|
310
|
-
example: [],
|
|
311
|
-
}),
|
|
312
|
-
}).openapi("UserWithFollowingEntity");
|
|
313
|
-
|
|
314
|
-
export type UserWithFollowingEntity = z.infer<
|
|
315
|
-
typeof UserWithFollowingEntitySchema
|
|
316
|
-
>;
|
|
317
|
-
|
|
318
|
-
export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
|
|
319
|
-
followers: z
|
|
320
|
-
.array(
|
|
321
|
-
MinimalUserSchema.extend({
|
|
322
|
-
isFollowing: z.boolean().optional().openapi({ example: false }),
|
|
323
|
-
followsYou: z.boolean().optional().openapi({ example: true }),
|
|
324
|
-
}),
|
|
325
|
-
)
|
|
326
|
-
.openapi({
|
|
327
|
-
description: "List of users who follow this user.",
|
|
328
|
-
example: [],
|
|
181
|
+
export const UserWithPostBookmarksEntitySchema = UserWithId.extend({
|
|
182
|
+
postBookmarks: z.array(
|
|
183
|
+
BookmarkEntitySchema.extend({
|
|
184
|
+
post: PostWithFilesEntitySchema,
|
|
329
185
|
}),
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
export type UserWithFollowersEntity = z.infer<
|
|
333
|
-
typeof UserWithFollowersEntitySchema
|
|
334
|
-
>;
|
|
335
|
-
|
|
336
|
-
export const GetUserFollowingInputSchema = z.object({
|
|
337
|
-
searchQuery: z.string().optional().openapi({ example: "design systems" }),
|
|
338
|
-
offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
186
|
+
),
|
|
339
187
|
});
|
|
340
188
|
|
|
341
|
-
|
|
189
|
+
/**
|
|
190
|
+
* --------------------------------
|
|
191
|
+
* FOLLOW SYSTEM
|
|
192
|
+
* --------------------------------
|
|
193
|
+
*/
|
|
342
194
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
195
|
+
const FollowMeta = z.object({
|
|
196
|
+
isFollowing: z.boolean(),
|
|
197
|
+
followsYou: z.boolean(),
|
|
346
198
|
});
|
|
347
199
|
|
|
348
|
-
export
|
|
349
|
-
|
|
350
|
-
export const GetUserFollowingOutputSchema = z.object({
|
|
351
|
-
nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
352
|
-
following: z
|
|
353
|
-
.array(
|
|
354
|
-
MinimalUserSchema.extend({
|
|
355
|
-
isFollowing: z.boolean().optional().openapi({ example: true }),
|
|
356
|
-
followsYou: z.boolean().optional().openapi({ example: false }),
|
|
357
|
-
}),
|
|
358
|
-
)
|
|
359
|
-
.openapi({ example: [] }),
|
|
200
|
+
export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
|
|
201
|
+
following: z.array(MinimalUserSchema.extend(FollowMeta.shape)),
|
|
360
202
|
});
|
|
361
203
|
|
|
362
|
-
export
|
|
363
|
-
|
|
364
|
-
>;
|
|
365
|
-
|
|
366
|
-
export const GetUserFollowersOutputSchema = z.object({
|
|
367
|
-
nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
368
|
-
followers: z
|
|
369
|
-
.array(
|
|
370
|
-
MinimalUserSchema.extend({
|
|
371
|
-
isFollowing: z.boolean().optional().openapi({ example: false }),
|
|
372
|
-
followsYou: z.boolean().optional().openapi({ example: true }),
|
|
373
|
-
}),
|
|
374
|
-
)
|
|
375
|
-
.openapi({ example: [] }),
|
|
204
|
+
export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
|
|
205
|
+
followers: z.array(MinimalUserSchema.extend(FollowMeta.shape)),
|
|
376
206
|
});
|
|
377
207
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
export type GetAuthenticatedUserOutput = z.infer<
|
|
385
|
-
typeof GetAuthenticatedUserOutputSchema
|
|
386
|
-
>;
|
|
387
|
-
|
|
388
|
-
export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
|
|
389
|
-
|
|
390
|
-
export type GetAuthenticatedUserProfileOutput = z.infer<
|
|
391
|
-
typeof GetAuthenticatedUserProfileOutputSchema
|
|
392
|
-
>;
|
|
393
|
-
|
|
394
|
-
export const GetAuthenticatedUserWithProjectsOutputSchema =
|
|
395
|
-
UserWithProjectsEntitySchema;
|
|
396
|
-
|
|
397
|
-
export type GetAuthenticatedUserWithProjectsOutput = z.infer<
|
|
398
|
-
typeof GetAuthenticatedUserWithProjectsOutputSchema
|
|
399
|
-
>;
|
|
208
|
+
/**
|
|
209
|
+
* --------------------------------
|
|
210
|
+
* PAGINATION INPUT (REUSED)
|
|
211
|
+
* --------------------------------
|
|
212
|
+
*/
|
|
400
213
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
export type GetAuthenticatedUserWithProjectBookmarksOutput = z.infer<
|
|
405
|
-
typeof GetAuthenticatedUserWithProjectBookmarksOutputSchema
|
|
406
|
-
>;
|
|
407
|
-
|
|
408
|
-
export const GetAuthenticatedUserWithProjectLikesOutputSchema =
|
|
409
|
-
UserWithProjectLikesEntitySchema;
|
|
410
|
-
|
|
411
|
-
export type GetAuthenticatedUserWithProjectLikesOutput = z.infer<
|
|
412
|
-
typeof GetAuthenticatedUserWithProjectLikesOutputSchema
|
|
413
|
-
>;
|
|
414
|
-
|
|
415
|
-
export const GetAuthenticatedUserWithUserFollowingOutputSchema =
|
|
416
|
-
UserWithFollowingEntitySchema;
|
|
417
|
-
|
|
418
|
-
export type GetAuthenticatedUserWithUserFollowingOutput = z.infer<
|
|
419
|
-
typeof GetAuthenticatedUserWithUserFollowingOutputSchema
|
|
420
|
-
>;
|
|
421
|
-
|
|
422
|
-
export const GetAuthenticatedUserWithUserFollowersOutputSchema =
|
|
423
|
-
UserWithFollowersEntitySchema;
|
|
424
|
-
|
|
425
|
-
export type GetAuthenticatedUserWithUserFollowersOutput = z.infer<
|
|
426
|
-
typeof GetAuthenticatedUserWithUserFollowersOutputSchema
|
|
427
|
-
>;
|
|
428
|
-
|
|
429
|
-
export const GetUserActivityInputSchema = z.object({
|
|
430
|
-
activityType: z
|
|
431
|
-
.enum(Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]])
|
|
432
|
-
.openapi({ example: "LIKE" }),
|
|
214
|
+
const CursorPaginationInput = z.object({
|
|
215
|
+
cursor: z.string().optional(),
|
|
216
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
433
217
|
});
|
|
434
218
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
parentId: z.cuid2().openapi({ example: "ckj1a2b3c0000prt" }),
|
|
441
|
-
parentType: z
|
|
442
|
-
.enum(
|
|
443
|
-
Object.values(ACTIVITY_PARENT_TYPES) as [
|
|
444
|
-
ActivityParentType,
|
|
445
|
-
...ActivityParentType[],
|
|
446
|
-
],
|
|
447
|
-
)
|
|
448
|
-
.openapi({ example: "POST" }),
|
|
449
|
-
}),
|
|
450
|
-
)
|
|
451
|
-
.openapi({ example: [] });
|
|
452
|
-
|
|
453
|
-
export type GetUserActivityOutput = z.infer<typeof GetUserActivityOutputSchema>;
|
|
219
|
+
/**
|
|
220
|
+
* --------------------------------
|
|
221
|
+
* SEARCH USERS
|
|
222
|
+
* --------------------------------
|
|
223
|
+
*/
|
|
454
224
|
|
|
455
225
|
const coerceArray = (val: unknown) => {
|
|
456
226
|
if (typeof val === "string") return val === "" ? [] : val.split(",");
|
|
@@ -458,91 +228,69 @@ const coerceArray = (val: unknown) => {
|
|
|
458
228
|
};
|
|
459
229
|
|
|
460
230
|
export const SearchUsersInputSchema = z.object({
|
|
461
|
-
query: z.string().default("")
|
|
462
|
-
example: "john",
|
|
463
|
-
description: "Search by name, email, username, or discipline",
|
|
464
|
-
}),
|
|
231
|
+
query: z.string().default(""),
|
|
465
232
|
roles: z
|
|
466
233
|
.preprocess(
|
|
467
234
|
coerceArray,
|
|
468
235
|
z.array(z.enum(Object.values(ROLES) as [Role, ...Role[]])),
|
|
469
236
|
)
|
|
470
|
-
.optional()
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
.optional()
|
|
475
|
-
.openapi({ example: ["Design Systems", "Web Development"] }),
|
|
476
|
-
locations: z
|
|
477
|
-
.preprocess(coerceArray, z.array(z.string()))
|
|
478
|
-
.optional()
|
|
479
|
-
.openapi({ example: ["Lagos, Nigeria", "London, UK"] }),
|
|
480
|
-
limit: z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
|
|
481
|
-
cursor: z.string().nullable().optional().openapi({
|
|
482
|
-
example: "cksd0v6q0000cursor",
|
|
483
|
-
description: "The offset/cursor for pagination",
|
|
484
|
-
}),
|
|
237
|
+
.optional(),
|
|
238
|
+
disciplines: z.preprocess(coerceArray, z.array(z.string())).optional(),
|
|
239
|
+
locations: z.preprocess(coerceArray, z.array(z.string())).optional(),
|
|
240
|
+
...CursorPaginationInput.shape,
|
|
485
241
|
});
|
|
486
242
|
|
|
487
|
-
export type SearchUsersInput = z.infer<typeof SearchUsersInputSchema>;
|
|
488
|
-
|
|
489
243
|
export const SearchUsersOutputSchema = z.object({
|
|
490
|
-
users: z
|
|
491
|
-
.
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
.optional()
|
|
500
|
-
.openapi({ example: 1200 }),
|
|
501
|
-
disciplines: z
|
|
502
|
-
.array(z.string())
|
|
503
|
-
.optional()
|
|
504
|
-
.openapi({ example: ["UI/UX", "Frontend"] }),
|
|
505
|
-
}),
|
|
506
|
-
)
|
|
507
|
-
.openapi({ example: [] }),
|
|
508
|
-
nextCursor: z.string().optional().openapi({
|
|
509
|
-
example: "abc123nxt",
|
|
510
|
-
description: "The next cursor for pagination",
|
|
511
|
-
}),
|
|
244
|
+
users: z.array(
|
|
245
|
+
MinimalUserSchema.extend({
|
|
246
|
+
isFollowing: z.boolean(),
|
|
247
|
+
followsYou: z.boolean(),
|
|
248
|
+
noOfFollowers: z.number().int(),
|
|
249
|
+
disciplines: z.array(z.string()),
|
|
250
|
+
}),
|
|
251
|
+
),
|
|
252
|
+
nextCursor: z.string().optional(),
|
|
512
253
|
});
|
|
513
254
|
|
|
514
|
-
|
|
255
|
+
/**
|
|
256
|
+
* --------------------------------
|
|
257
|
+
* ACTIVITY
|
|
258
|
+
* --------------------------------
|
|
259
|
+
*/
|
|
515
260
|
|
|
516
|
-
export const
|
|
517
|
-
.
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
name: z.string().nullable().openapi({ example: "John Doe" }),
|
|
522
|
-
image: z
|
|
523
|
-
.string()
|
|
524
|
-
.nullable()
|
|
525
|
-
.openapi({ example: "https://example.com/avatar.png" }),
|
|
526
|
-
role: z
|
|
527
|
-
.enum(Object.values(ROLES) as [Role, ...Role[]])
|
|
528
|
-
.openapi({ example: "CREATIVE" }),
|
|
529
|
-
location: z.string().nullable().openapi({ example: "Lagos, Nigeria" }),
|
|
530
|
-
disciplines: z
|
|
531
|
-
.array(z.string())
|
|
532
|
-
.nullable()
|
|
533
|
-
.openapi({ example: ["Design Systems", "Web Development"] }),
|
|
534
|
-
updatedAt: z
|
|
535
|
-
.string()
|
|
536
|
-
.nullable()
|
|
537
|
-
.openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
538
|
-
createdAt: z
|
|
539
|
-
.string()
|
|
540
|
-
.nullable()
|
|
541
|
-
.openapi({ example: "2026-03-11T09:00:00.000Z" }),
|
|
542
|
-
})
|
|
543
|
-
.openapi({
|
|
544
|
-
title: "User Search Document",
|
|
545
|
-
description: "Flattened schema used for indexing users in search engines.",
|
|
546
|
-
});
|
|
261
|
+
export const GetUserActivityInputSchema = z.object({
|
|
262
|
+
activityType: z.enum(
|
|
263
|
+
Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]],
|
|
264
|
+
),
|
|
265
|
+
});
|
|
547
266
|
|
|
548
|
-
export
|
|
267
|
+
export const GetUserActivityOutputSchema = z.array(
|
|
268
|
+
z.object({
|
|
269
|
+
parentId: z.cuid2(),
|
|
270
|
+
parentType: z.enum(
|
|
271
|
+
Object.values(ACTIVITY_PARENT_TYPES) as [
|
|
272
|
+
ActivityParentType,
|
|
273
|
+
...ActivityParentType[],
|
|
274
|
+
],
|
|
275
|
+
),
|
|
276
|
+
}),
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* --------------------------------
|
|
281
|
+
* SEARCH DOCUMENT (ALLOWED NULLS)
|
|
282
|
+
* --------------------------------
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
export const UserSearchDocumentSchema = z.object({
|
|
286
|
+
id: z.cuid2(),
|
|
287
|
+
email: z.email(),
|
|
288
|
+
username: z.string().nullable(),
|
|
289
|
+
name: z.string().nullable(),
|
|
290
|
+
image: z.string().nullable(),
|
|
291
|
+
role: z.enum(Object.values(ROLES) as [Role, ...Role[]]),
|
|
292
|
+
location: z.string().nullable(),
|
|
293
|
+
disciplines: z.array(z.string()).nullable(),
|
|
294
|
+
updatedAt: z.iso.datetime().nullable(),
|
|
295
|
+
createdAt: z.iso.datetime().nullable(),
|
|
296
|
+
});
|