@zyacreatives/shared 2.2.77 → 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.
@@ -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.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.GetAuthenticatedUserProfileOutputSchema = exports.GetAuthenticatedUserOutputSchema = exports.UserWithPostsEntitySchema = exports.GetUserFollowingOutputSchema = exports.GetUserFollowersOutputSchema = exports.UserWithFollowersEntitySchema = exports.UserWithFollowingEntitySchema = exports.GetUserFollowersInputSchema = exports.GetUserFollowingInputSchema = exports.UserWithProjectBookmarksEntitySchema = exports.UserWithJobBookmarksOutputSchema = exports.UserWithJobBookmarksInputSchema = exports.UserWithJobBookmarksEntitySchema = exports.UserWithPostBookmarksEntitySchema = exports.UserWithPostLikesEntitySchema = exports.UserWithProjectLikesEntitySchema = exports.UserWithProjectsEntitySchema = exports.UserProfileEntitySchema = exports.UserStatsEntitySchema = exports.MinimalUserSchema = exports.UserEntitySchema = void 0;
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,11 +120,18 @@ 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
- jobBookmarks: zod_openapi_1.z.array(bookmark_1.BookmarkEntitySchema.extend({
127
- job: job_1.JobSearchDocumentSchema,
128
- })).optional(),
128
+ jobBookmarks: zod_openapi_1.z
129
+ .array(bookmark_1.BookmarkEntitySchema.extend({
130
+ job: job_1.JobSearchDocumentSchema.extend({
131
+ isBookmarked: zod_openapi_1.z.boolean().default(true),
132
+ }),
133
+ }))
134
+ .optional(),
129
135
  });
130
136
  exports.UserWithJobBookmarksInputSchema = zod_openapi_1.z.object({
131
137
  cursor: zod_openapi_1.z.string().optional().nullable(),
@@ -140,27 +146,30 @@ exports.UserWithProjectBookmarksEntitySchema = zod_openapi_1.z
140
146
  userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
141
147
  projectBookmarks: zod_openapi_1.z
142
148
  .array(bookmark_1.BookmarkEntitySchema.extend({
143
- project: project_1.ProjectEntitySchema.pick({
144
- id: true,
145
- title: true,
146
- description: true,
147
- tags: true,
148
- startDate: true,
149
- endDate: true,
150
- imagePlaceholderUrl: true,
151
- }),
149
+ project: project_1.ProjectSearchDocumentSchema,
152
150
  }))
153
151
  .openapi({ example: [] }),
154
152
  })
155
153
  .openapi("UserWithProjectBookmarksEntity");
156
- exports.GetUserFollowingInputSchema = zod_openapi_1.z.object({
157
- searchQuery: zod_openapi_1.z.string().optional().openapi({ example: "design systems" }),
158
- offset: zod_openapi_1.z.number().int().nonnegative().optional().openapi({ example: 20 }),
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
+ })),
159
159
  });
160
- exports.GetUserFollowersInputSchema = zod_openapi_1.z.object({
161
- searchQuery: zod_openapi_1.z.string().optional().openapi({ example: "design systems" }),
162
- offset: zod_openapi_1.z.number().int().nonnegative().optional().openapi({ example: 20 }),
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(),
165
+ });
166
+ exports.GetUserWithPostBookmarksOutputSchema = zod_openapi_1.z.object({
167
+ bookmarks: exports.UserWithPostBookmarksEntitySchema,
168
+ nextCursor: zod_openapi_1.z.string().nullable(),
163
169
  });
170
+ // ==========================================
171
+ // 5. FOLLOWERS & FOLLOWING
172
+ // ==========================================
164
173
  exports.UserWithFollowingEntitySchema = exports.MinimalUserSchema.extend({
165
174
  following: zod_openapi_1.z
166
175
  .array(exports.MinimalUserSchema.extend({
@@ -183,14 +192,13 @@ exports.UserWithFollowersEntitySchema = exports.MinimalUserSchema.extend({
183
192
  example: [],
184
193
  }),
185
194
  }).openapi("UserWithFollowersEntity");
186
- exports.GetUserFollowersOutputSchema = zod_openapi_1.z.object({
187
- nextCursor: zod_openapi_1.z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
188
- followers: zod_openapi_1.z
189
- .array(exports.MinimalUserSchema.extend({
190
- isFollowing: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
191
- followsYou: zod_openapi_1.z.boolean().optional().openapi({ example: true }),
192
- }))
193
- .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 }),
194
202
  });
195
203
  exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
196
204
  nextCursor: zod_openapi_1.z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
@@ -201,19 +209,28 @@ exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
201
209
  }))
