@zyacreatives/shared 2.1.41 → 2.1.43

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,18 +1,18 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
 
3
3
  import {
4
- ROLES,
5
- USER_STATUSES,
6
- ONBOARDING_PAGES,
7
- ACTIVITY_TYPES,
8
- ACTIVITY_PARENT_TYPES,
4
+ ROLES,
5
+ USER_STATUSES,
6
+ ONBOARDING_PAGES,
7
+ ACTIVITY_TYPES,
8
+ ACTIVITY_PARENT_TYPES,
9
9
  } from "../constants";
10
10
  import type {
11
- Role,
12
- UserStatus,
13
- OnboardingPage,
14
- ActivityType,
15
- ActivityParentType,
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,136 +23,143 @@ import { InvestorEntitySchema } from "./investor";
23
23
  import { PostWithFilesEntitySchema } from "./post";
24
24
 
25
25
  export const UserEntitySchema = z
26
- .object({
27
- id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
28
- email: z.string().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 [OnboardingPage, ...OnboardingPage[]]
48
- )
49
- .openapi({
50
- example: "DONE",
51
- }),
52
- createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
53
- updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
54
- })
55
- .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
56
+ .date()
57
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
58
+ updatedAt: z.coerce
59
+ .date()
60
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
61
+ })
62
+ .openapi("BaseUserEntity");
56
63
 
57
64
  export const MinimalUserSchema = UserEntitySchema.pick({
58
- id: true,
59
- name: true,
60
- email: true,
61
- image: true,
62
- username: true,
63
- role: true,
65
+ id: true,
66
+ name: true,
67
+ email: true,
68
+ image: true,
69
+ username: true,
70
+ role: true,
64
71
  }).openapi("MinimalUser");
65
72
 
66
73
  export const UserStatsEntitySchema = z.object({
67
- followerCount: z.int(),
68
- followingCount: z.int(),
69
- followingIds: z.array(z.string()),
74
+ followerCount: z.int(),
75
+ followingCount: z.int(),
76
+ followingIds: z.array(z.string()),
70
77
  });
71
78
 
72
79
  export const UserProfileEntitySchema = UserEntitySchema.extend({
73
- profileType: z.enum(["creative", "brand", "investor"]).optional(),
74
- brand: BrandEntitySchema,
75
- creative: CreativeEntitySchema,
76
- investor: InvestorEntitySchema,
80
+ profileType: z.enum(["creative", "brand", "investor"]).optional(),
81
+ brand: BrandEntitySchema,
82
+ creative: CreativeEntitySchema,
83
+ investor: InvestorEntitySchema,
77
84
  }).openapi("UserProfileEntity");
78
85
 
79
86
  export const UserWithProjectsEntitySchema = z
