@zyacreatives/shared 2.2.78 → 2.2.79
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 +457 -128
- package/dist/schemas/user.js +70 -54
- package/dist/types/user.d.ts +15 -11
- package/package.json +1 -1
- package/src/schemas/user.ts +93 -60
- package/src/types/user.ts +81 -35
package/dist/schemas/user.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserSearchDocumentSchema = exports.SearchUsersOutputSchema = exports.SearchUsersInputSchema = exports.GetUserActivityOutputSchema = exports.GetUserActivityInputSchema = exports.
|
|
3
|
+
exports.UserSearchDocumentSchema = exports.SearchUsersOutputSchema = exports.SearchUsersInputSchema = exports.GetUserActivityOutputSchema = exports.GetUserActivityInputSchema = exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.GetAuthenticatedUserProfileOutputSchema = exports.GetAuthenticatedUserOutputSchema = exports.GetUserFollowersOutputSchema = exports.GetUserFollowingOutputSchema = exports.GetUserFollowersInputSchema = exports.GetUserFollowingInputSchema = exports.UserWithFollowersEntitySchema = exports.UserWithFollowingEntitySchema = exports.GetUserWithPostBookmarksOutputSchema = exports.GetUserWithProjectBookmarksOutputSchema = exports.GetUserWithPostBookmarksInputSchema = exports.GetUserWithProjectBookmarksInputSchema = exports.UserWithPostBookmarksEntitySchema = exports.UserWithProjectBookmarksEntitySchema = exports.UserWithJobBookmarksOutputSchema = exports.UserWithJobBookmarksInputSchema = exports.UserWithJobBookmarksEntitySchema = exports.UserWithPostLikesEntitySchema = exports.UserWithProjectLikesEntitySchema = exports.UserWithPostsEntitySchema = exports.UserWithProjectsEntitySchema = exports.UserStatsEntitySchema = exports.UserProfileEntitySchema = exports.MinimalUserSchema = exports.UserEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const project_1 = require("./project");
|
|
@@ -11,6 +11,9 @@ const creative_1 = require("./creative");
|
|
|
11
11
|
const investor_1 = require("./investor");
|
|
12
12
|
const post_1 = require("./post");
|
|
13
13
|
const job_1 = require("./job");
|
|
14
|
+
// ==========================================
|
|
15
|
+
// 1. CORE USER ENTITIES
|
|
16
|
+
// ==========================================
|
|
14
17
|
exports.UserEntitySchema = zod_openapi_1.z
|
|
15
18
|
.object({
|
|
16
19
|
id: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
@@ -49,13 +52,6 @@ exports.MinimalUserSchema = exports.UserEntitySchema.pick({
|
|
|
49
52
|
username: true,
|
|
50
53
|
role: true,
|
|
51
54
|
}).openapi("MinimalUser");
|
|
52
|
-
exports.UserStatsEntitySchema = zod_openapi_1.z.object({
|
|
53
|
-
followerCount: zod_openapi_1.z.int().openapi({ example: 1540 }),
|
|
54
|
-
followingCount: zod_openapi_1.z.int().openapi({ example: 234 }),
|
|
55
|
-
followingIds: zod_openapi_1.z
|
|
56
|
-
.array(zod_openapi_1.z.cuid2())
|
|
57
|
-
.openapi({ example: ["cksd0v6q0000s9a5y8z7p3x9", "clm1a2b3c0000abc"] }),
|
|
58
|
-
});
|
|
59
55
|
exports.UserProfileEntitySchema = exports.UserEntitySchema.extend({
|
|
60
56
|
profileType: zod_openapi_1.z
|
|
61
57
|
.enum(["creative", "brand", "investor"])
|
|
@@ -65,6 +61,16 @@ exports.UserProfileEntitySchema = exports.UserEntitySchema.extend({
|
|
|
65
61
|
creative: creative_1.CreativeEntitySchema,
|
|
66
62
|
investor: investor_1.InvestorEntitySchema,
|
|
67
63
|
}).openapi("UserProfileEntity");
|
|
64
|
+
exports.UserStatsEntitySchema = zod_openapi_1.z.object({
|
|
65
|
+
followerCount: zod_openapi_1.z.int().openapi({ example: 1540 }),
|
|
66
|
+
followingCount: zod_openapi_1.z.int().openapi({ example: 234 }),
|
|
67
|
+
followingIds: zod_openapi_1.z
|
|
68
|
+
.array(zod_openapi_1.z.cuid2())
|
|
69
|
+
.openapi({ example: ["cksd0v6q0000s9a5y8z7p3x9", "clm1a2b3c0000abc"] }),
|
|
70
|
+
});
|
|
71
|
+
// ==========================================
|
|
72
|
+
// 2. CONTENT ASSOCIATIONS (Projects, Posts)
|
|
73
|
+
// ==========================================
|
|
68
74
|
exports.UserWithProjectsEntitySchema = zod_openapi_1.z
|
|
69
75
|
.object({
|
|
70
76
|
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
@@ -73,6 +79,15 @@ exports.UserWithProjectsEntitySchema = zod_openapi_1.z
|
|
|
73
79
|
.openapi({ example: [] }),
|
|
74
80
|
})
|
|
75
81
|
.openapi("UserWithProjectsEntity");
|
|
82
|
+
exports.UserWithPostsEntitySchema = zod_openapi_1.z
|
|
83
|
+
.object({
|
|
84
|
+
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
85
|
+
posts: zod_openapi_1.z.array(post_1.PostWithFilesEntitySchema).openapi({ example: [] }),
|
|
86
|
+
})
|
|
87
|
+
.openapi("UserWithPostsEntity");
|
|
88
|
+
// ==========================================
|
|
89
|
+
// 3. LIKES
|
|
90
|
+
// ==========================================
|
|
76
91
|
exports.UserWithProjectLikesEntitySchema = zod_openapi_1.z.object({
|
|
77
92
|
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
78
93
|
projectLikes: zod_openapi_1.z
|
|
@@ -93,22 +108,6 @@ exports.UserWithPostLikesEntitySchema = zod_openapi_1.z.object({
|
|
|
93
108
|
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
94
109
|
postLikes: zod_openapi_1.z
|
|
95
110
|
.array(like_1.LikeEntitySchema.extend({
|
|
96
|
-
post: post_1.PostEntitySchema.pick({
|
|
97
|
-
id: true,
|
|
98
|
-
parentId: true,
|
|
99
|
-
title: true, // Note: Make sure 'title' exists on PostEntitySchema in your post.ts!
|
|
100
|
-
content: true,
|
|
101
|
-
tags: true,
|
|
102
|
-
createdAt: true,
|
|
103
|
-
updatedAt: true, // Note: Make sure 'updatedAt' exists on PostEntitySchema as well!
|
|
104
|
-
}),
|
|
105
|
-
}))
|
|
106
|
-
.openapi({ example: [] }),
|
|
107
|
-
});
|
|
108
|
-
exports.UserWithPostBookmarksEntitySchema = zod_openapi_1.z.object({
|
|
109
|
-
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
110
|
-
postBookmarks: zod_openapi_1.z
|
|
111
|
-
.array(bookmark_1.BookmarkEntitySchema.extend({
|
|
112
111
|
post: post_1.PostEntitySchema.pick({
|
|
113
112
|
id: true,
|
|
114
113
|
parentId: true,
|
|
@@ -121,6 +120,9 @@ exports.UserWithPostBookmarksEntitySchema = zod_openapi_1.z.object({
|
|
|
121
120
|
}))
|
|
122
121
|
.openapi({ example: [] }),
|
|
123
122
|
});
|
|
123
|
+
// ==========================================
|
|
124
|
+
// 4. BOOKMARKS
|
|
125
|
+
// ==========================================
|
|
124
126
|
exports.UserWithJobBookmarksEntitySchema = zod_openapi_1.z.object({
|
|
125
127
|
userId: zod_openapi_1.z.cuid2().openapi({ example: "afoaifaofi" }),
|
|
126
128
|
jobBookmarks: zod_openapi_1.z
|
|
@@ -144,27 +146,30 @@ exports.UserWithProjectBookmarksEntitySchema = zod_openapi_1.z
|
|
|
144
146
|
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
145
147
|
projectBookmarks: zod_openapi_1.z
|
|
146
148
|
.array(bookmark_1.BookmarkEntitySchema.extend({
|
|
147
|
-
project: project_1.
|
|
148
|
-
id: true,
|
|
149
|
-
title: true,
|
|
150
|
-
description: true,
|
|
151
|
-
tags: true,
|
|
152
|
-
startDate: true,
|
|
153
|
-
endDate: true,
|
|
154
|
-
imagePlaceholderUrl: true,
|
|
155
|
-
}),
|
|
149
|
+
project: project_1.ProjectSearchDocumentSchema,
|
|
156
150
|
}))
|
|
157
151
|
.openapi({ example: [] }),
|
|
158
152
|
})
|
|
159
153
|
.openapi("UserWithProjectBookmarksEntity");
|
|
160
|
-
exports.
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
exports.UserWithPostBookmarksEntitySchema = zod_openapi_1.z.object({
|
|
155
|
+
userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
156
|
+
postBookmarks: zod_openapi_1.z.array(bookmark_1.BookmarkEntitySchema.extend({
|
|
157
|
+
post: post_1.FeedPostEntitySchema,
|
|
158
|
+
})),
|
|
163
159
|
});
|
|
164
|
-
exports.
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
exports.GetUserWithProjectBookmarksInputSchema = exports.UserWithJobBookmarksInputSchema;
|
|
161
|
+
exports.GetUserWithPostBookmarksInputSchema = exports.UserWithJobBookmarksInputSchema;
|
|
162
|
+
exports.GetUserWithProjectBookmarksOutputSchema = zod_openapi_1.z.object({
|
|
163
|
+
bookmarks: exports.UserWithProjectBookmarksEntitySchema,
|
|
164
|
+
nextCursor: zod_openapi_1.z.string().nullable(),
|
|
167
165
|
});
|
|
166
|
+
exports.GetUserWithPostBookmarksOutputSchema = zod_openapi_1.z.object({
|
|
167
|
+
bookmarks: exports.UserWithPostBookmarksEntitySchema,
|
|
168
|
+
nextCursor: zod_openapi_1.z.string().nullable(),
|
|
169
|
+
});
|
|
170
|
+
// ==========================================
|
|
171
|
+
// 5. FOLLOWERS & FOLLOWING
|
|
172
|
+
// ==========================================
|
|
168
173
|
exports.UserWithFollowingEntitySchema = exports.MinimalUserSchema.extend({
|
|
169
174
|
following: zod_openapi_1.z
|
|
170
175
|
.array(exports.MinimalUserSchema.extend({
|
|
@@ -187,14 +192,13 @@ exports.UserWithFollowersEntitySchema = exports.MinimalUserSchema.extend({
|
|
|
187
192
|
example: [],
|
|
188
193
|
}),
|
|
189
194
|
}).openapi("UserWithFollowersEntity");
|
|
190
|
-
exports.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
})
|
|
197
|
-
.openapi({ example: [] }),
|
|
195
|
+
exports.GetUserFollowingInputSchema = zod_openapi_1.z.object({
|
|
196
|
+
searchQuery: zod_openapi_1.z.string().optional().openapi({ example: "design systems" }),
|
|
197
|
+
offset: zod_openapi_1.z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
198
|
+
});
|
|
199
|
+
exports.GetUserFollowersInputSchema = zod_openapi_1.z.object({
|
|
200
|
+
searchQuery: zod_openapi_1.z.string().optional().openapi({ example: "design systems" }),
|
|
201
|
+
offset: zod_openapi_1.z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
198
202
|
});
|
|
199
203
|
exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
|
|
200
204
|
nextCursor: zod_openapi_1.z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
@@ -205,19 +209,28 @@ exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
|
|
|
205
209
|
}))
|
|
206
210
|
.openapi({ example: [] }),
|
|
207
211
|
});
|
|
208
|
-
exports.
|
|
209
|
-
.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
})
|
|
213
|
-
|
|
212
|
+
exports.GetUserFollowersOutputSchema = zod_openapi_1.z.object({
|
|
213
|
+
nextCursor: zod_openapi_1.z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
214
|
+
followers: zod_openapi_1.z
|
|
215
|
+
.array(exports.MinimalUserSchema.extend({
|
|
216
|
+
isFollowing: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
|
|
217
|
+
followsYou: zod_openapi_1.z.boolean().optional().openapi({ example: true }),
|
|
218
|
+
}))
|
|
219
|
+
.openapi({ example: [] }),
|
|
220
|
+
});
|
|
221
|
+
// ==========================================
|
|
222
|
+
// 6. AUTHENTICATED USER OUTPUTS
|
|
223
|
+
// ==========================================
|
|
214
224
|
exports.GetAuthenticatedUserOutputSchema = exports.UserEntitySchema;
|
|
215
225
|
exports.GetAuthenticatedUserProfileOutputSchema = exports.UserProfileEntitySchema;
|
|
216
226
|
exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.UserWithProjectsEntitySchema;
|
|
217
227
|
exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.UserWithProjectBookmarksEntitySchema;
|
|
228
|
+
exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.UserWithProjectLikesEntitySchema;
|
|
218
229
|
exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.UserWithFollowingEntitySchema;
|
|
219
230
|
exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.UserWithFollowersEntitySchema;
|
|
220
|
-
|
|
231
|
+
// ==========================================
|
|
232
|
+
// 7. ACTIVITY
|
|
233
|
+
// ==========================================
|
|
221
234
|
exports.GetUserActivityInputSchema = zod_openapi_1.z.object({
|
|
222
235
|
activityType: zod_openapi_1.z
|
|
223
236
|
.enum(Object.values(constants_1.ACTIVITY_TYPES))
|
|
@@ -231,6 +244,9 @@ exports.GetUserActivityOutputSchema = zod_openapi_1.z
|
|
|
231
244
|
.openapi({ example: "POST" }),
|
|
232
245
|
}))
|
|
233
246
|
.openapi({ example: [] });
|
|
247
|
+
// ==========================================
|
|
248
|
+
// 8. SEARCH
|
|
249
|
+
// ==========================================
|
|
234
250
|
exports.SearchUsersInputSchema = zod_openapi_1.z.object({
|
|
235
251
|
query: zod_openapi_1.z.string().default("").openapi({
|
|
236
252
|
example: "john",
|
package/dist/types/user.d.ts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { MinimalUserSchema, UserEntitySchema, UserProfileEntitySchema, UserWithProjectsEntitySchema, UserWithProjectBookmarksEntitySchema, GetUserFollowingInputSchema, GetUserFollowersInputSchema, UserWithFollowingEntitySchema, UserWithFollowersEntitySchema, GetUserFollowingOutputSchema, GetUserFollowersOutputSchema, GetAuthenticatedUserOutputSchema, GetAuthenticatedUserProfileOutputSchema, GetAuthenticatedUserWithProjectsOutputSchema, GetAuthenticatedUserWithProjectBookmarksOutputSchema, GetAuthenticatedUserWithUserFollowingOutputSchema, GetAuthenticatedUserWithUserFollowersOutputSchema, SearchUsersInputSchema, UserWithProjectLikesEntitySchema, GetAuthenticatedUserWithProjectLikesOutputSchema, GetUserActivityInputSchema, GetUserActivityOutputSchema, UserStatsEntitySchema, UserWithPostsEntitySchema, SearchUsersOutputSchema, UserWithPostBookmarksEntitySchema, UserWithPostLikesEntitySchema, UserSearchDocumentSchema, UserWithJobBookmarksEntitySchema, UserWithJobBookmarksInputSchema, UserWithJobBookmarksOutputSchema } from "../schemas/user";
|
|
2
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { UserEntitySchema, MinimalUserSchema, UserProfileEntitySchema, UserStatsEntitySchema, UserWithProjectsEntitySchema, UserWithPostsEntitySchema, UserWithProjectLikesEntitySchema, UserWithPostLikesEntitySchema, UserWithJobBookmarksEntitySchema, UserWithJobBookmarksInputSchema, UserWithJobBookmarksOutputSchema, UserWithProjectBookmarksEntitySchema, UserWithPostBookmarksEntitySchema, GetUserWithProjectBookmarksInputSchema, GetUserWithPostBookmarksInputSchema, GetUserWithProjectBookmarksOutputSchema, GetUserWithPostBookmarksOutputSchema, UserWithFollowingEntitySchema, UserWithFollowersEntitySchema, GetUserFollowingInputSchema, GetUserFollowersInputSchema, GetUserFollowingOutputSchema, GetUserFollowersOutputSchema, GetAuthenticatedUserOutputSchema, GetAuthenticatedUserProfileOutputSchema, GetAuthenticatedUserWithProjectsOutputSchema, GetAuthenticatedUserWithProjectBookmarksOutputSchema, GetAuthenticatedUserWithProjectLikesOutputSchema, GetAuthenticatedUserWithUserFollowingOutputSchema, GetAuthenticatedUserWithUserFollowersOutputSchema, GetUserActivityInputSchema, GetUserActivityOutputSchema, SearchUsersInputSchema, SearchUsersOutputSchema, UserSearchDocumentSchema } from "../schemas/user";
|
|
3
3
|
export type BaseUserEntity = z.infer<typeof UserEntitySchema>;
|
|
4
|
-
export type MinimalUser = z.infer<typeof MinimalUserSchema>;
|
|
5
4
|
export type UserEntity = z.infer<typeof UserEntitySchema>;
|
|
5
|
+
export type MinimalUser = z.infer<typeof MinimalUserSchema>;
|
|
6
6
|
export type UserProfileEntity = z.infer<typeof UserProfileEntitySchema>;
|
|
7
|
+
export type UserStatsEntity = z.infer<typeof UserStatsEntitySchema>;
|
|
7
8
|
export type UserWithProjectsEntity = z.infer<typeof UserWithProjectsEntitySchema>;
|
|
8
|
-
export type
|
|
9
|
+
export type UserWithUserPostsEntity = z.infer<typeof UserWithPostsEntitySchema>;
|
|
9
10
|
export type UserWithProjectLikesEntity = z.infer<typeof UserWithProjectLikesEntitySchema>;
|
|
10
|
-
export type UserWithPostBookmarksEntity = z.infer<typeof UserWithPostBookmarksEntitySchema>;
|
|
11
11
|
export type UserWithPostLikesEntity = z.infer<typeof UserWithPostLikesEntitySchema>;
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
12
|
+
export type UserWithJobBookmarksEntity = z.infer<typeof UserWithJobBookmarksEntitySchema>;
|
|
13
|
+
export type UserWithJobBookmarksInput = z.infer<typeof UserWithJobBookmarksInputSchema>;
|
|
14
|
+
export type UserWithJobBookmarksOutput = z.infer<typeof UserWithJobBookmarksOutputSchema>;
|
|
15
|
+
export type UserWithProjectBookmarksEntity = z.infer<typeof UserWithProjectBookmarksEntitySchema>;
|
|
16
|
+
export type UserWithPostBookmarksEntity = z.infer<typeof UserWithPostBookmarksEntitySchema>;
|
|
17
|
+
export type GetUserWithProjectBookmarksInput = z.infer<typeof GetUserWithProjectBookmarksInputSchema>;
|
|
18
|
+
export type GetUserWithPostBookmarksInput = z.infer<typeof GetUserWithPostBookmarksInputSchema>;
|
|
19
|
+
export type GetUserWithProjectBookmarksOutput = z.infer<typeof GetUserWithProjectBookmarksOutputSchema>;
|
|
20
|
+
export type GetUserWithPostBookmarksOutput = z.infer<typeof GetUserWithPostBookmarksOutputSchema>;
|
|
15
21
|
export type UserWithFollowingEntity = z.infer<typeof UserWithFollowingEntitySchema>;
|
|
16
22
|
export type UserWithFollowersEntity = z.infer<typeof UserWithFollowersEntitySchema>;
|
|
23
|
+
export type GetUserFollowingInput = z.infer<typeof GetUserFollowingInputSchema>;
|
|
24
|
+
export type GetUserFollowersInput = z.infer<typeof GetUserFollowersInputSchema>;
|
|
17
25
|
export type GetUserFollowingOutput = z.infer<typeof GetUserFollowingOutputSchema>;
|
|
18
26
|
export type GetUserFollowersOutput = z.infer<typeof GetUserFollowersOutputSchema>;
|
|
19
27
|
export type GetAuthenticatedUserOutput = z.infer<typeof GetAuthenticatedUserOutputSchema>;
|
|
@@ -25,10 +33,6 @@ export type GetAuthenticatedUserWithUserFollowingOutput = z.infer<typeof GetAuth
|
|
|
25
33
|
export type GetAuthenticatedUserWithUserFollowersOutput = z.infer<typeof GetAuthenticatedUserWithUserFollowersOutputSchema>;
|
|
26
34
|
export type GetUserActivityInput = z.infer<typeof GetUserActivityInputSchema>;
|
|
27
35
|
export type GetUserActivityOutput = z.infer<typeof GetUserActivityOutputSchema>;
|
|
28
|
-
export type UserStatsEntity = z.infer<typeof UserStatsEntitySchema>;
|
|
29
36
|
export type SearchUsersInput = z.infer<typeof SearchUsersInputSchema>;
|
|
30
37
|
export type SearchUsersOutput = z.infer<typeof SearchUsersOutputSchema>;
|
|
31
38
|
export type UserSearchDocument = z.infer<typeof UserSearchDocumentSchema>;
|
|
32
|
-
export type UserWithJobBookmarksEntity = z.infer<typeof UserWithJobBookmarksEntitySchema>;
|
|
33
|
-
export type UserWithJobBookmarksInput = z.infer<typeof UserWithJobBookmarksInputSchema>;
|
|
34
|
-
export type UserWithJobBookmarksOutput = z.infer<typeof UserWithJobBookmarksOutputSchema>;
|
package/package.json
CHANGED
package/src/schemas/user.ts
CHANGED
|
@@ -14,15 +14,23 @@ import type {
|
|
|
14
14
|
ActivityType,
|
|
15
15
|
ActivityParentType,
|
|
16
16
|
} from "../constants";
|
|
17
|
-
import { ProjectEntitySchema } from "./project";
|
|
17
|
+
import { ProjectEntitySchema, ProjectSearchDocumentSchema } from "./project";
|
|
18
18
|
import { BookmarkEntitySchema } from "./bookmark";
|
|
19
19
|
import { LikeEntitySchema } from "./like";
|
|
20
20
|
import { BrandEntitySchema } from "./brand";
|
|
21
21
|
import { CreativeEntitySchema } from "./creative";
|
|
22
22
|
import { InvestorEntitySchema } from "./investor";
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
FeedPostEntitySchema,
|
|
25
|
+
PostEntitySchema,
|
|
26
|
+
PostWithFilesEntitySchema,
|
|
27
|
+
} from "./post";
|
|
24
28
|
import { JobEntitySchema, JobSearchDocumentSchema } from "./job";
|
|
25
29
|
|
|
30
|
+
// ==========================================
|
|
31
|
+
// 1. CORE USER ENTITIES
|
|
32
|
+
// ==========================================
|
|
33
|
+
|
|
26
34
|
export const UserEntitySchema = z
|
|
27
35
|
.object({
|
|
28
36
|
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
@@ -68,14 +76,6 @@ export const MinimalUserSchema = UserEntitySchema.pick({
|
|
|
68
76
|
role: true,
|
|
69
77
|
}).openapi("MinimalUser");
|
|
70
78
|
|
|
71
|
-
export const UserStatsEntitySchema = z.object({
|
|
72
|
-
followerCount: z.int().openapi({ example: 1540 }),
|
|
73
|
-
followingCount: z.int().openapi({ example: 234 }),
|
|
74
|
-
followingIds: z
|
|
75
|
-
.array(z.cuid2())
|
|
76
|
-
.openapi({ example: ["cksd0v6q0000s9a5y8z7p3x9", "clm1a2b3c0000abc"] }),
|
|
77
|
-
});
|
|
78
|
-
|
|
79
79
|
export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
80
80
|
profileType: z
|
|
81
81
|
.enum(["creative", "brand", "investor"])
|
|
@@ -86,6 +86,18 @@ export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
|
86
86
|
investor: InvestorEntitySchema,
|
|
87
87
|
}).openapi("UserProfileEntity");
|
|
88
88
|
|
|
89
|
+
export const UserStatsEntitySchema = z.object({
|
|
90
|
+
followerCount: z.int().openapi({ example: 1540 }),
|
|
91
|
+
followingCount: z.int().openapi({ example: 234 }),
|
|
92
|
+
followingIds: z
|
|
93
|
+
.array(z.cuid2())
|
|
94
|
+
.openapi({ example: ["cksd0v6q0000s9a5y8z7p3x9", "clm1a2b3c0000abc"] }),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// ==========================================
|
|
98
|
+
// 2. CONTENT ASSOCIATIONS (Projects, Posts)
|
|
99
|
+
// ==========================================
|
|
100
|
+
|
|
89
101
|
export const UserWithProjectsEntitySchema = z
|
|
90
102
|
.object({
|
|
91
103
|
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
@@ -95,6 +107,17 @@ export const UserWithProjectsEntitySchema = z
|
|
|
95
107
|
})
|
|
96
108
|
.openapi("UserWithProjectsEntity");
|
|
97
109
|
|
|
110
|
+
export const UserWithPostsEntitySchema = z
|
|
111
|
+
.object({
|
|
112
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
113
|
+
posts: z.array(PostWithFilesEntitySchema).openapi({ example: [] }),
|
|
114
|
+
})
|
|
115
|
+
.openapi("UserWithPostsEntity");
|
|
116
|
+
|
|
117
|
+
// ==========================================
|
|
118
|
+
// 3. LIKES
|
|
119
|
+
// ==========================================
|
|
120
|
+
|
|
98
121
|
export const UserWithProjectLikesEntitySchema = z.object({
|
|
99
122
|
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
100
123
|
projectLikes: z
|
|
@@ -119,25 +142,6 @@ export const UserWithPostLikesEntitySchema = z.object({
|
|
|
119
142
|
postLikes: z
|
|
120
143
|
.array(
|
|
121
144
|
LikeEntitySchema.extend({
|
|
122
|
-
post: PostEntitySchema.pick({
|
|
123
|
-
id: true,
|
|
124
|
-
parentId: true,
|
|
125
|
-
title: true, // Note: Make sure 'title' exists on PostEntitySchema in your post.ts!
|
|
126
|
-
content: true,
|
|
127
|
-
tags: true,
|
|
128
|
-
createdAt: true,
|
|
129
|
-
updatedAt: true, // Note: Make sure 'updatedAt' exists on PostEntitySchema as well!
|
|
130
|
-
}),
|
|
131
|
-
}),
|
|
132
|
-
)
|
|
133
|
-
.openapi({ example: [] }),
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
export const UserWithPostBookmarksEntitySchema = z.object({
|
|
137
|
-
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
138
|
-
postBookmarks: z
|
|
139
|
-
.array(
|
|
140
|
-
BookmarkEntitySchema.extend({
|
|
141
145
|
post: PostEntitySchema.pick({
|
|
142
146
|
id: true,
|
|
143
147
|
parentId: true,
|
|
@@ -152,6 +156,10 @@ export const UserWithPostBookmarksEntitySchema = z.object({
|
|
|
152
156
|
.openapi({ example: [] }),
|
|
153
157
|
});
|
|
154
158
|
|
|
159
|
+
// ==========================================
|
|
160
|
+
// 4. BOOKMARKS
|
|
161
|
+
// ==========================================
|
|
162
|
+
|
|
155
163
|
export const UserWithJobBookmarksEntitySchema = z.object({
|
|
156
164
|
userId: z.cuid2().openapi({ example: "afoaifaofi" }),
|
|
157
165
|
jobBookmarks: z
|
|
@@ -181,31 +189,41 @@ export const UserWithProjectBookmarksEntitySchema = z
|
|
|
181
189
|
projectBookmarks: z
|
|
182
190
|
.array(
|
|
183
191
|
BookmarkEntitySchema.extend({
|
|
184
|
-
project:
|
|
185
|
-
id: true,
|
|
186
|
-
title: true,
|
|
187
|
-
description: true,
|
|
188
|
-
tags: true,
|
|
189
|
-
startDate: true,
|
|
190
|
-
endDate: true,
|
|
191
|
-
imagePlaceholderUrl: true,
|
|
192
|
-
}),
|
|
192
|
+
project: ProjectSearchDocumentSchema,
|
|
193
193
|
}),
|
|
194
194
|
)
|
|
195
195
|
.openapi({ example: [] }),
|
|
196
196
|
})
|
|
197
197
|
.openapi("UserWithProjectBookmarksEntity");
|
|
198
198
|
|
|
199
|
-
export const
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
export const UserWithPostBookmarksEntitySchema = z.object({
|
|
200
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
201
|
+
postBookmarks: z.array(
|
|
202
|
+
BookmarkEntitySchema.extend({
|
|
203
|
+
post: FeedPostEntitySchema,
|
|
204
|
+
}),
|
|
205
|
+
),
|
|
202
206
|
});
|
|
203
207
|
|
|
204
|
-
export const
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
export const GetUserWithProjectBookmarksInputSchema =
|
|
209
|
+
UserWithJobBookmarksInputSchema;
|
|
210
|
+
export const GetUserWithPostBookmarksInputSchema =
|
|
211
|
+
UserWithJobBookmarksInputSchema;
|
|
212
|
+
|
|
213
|
+
export const GetUserWithProjectBookmarksOutputSchema = z.object({
|
|
214
|
+
bookmarks: UserWithProjectBookmarksEntitySchema,
|
|
215
|
+
nextCursor: z.string().nullable(),
|
|
207
216
|
});
|
|
208
217
|
|
|
218
|
+
export const GetUserWithPostBookmarksOutputSchema = z.object({
|
|
219
|
+
bookmarks: UserWithPostBookmarksEntitySchema,
|
|
220
|
+
nextCursor: z.string().nullable(),
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// ==========================================
|
|
224
|
+
// 5. FOLLOWERS & FOLLOWING
|
|
225
|
+
// ==========================================
|
|
226
|
+
|
|
209
227
|
export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
|
|
210
228
|
following: z
|
|
211
229
|
.array(
|
|
@@ -234,36 +252,43 @@ export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
|
|
|
234
252
|
}),
|
|
235
253
|
}).openapi("UserWithFollowersEntity");
|
|
236
254
|
|
|
237
|
-
export const
|
|
255
|
+
export const GetUserFollowingInputSchema = z.object({
|
|
256
|
+
searchQuery: z.string().optional().openapi({ example: "design systems" }),
|
|
257
|
+
offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
export const GetUserFollowersInputSchema = z.object({
|
|
261
|
+
searchQuery: z.string().optional().openapi({ example: "design systems" }),
|
|
262
|
+
offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
export const GetUserFollowingOutputSchema = z.object({
|
|
238
266
|
nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
239
|
-
|
|
267
|
+
following: z
|
|
240
268
|
.array(
|
|
241
269
|
MinimalUserSchema.extend({
|
|
242
|
-
isFollowing: z.boolean().optional().openapi({ example:
|
|
243
|
-
followsYou: z.boolean().optional().openapi({ example:
|
|
270
|
+
isFollowing: z.boolean().optional().openapi({ example: true }),
|
|
271
|
+
followsYou: z.boolean().optional().openapi({ example: false }),
|
|
244
272
|
}),
|
|
245
273
|
)
|
|
246
274
|
.openapi({ example: [] }),
|
|
247
275
|
});
|
|
248
276
|
|
|
249
|
-
export const
|
|
277
|
+
export const GetUserFollowersOutputSchema = z.object({
|
|
250
278
|
nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
|
|
251
|
-
|
|
279
|
+
followers: z
|
|
252
280
|
.array(
|
|
253
281
|
MinimalUserSchema.extend({
|
|
254
|
-
isFollowing: z.boolean().optional().openapi({ example:
|
|
255
|
-
followsYou: z.boolean().optional().openapi({ example:
|
|
282
|
+
isFollowing: z.boolean().optional().openapi({ example: false }),
|
|
283
|
+
followsYou: z.boolean().optional().openapi({ example: true }),
|
|
256
284
|
}),
|
|
257
285
|
)
|
|
258
286
|
.openapi({ example: [] }),
|
|
259
287
|
});
|
|
260
288
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
posts: z.array(PostWithFilesEntitySchema).openapi({ example: [] }),
|
|
265
|
-
})
|
|
266
|
-
.openapi("UserWithPostsEntity");
|
|
289
|
+
// ==========================================
|
|
290
|
+
// 6. AUTHENTICATED USER OUTPUTS
|
|
291
|
+
// ==========================================
|
|
267
292
|
|
|
268
293
|
export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
|
|
269
294
|
export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
|
|
@@ -271,12 +296,16 @@ export const GetAuthenticatedUserWithProjectsOutputSchema =
|
|
|
271
296
|
UserWithProjectsEntitySchema;
|
|
272
297
|
export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
|
|
273
298
|
UserWithProjectBookmarksEntitySchema;
|
|
299
|
+
export const GetAuthenticatedUserWithProjectLikesOutputSchema =
|
|
300
|
+
UserWithProjectLikesEntitySchema;
|
|
274
301
|
export const GetAuthenticatedUserWithUserFollowingOutputSchema =
|
|
275
302
|
UserWithFollowingEntitySchema;
|
|
276
303
|
export const GetAuthenticatedUserWithUserFollowersOutputSchema =
|
|
277
304
|
UserWithFollowersEntitySchema;
|
|
278
|
-
|
|
279
|
-
|
|
305
|
+
|
|
306
|
+
// ==========================================
|
|
307
|
+
// 7. ACTIVITY
|
|
308
|
+
// ==========================================
|
|
280
309
|
|
|
281
310
|
export const GetUserActivityInputSchema = z.object({
|
|
282
311
|
activityType: z
|
|
@@ -300,6 +329,10 @@ export const GetUserActivityOutputSchema = z
|
|
|
300
329
|
)
|
|
301
330
|
.openapi({ example: [] });
|
|
302
331
|
|
|
332
|
+
// ==========================================
|
|
333
|
+
// 8. SEARCH
|
|
334
|
+
// ==========================================
|
|
335
|
+
|
|
303
336
|
export const SearchUsersInputSchema = z.object({
|
|
304
337
|
query: z.string().default("").openapi({
|
|
305
338
|
example: "john",
|