202
210
  .openapi({ example: [] }),
203
211
  });
204
- exports.UserWithPostsEntitySchema = zod_openapi_1.z
205
- .object({
206
- userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
207
- posts: zod_openapi_1.z.array(post_1.PostWithFilesEntitySchema).openapi({ example: [] }),
208
- })
209
- .openapi("UserWithPostsEntity");
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
+ // ==========================================
210
224
  exports.GetAuthenticatedUserOutputSchema = exports.UserEntitySchema;
211
225
  exports.GetAuthenticatedUserProfileOutputSchema = exports.UserProfileEntitySchema;
212
226
  exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.UserWithProjectsEntitySchema;
213
227
  exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.UserWithProjectBookmarksEntitySchema;
228
+ exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.UserWithProjectLikesEntitySchema;
214
229
  exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.UserWithFollowingEntitySchema;
215
230
  exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.UserWithFollowersEntitySchema;
216
- exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.UserWithProjectLikesEntitySchema;
231
+ // ==========================================
232
+ // 7. ACTIVITY
233
+ // ==========================================
217
234
  exports.GetUserActivityInputSchema = zod_openapi_1.z.object({
218
235
  activityType: zod_openapi_1.z
219
236
  .enum(Object.values(constants_1.ACTIVITY_TYPES))
@@ -227,6 +244,9 @@ exports.GetUserActivityOutputSchema = zod_openapi_1.z
227
244
  .openapi({ example: "POST" }),
228
245
  }))
229
246
  .openapi({ example: [] });