80
- .object({
81
- userId: z.cuid2(),
82
- projects: z.array(ProjectEntitySchema.omit({ overview: true })),
83
- })
84
- .openapi("UserWithProjectsEntity");
85
-
86
- export const UserWithProjectLikesEntitySchema = z.object({
87
- userId: z.cuid2(),
88
- projectLikes: z.array(
89
- LikeEntitySchema.extend({
90
- project: ProjectEntitySchema.pick({
91
- id: true,
92
- title: true,
93
- description: true,
94
- tags: true,
95
- startDate: true,
96
- endDate: true,
97
- imagePlaceholderUrl: true,
98
- }),
87
+ .object({
88
+ userId: z.cuid2(),
89
+ projects: z.array(ProjectEntitySchema.omit({ overview: true })),
99
90
  })
100
- ),
101
- });
91
+ .openapi("UserWithProjectsEntity");
102
92
 
103
- export const UserWithProjectBookmarksEntitySchema = z
104
- .object({
93
+ export const UserWithProjectLikesEntitySchema = z.object({
105
94
  userId: z.cuid2(),
106
- projectBookmarks: z.array(
107
- BookmarkEntitySchema.extend({
108
- project: ProjectEntitySchema.pick({
109
- id: true,
110
- title: true,
111
- description: true,
112
- tags: true,
113
- startDate: true,
114
- endDate: true,
115
- imagePlaceholderUrl: true,
95
+ projectLikes: z.array(
96
+ LikeEntitySchema.extend({
97
+ project: ProjectEntitySchema.pick({
98
+ id: true,
99
+ title: true,
100
+ description: true,
101
+ tags: true,
102
+ startDate: true,
103
+ endDate: true,
104
+ imagePlaceholderUrl: true,
105
+ }),
116
106
  }),
117
- })
118
107
  ),
119
- })
120
- .openapi("UserWithProjectBookmarksEntity");
108
+ });
109
+
110
+ export const UserWithProjectBookmarksEntitySchema = z
111
+ .object({
112
+ userId: z.cuid2(),
113
+ projectBookmarks: z.array(
114
+ BookmarkEntitySchema.extend({
115
+ project: ProjectEntitySchema.pick({
116
+ id: true,
117
+ title: true,
118
+ description: true,
119
+ tags: true,
120
+ startDate: true,
121
+ endDate: true,
122
+ imagePlaceholderUrl: true,
123
+ }),
124
+ }),
125
+ ),
126
+ })
127
+ .openapi("UserWithProjectBookmarksEntity");
121
128
 
122
129
  export const GetUserFollowingInputSchema = z.object({
123
- searchQuery: z.string().optional().openapi({ example: "design systems" }),
124
- offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
130
+ searchQuery: z.string().optional().openapi({ example: "design systems" }),
131
+ offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
125
132
  });
126
133
 
127
134
  export const GetUserFollowersInputSchema = z.object({
128
- searchQuery: z.string().optional().openapi({ example: "design systems" }),
129
- offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
135
+ searchQuery: z.string().optional().openapi({ example: "design systems" }),
136
+ offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
130
137
  });
131
138
  export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
132
- following: z
133
- .array(MinimalUserSchema)
134
- .openapi({ description: "List of users this user is following." }),
139
+ following: z
140
+ .array(MinimalUserSchema)
141
+ .openapi({ description: "List of users this user is following." }),
135
142
  }).openapi("UserWithFollowingEntity");
136
143
 
137
144
  export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
138
- followers: z
139
- .array(MinimalUserSchema)
140
- .openapi({ description: "List of users who follow this user." }),
145
+ followers: z
146
+ .array(MinimalUserSchema)
147
+ .openapi({ description: "List of users who follow this user." }),
141
148
  }).openapi("UserWithFollowersEntity");
142
149
 
143
150
  export const UserWithPostsEntitySchema = z
144
- .object({
145
- userId: z.cuid2(),
146
- posts: z.array(PostWithFilesEntitySchema),
147
- })
148
- .openapi("UserWithPostsEntity");
151
+ .object({
152
+ userId: z.cuid2(),
153
+ posts: z.array(PostWithFilesEntitySchema),
154
+ })
155
+ .openapi("UserWithPostsEntity");
149
156
 
150
157
  export const GetUserFollowingOutputSchema = z.object({
151
- results: UserWithFollowingEntitySchema,
158
+ results: UserWithFollowingEntitySchema,
152
159
  });
153
160
 
154
161
  export const GetUserFollowersOutputSchema = z.object({
155
- results: UserWithFollowersEntitySchema,
162
+ results: UserWithFollowersEntitySchema,
156
163
  });
157
164
 
158
165
  export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
@@ -160,34 +167,34 @@ export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
160
167
  export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
161
168
 
162
169
  export const GetAuthenticatedUserWithProjectsOutputSchema =
163
- UserWithProjectsEntitySchema;
170
+ UserWithProjectsEntitySchema;
164
171
 
165
172
  export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
166
- UserWithProjectBookmarksEntitySchema;
173
+ UserWithProjectBookmarksEntitySchema;
167
174
 
168
175
  export const GetAuthenticatedUserWithUserFollowingOutputSchema =
169
- UserWithFollowingEntitySchema;
176
+ UserWithFollowingEntitySchema;
170
177
 
171
178
  export const GetAuthenticatedUserWithUserFollowersOutputSchema =
172
- UserWithFollowersEntitySchema;
179
+ UserWithFollowersEntitySchema;
173
180
 
174
181
  export const GetAuthenticatedUserWithProjectLikesOutputSchema =
175
- UserWithProjectLikesEntitySchema;
182
+ UserWithProjectLikesEntitySchema;
176
183
 
177
184
  export const GetUserActivityInputSchema = z.object({
178
- activityType: z.enum(
179
- Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]]
180
- ),
185
+ activityType: z.enum(
186
+ Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]],
187
+ ),
181
188
  });
182
189
 
183
190
  export const GetUserActivityOutputSchema = z.array(
184
- z.object({
185
- parentId: z.string(),
186
- parentType: z.enum(
187
- Object.values(ACTIVITY_PARENT_TYPES) as [
188
- ActivityParentType,
189
- ...ActivityParentType[]
190
- ]
191
- ),
192
- })
191
+ z.object({
192
+ parentId: z.string(),
193
+ parentType: z.enum(
194
+ Object.values(ACTIVITY_PARENT_TYPES) as [
195
+ ActivityParentType,
196
+ ...ActivityParentType[],
197
+ ],
198
+ ),
199
+ }),
193
200
  );