@zyacreatives/shared 2.2.57 → 2.2.59
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/user.d.ts +4 -0
- package/dist/schemas/user.js +9 -13
- package/package.json +1 -1
- package/src/schemas/user.ts +198 -200
package/dist/schemas/user.d.ts
CHANGED
|
@@ -972,6 +972,10 @@ export declare const SearchUsersOutputSchema: z.ZodObject<{
|
|
|
972
972
|
INVESTOR: "INVESTOR";
|
|
973
973
|
ADMIN: "ADMIN";
|
|
974
974
|
}>;
|
|
975
|
+
isFollowing: z.ZodOptional<z.ZodBoolean>;
|
|
976
|
+
followsYou: z.ZodOptional<z.ZodBoolean>;
|
|
977
|
+
noOfFollowers: z.ZodOptional<z.ZodNumber>;
|
|
978
|
+
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
975
979
|
}, z.core.$strip>>;
|
|
976
980
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
977
981
|
}, z.core.$strip>;
|
package/dist/schemas/user.js
CHANGED
|
@@ -35,13 +35,9 @@ exports.UserEntitySchema = zod_openapi_1.z
|
|
|
35
35
|
.openapi({
|
|
36
36
|
example: "DONE",
|
|
37
37
|
}),
|
|
38
|
-
createdAt: zod_openapi_1.z.coerce
|
|
39
|
-
.date()
|
|
40
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
38
|
+
createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
41
39
|
version: zod_openapi_1.z.int(),
|
|
42
|
-
updatedAt: zod_openapi_1.z.coerce
|
|
43
|
-
.date()
|
|
44
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
40
|
+
updatedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
45
41
|
})
|
|
46
42
|
.openapi("BaseUserEntity");
|
|
47
43
|
exports.MinimalUserSchema = exports.UserEntitySchema.pick({
|
|
@@ -191,19 +187,19 @@ exports.SearchUsersInputSchema = zod_openapi_1.z.object({
|
|
|
191
187
|
description: "Search by name, email, username, or discipline",
|
|
192
188
|
}),
|
|
193
189
|
role: zod_openapi_1.z.enum(Object.values(constants_1.ROLES)).optional(),
|
|
194
|
-
limit: zod_openapi_1.z.coerce
|
|
195
|
-
.number()
|
|
196
|
-
.min(1)
|
|
197
|
-
.max(100)
|
|
198
|
-
.default(20)
|
|
199
|
-
.openapi({ example: 20 }),
|
|
190
|
+
limit: zod_openapi_1.z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
|
|
200
191
|
cursor: zod_openapi_1.z.string().optional().openapi({
|
|
201
192
|
example: 0,
|
|
202
193
|
description: "The offset/cursor for pagination",
|
|
203
194
|
}),
|
|
204
195
|
});
|
|
205
196
|
exports.SearchUsersOutputSchema = zod_openapi_1.z.object({
|
|
206
|
-
users: zod_openapi_1.z.array(exports.MinimalUserSchema
|
|
197
|
+
users: zod_openapi_1.z.array(exports.MinimalUserSchema.extend({
|
|
198
|
+
isFollowing: zod_openapi_1.z.boolean().optional(),
|
|
199
|
+
followsYou: zod_openapi_1.z.boolean().optional(),
|
|
200
|
+
noOfFollowers: zod_openapi_1.z.number().int().nonnegative().optional(),
|
|
201
|
+
disciplines: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
|
|
202
|
+
})),
|
|
207
203
|
nextCursor: zod_openapi_1.z.string().optional().openapi({
|
|
208
204
|
example: "abc123",
|
|
209
205
|
description: "The next cursor for pagination",
|
package/package.json
CHANGED
package/src/schemas/user.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
ROLES,
|
|
5
|
+
USER_STATUSES,
|
|
6
|
+
ONBOARDING_PAGES,
|
|
7
|
+
ACTIVITY_TYPES,
|
|
8
|
+
ACTIVITY_PARENT_TYPES,
|
|
9
9
|
} from "../constants";
|
|
10
10
|
import type {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
Role,
|
|
12
|
+
UserStatus,
|
|
13
|
+
OnboardingPage,
|
|
14
|
+
ActivityType,
|
|
15
|
+
ActivityParentType,
|
|
16
16
|
} from "../constants";
|
|
17
17
|
import { ProjectEntitySchema } from "./project";
|
|
18
18
|
import { BookmarkEntitySchema } from "./bookmark";
|
|
@@ -23,261 +23,259 @@ import { InvestorEntitySchema } from "./investor";
|
|
|
23
23
|
import { PostEntitySchema, PostWithFilesEntitySchema } from "./post";
|
|
24
24
|
|
|
25
25
|
export const UserEntitySchema = z
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.date()
|
|
61
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
62
|
-
})
|
|
63
|
-
.openapi("BaseUserEntity");
|
|
26
|
+
.object({
|
|
27
|
+
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
28
|
+
email: z.email().openapi({ example: "user@example.com" }),
|
|
29
|
+
emailVerified: z.boolean().openapi({ example: true }),
|
|
30
|
+
name: z.string().optional().openapi({ example: "John Doe" }),
|
|
31
|
+
image: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.openapi({ example: "https://example.com/avatar.png" }),
|
|
35
|
+
username: z.string().optional().openapi({ example: "johndoe" }),
|
|
36
|
+
displayUsername: z.string().optional().openapi({ example: "@johndoe" }),
|
|
37
|
+
role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).openapi({
|
|
38
|
+
example: "CREATIVE",
|
|
39
|
+
}),
|
|
40
|
+
status: z
|
|
41
|
+
.enum(Object.values(USER_STATUSES) as [UserStatus, ...UserStatus[]])
|
|
42
|
+
.openapi({
|
|
43
|
+
example: "ACTIVE",
|
|
44
|
+
}),
|
|
45
|
+
onboardingPage: z
|
|
46
|
+
.enum(
|
|
47
|
+
Object.values(ONBOARDING_PAGES) as [
|
|
48
|
+
OnboardingPage,
|
|
49
|
+
...OnboardingPage[],
|
|
50
|
+
],
|
|
51
|
+
)
|
|
52
|
+
.openapi({
|
|
53
|
+
example: "DONE",
|
|
54
|
+
}),
|
|
55
|
+
createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
56
|
+
version: z.int(),
|
|
57
|
+
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
58
|
+
})
|
|
59
|
+
.openapi("BaseUserEntity");
|
|
64
60
|
|
|
65
61
|
export const MinimalUserSchema = UserEntitySchema.pick({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
id: true,
|
|
63
|
+
name: true,
|
|
64
|
+
email: true,
|
|
65
|
+
image: true,
|
|
66
|
+
username: true,
|
|
67
|
+
role: true,
|
|
72
68
|
}).openapi("MinimalUser");
|
|
73
69
|
|
|
74
70
|
export const UserStatsEntitySchema = z.object({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
followerCount: z.int(),
|
|
72
|
+
followingCount: z.int(),
|
|
73
|
+
followingIds: z.array(z.string()),
|
|
78
74
|
});
|
|
79
75
|
|
|
80
76
|
export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
profileType: z.enum(["creative", "brand", "investor"]).optional(),
|
|
78
|
+
brand: BrandEntitySchema,
|
|
79
|
+
creative: CreativeEntitySchema,
|
|
80
|
+
investor: InvestorEntitySchema,
|
|
85
81
|
}).openapi("UserProfileEntity");
|
|
86
82
|
|
|
87
83
|
export const UserWithProjectsEntitySchema = z
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
.object({
|
|
85
|
+
userId: z.cuid2(),
|
|
86
|
+
projects: z.array(ProjectEntitySchema.omit({ overview: true })),
|
|
87
|
+
})
|
|
88
|
+
.openapi("UserWithProjectsEntity");
|
|
93
89
|
|
|
94
90
|
export const UserWithProjectLikesEntitySchema = z.object({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
userId: z.cuid2(),
|
|
92
|
+
projectLikes: z.array(
|
|
93
|
+
LikeEntitySchema.extend({
|
|
94
|
+
project: ProjectEntitySchema.pick({
|
|
95
|
+
id: true,
|
|
96
|
+
title: true,
|
|
97
|
+
description: true,
|
|
98
|
+
tags: true,
|
|
99
|
+
startDate: true,
|
|
100
|
+
endDate: true,
|
|
101
|
+
imagePlaceholderUrl: true,
|
|
102
|
+
}),
|
|
103
|
+
}),
|
|
104
|
+
),
|
|
109
105
|
});
|
|
110
106
|
|
|
111
107
|
export const UserWithPostLikesEntitySchema = z.object({
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
userId: z.cuid2(),
|
|
109
|
+
postLikes: z.array(
|
|
110
|
+
LikeEntitySchema.extend({
|
|
111
|
+
post: PostEntitySchema.pick({
|
|
112
|
+
id: true,
|
|
113
|
+
parentId: true,
|
|
114
|
+
title: true,
|
|
115
|
+
content: true,
|
|
116
|
+
tags: true,
|
|
117
|
+
createdAt: true,
|
|
118
|
+
updatedAt: true,
|
|
119
|
+
}),
|
|
120
|
+
}),
|
|
121
|
+
),
|
|
126
122
|
});
|
|
127
123
|
|
|
128
124
|
export const UserWithPostBookmarksEntitySchema = z.object({
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
125
|
+
userId: z.cuid2(),
|
|
126
|
+
postBookmarks: z.array(
|
|
127
|
+
BookmarkEntitySchema.extend({
|
|
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
|
+
),
|
|
143
139
|
});
|
|
144
140
|
|
|
145
141
|
export const UserWithProjectBookmarksEntitySchema = z
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
142
|
+
.object({
|
|
143
|
+
userId: z.cuid2(),
|
|
144
|
+
projectBookmarks: z.array(
|
|
145
|
+
BookmarkEntitySchema.extend({
|
|
146
|
+
project: ProjectEntitySchema.pick({
|
|
147
|
+
id: true,
|
|
148
|
+
title: true,
|
|
149
|
+
description: true,
|
|
150
|
+
tags: true,
|
|
151
|
+
startDate: true,
|
|
152
|
+
endDate: true,
|
|
153
|
+
imagePlaceholderUrl: true,
|
|
154
|
+
}),
|
|
155
|
+
}),
|
|
156
|
+
),
|
|
157
|
+
})
|
|
158
|
+
.openapi("UserWithProjectBookmarksEntity");
|
|
163
159
|
|
|
164
160
|
export const GetUserFollowingInputSchema = z.object({
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
searchQuery: z.string().optional().openapi({ example: "design systems" }),
|
|
162
|
+
offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
167
163
|
});
|
|
168
164
|
|
|
169
165
|
export const GetUserFollowersInputSchema = z.object({
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
searchQuery: z.string().optional().openapi({ example: "design systems" }),
|
|
167
|
+
offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
172
168
|
});
|
|
173
169
|
export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
170
|
+
following: z
|
|
171
|
+
.array(
|
|
172
|
+
MinimalUserSchema.extend({
|
|
173
|
+
isFollowing: z.boolean().optional(),
|
|
174
|
+
followsYou: z.boolean().optional(),
|
|
175
|
+
}),
|
|
176
|
+
)
|
|
177
|
+
.openapi({ description: "List of users this user is following." }),
|
|
182
178
|
}).openapi("UserWithFollowingEntity");
|
|
183
179
|
|
|
184
180
|
export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
181
|
+
followers: z
|
|
182
|
+
.array(
|
|
183
|
+
MinimalUserSchema.extend({
|
|
184
|
+
isFollowing: z.boolean().optional(),
|
|
185
|
+
followsYou: z.boolean().optional(),
|
|
186
|
+
}),
|
|
187
|
+
)
|
|
188
|
+
.openapi({ description: "List of users who follow this user." }),
|
|
193
189
|
}).openapi("UserWithFollowersEntity");
|
|
194
190
|
|
|
195
191
|
export const GetUserFollowersOutputSchema = z.object({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
192
|
+
nextCursor: z.string(),
|
|
193
|
+
followers: z.array(
|
|
194
|
+
MinimalUserSchema.extend({
|
|
195
|
+
isFollowing: z.boolean().optional(),
|
|
196
|
+
followsYou: z.boolean().optional(),
|
|
197
|
+
}),
|
|
198
|
+
),
|
|
203
199
|
});
|
|
204
200
|
|
|
205
201
|
export const GetUserFollowingOutputSchema = z.object({
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
202
|
+
nextCursor: z.string(),
|
|
203
|
+
following: z.array(
|
|
204
|
+
MinimalUserSchema.extend({
|
|
205
|
+
isFollowing: z.boolean().optional(),
|
|
206
|
+
followsYou: z.boolean().optional(),
|
|
207
|
+
}),
|
|
208
|
+
),
|
|
213
209
|
});
|
|
214
210
|
|
|
215
211
|
export const UserWithPostsEntitySchema = z
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
.object({
|
|
213
|
+
userId: z.cuid2(),
|
|
214
|
+
posts: z.array(PostWithFilesEntitySchema),
|
|
215
|
+
})
|
|
216
|
+
.openapi("UserWithPostsEntity");
|
|
221
217
|
|
|
222
218
|
export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
|
|
223
219
|
|
|
224
220
|
export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
|
|
225
221
|
|
|
226
222
|
export const GetAuthenticatedUserWithProjectsOutputSchema =
|
|
227
|
-
|
|
223
|
+
UserWithProjectsEntitySchema;
|
|
228
224
|
|
|
229
225
|
export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
|
|
230
|
-
|
|
226
|
+
UserWithProjectBookmarksEntitySchema;
|
|
231
227
|
|
|
232
228
|
export const GetAuthenticatedUserWithUserFollowingOutputSchema =
|
|
233
|
-
|
|
229
|
+
UserWithFollowingEntitySchema;
|
|
234
230
|
|
|
235
231
|
export const GetAuthenticatedUserWithUserFollowersOutputSchema =
|
|
236
|
-
|
|
232
|
+
UserWithFollowersEntitySchema;
|
|
237
233
|
|
|
238
234
|
export const GetAuthenticatedUserWithProjectLikesOutputSchema =
|
|
239
|
-
|
|
235
|
+
UserWithProjectLikesEntitySchema;
|
|
240
236
|
|
|
241
237
|
export const GetUserActivityInputSchema = z.object({
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
238
|
+
activityType: z.enum(
|
|
239
|
+
Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]],
|
|
240
|
+
),
|
|
245
241
|
});
|
|
246
242
|
|
|
247
243
|
export const GetUserActivityOutputSchema = z.array(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
244
|
+
z.object({
|
|
245
|
+
parentId: z.string(),
|
|
246
|
+
parentType: z.enum(
|
|
247
|
+
Object.values(ACTIVITY_PARENT_TYPES) as [
|
|
248
|
+
ActivityParentType,
|
|
249
|
+
...ActivityParentType[],
|
|
250
|
+
],
|
|
251
|
+
),
|
|
252
|
+
}),
|
|
257
253
|
);
|
|
258
254
|
|
|
259
255
|
export const SearchUsersInputSchema = z.object({
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
.openapi({ example: 20 }),
|
|
271
|
-
cursor: z.string().optional().openapi({
|
|
272
|
-
example: 0,
|
|
273
|
-
description: "The offset/cursor for pagination",
|
|
274
|
-
}),
|
|
256
|
+
query: z.string().default("").openapi({
|
|
257
|
+
example: "john",
|
|
258
|
+
description: "Search by name, email, username, or discipline",
|
|
259
|
+
}),
|
|
260
|
+
role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).optional(),
|
|
261
|
+
limit: z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
|
|
262
|
+
cursor: z.string().optional().openapi({
|
|
263
|
+
example: 0,
|
|
264
|
+
description: "The offset/cursor for pagination",
|
|
265
|
+
}),
|
|
275
266
|
});
|
|
276
267
|
|
|
277
268
|
export const SearchUsersOutputSchema = z.object({
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
269
|
+
users: z.array(
|
|
270
|
+
MinimalUserSchema.extend({
|
|
271
|
+
isFollowing: z.boolean().optional(),
|
|
272
|
+
followsYou: z.boolean().optional(),
|
|
273
|
+
noOfFollowers: z.number().int().nonnegative().optional(),
|
|
274
|
+
disciplines: z.array(z.string()).optional(),
|
|
282
275
|
}),
|
|
276
|
+
),
|
|
277
|
+
nextCursor: z.string().optional().openapi({
|
|
278
|
+
example: "abc123",
|
|
279
|
+
description: "The next cursor for pagination",
|
|
280
|
+
}),
|
|
283
281
|
});
|