247
+ // ==========================================
248
+ // 8. SEARCH
249
+ // ==========================================
230
250
  exports.SearchUsersInputSchema = zod_openapi_1.z.object({
231
251
  query: zod_openapi_1.z.string().default("").openapi({
232
252
  example: "john",
@@ -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 UserWithProjectBookmarksEntity = z.infer<typeof UserWithProjectBookmarksEntitySchema>;
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 UserWithUserPostsEntity = z.infer<typeof UserWithPostsEntitySchema>;
13
- export type GetUserFollowingInput = z.infer<typeof GetUserFollowingInputSchema>;
14
- export type GetUserFollowersInput = z.infer<typeof GetUserFollowersInputSchema>;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.77",
3
+ "version": "2.2.79",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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 { PostEntitySchema, PostWithFilesEntitySchema } from "./post";
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
@@ -122,43 +145,32 @@ export const UserWithPostLikesEntitySchema = z.object({
122
145
  post: PostEntitySchema.pick({
123
146
  id: true,
124
147
  parentId: true,
125
- title: true, // Note: Make sure 'title' exists on PostEntitySchema in your post.ts!
148
+ title: true,
126
149
  content: true,
127
150
  tags: true,
128
151
  createdAt: true,
129
- updatedAt: true, // Note: Make sure 'updatedAt' exists on PostEntitySchema as well!
152
+ updatedAt: true,
130
153
  }),
131
154
  }),
132
155
  )
133
156
  .openapi({ example: [] }),
134
157
  });
135
158
 
136
- export const UserWithPostBookmarksEntitySchema = z.object({
137
- userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
138
- postBookmarks: z
159
+ // ==========================================
160
+ // 4. BOOKMARKS
161
+ // ==========================================
162
+
163
+ export const UserWithJobBookmarksEntitySchema = z.object({
164
+ userId: z.cuid2().openapi({ example: "afoaifaofi" }),
165
+ jobBookmarks: z
139
166
  .array(
140
167
  BookmarkEntitySchema.extend({
141
- post: PostEntitySchema.pick({
142
- id: true,
143
- parentId: true,
144
- title: true,
145
- content: true,
146
- tags: true,
147
- createdAt: true,
148
- updatedAt: true,
168
+ job: JobSearchDocumentSchema.extend({
169
+ isBookmarked: z.boolean().default(true),
149
170
  }),
150
171
  }),
151
172
  )
152
- .openapi({ example: [] }),
153
- });
154
-
155
- export const UserWithJobBookmarksEntitySchema = z.object({
156
- userId: z.cuid2().openapi({ example: "afoaifaofi" }),
157
- jobBookmarks: z.array(
158
- BookmarkEntitySchema.extend({
159
- job: JobSearchDocumentSchema,
160
- }),
161
- ).optional(),
173
+ .optional(),
162
174
  });
163
175
 
164
176
  export const UserWithJobBookmarksInputSchema = z.object({
@@ -177,31 +189,41 @@ export const UserWithProjectBookmarksEntitySchema = z
177
189
  projectBookmarks: z
178
190
  .array(
179
191
  BookmarkEntitySchema.extend({
180
- project: ProjectEntitySchema.pick({
181
- id: true,
182
- title: true,
183
- description: true,
184
- tags: true,
185
- startDate: true,
186
- endDate: true,
187
- imagePlaceholderUrl: true,
188
- }),
192
+ project: ProjectSearchDocumentSchema,
189
193
  }),
190
194
  )
191
195
  .openapi({ example: [] }),
192
196
  })
193
197
  .openapi("UserWithProjectBookmarksEntity");
194
198
 
195
- export const GetUserFollowingInputSchema = z.object({
196
- searchQuery: z.string().optional().openapi({ example: "design systems" }),
197
- offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
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
+ ),
198
206
  });
199
207
 
200
- export const GetUserFollowersInputSchema = z.object({
201
- searchQuery: z.string().optional().openapi({ example: "design systems" }),
202
- offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
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(),
216
+ });
217
+
218
+ export const GetUserWithPostBookmarksOutputSchema = z.object({
219
+ bookmarks: UserWithPostBookmarksEntitySchema,
220
+ nextCursor: z.string().nullable(),
203
221
  });
204
222
 
223
+ // ==========================================
224
+ // 5. FOLLOWERS & FOLLOWING
225
+ // ==========================================
226
+
205
227
  export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
206
228
  following: z
207
229
  .array(
@@ -230,36 +252,43 @@ export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
230
252
  }),
231
253
  }).openapi("UserWithFollowersEntity");
232
254
 
233
- export const GetUserFollowersOutputSchema = z.object({
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({
234
266
  nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
235
- followers: z
267
+ following: z
236
268
  .array(
237
269
  MinimalUserSchema.extend({
238
- isFollowing: z.boolean().optional().openapi({ example: false }),
239
- followsYou: z.boolean().optional().openapi({ example: true }),
270
+ isFollowing: z.boolean().optional().openapi({ example: true }),
271
+ followsYou: z.boolean().optional().openapi({ example: false }),
240
272
  }),
241
273
  )
242
274
  .openapi({ example: [] }),
243
275
  });
244
276
 
245
- export const GetUserFollowingOutputSchema = z.object({
277
+ export const GetUserFollowersOutputSchema = z.object({
246
278
  nextCursor: z.string().openapi({ example: "cksd0v6q0000nxtcur" }),
247
- following: z
279
+ followers: z
248
280
  .array(
249
281
  MinimalUserSchema.extend({
250
- isFollowing: z.boolean().optional().openapi({ example: true }),
251
- followsYou: z.boolean().optional().openapi({ example: false }),
282
+ isFollowing: z.boolean().optional().openapi({ example: false }),
283
+ followsYou: z.boolean().optional().openapi({ example: true }),
252
284
  }),
253
285
  )
254
286
  .openapi({ example: [] }),
255
287
  });
256
288
 
257
- export const UserWithPostsEntitySchema = z
258
- .object({
259
- userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
260
- posts: z.array(PostWithFilesEntitySchema).openapi({ example: [] }),
261
- })
262
- .openapi("UserWithPostsEntity");
289
+ // ==========================================
290
+ // 6. AUTHENTICATED USER OUTPUTS
291
+ // ==========================================
263
292
 
264
293
  export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
265
294
  export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
@@ -267,12 +296,16 @@ export const GetAuthenticatedUserWithProjectsOutputSchema =
267
296
  UserWithProjectsEntitySchema;
268
297
  export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
269
298
  UserWithProjectBookmarksEntitySchema;
299
+ export const GetAuthenticatedUserWithProjectLikesOutputSchema =
300
+ UserWithProjectLikesEntitySchema;
270
301
  export const GetAuthenticatedUserWithUserFollowingOutputSchema =
271
302
  UserWithFollowingEntitySchema;
272
303
  export const GetAuthenticatedUserWithUserFollowersOutputSchema =
273
304
  UserWithFollowersEntitySchema;
274
- export const GetAuthenticatedUserWithProjectLikesOutputSchema =
275
- UserWithProjectLikesEntitySchema;
305
+
306
+ // ==========================================
307
+ // 7. ACTIVITY
308
+ // ==========================================
276
309
 
277
310
  export const GetUserActivityInputSchema = z.object({
278
311
  activityType: z
@@ -296,6 +329,10 @@ export const GetUserActivityOutputSchema = z
296
329
  )
297
330
  .openapi({ example: [] });
298
331
 
332
+ // ==========================================
333
+ // 8. SEARCH
334
+ // ==========================================
335
+
299
336
  export const SearchUsersInputSchema = z.object({
300
337
  query: z.string().default("").openapi({
301
338
  example: "john",