@zyacreatives/shared 2.1.41 → 2.1.42
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 +2 -12
- package/dist/schemas/brand.js +20 -30
- package/dist/schemas/creative.d.ts +2 -11
- package/dist/schemas/creative.js +14 -19
- package/dist/schemas/job-application.d.ts +2 -2
- package/dist/schemas/notification.d.ts +4 -4
- package/dist/schemas/notification.js +0 -5
- package/dist/schemas/project.d.ts +2 -2
- package/dist/schemas/user.d.ts +17 -21
- package/dist/schemas/user.js +7 -3
- package/package.json +1 -1
- package/src/schemas/brand.ts +159 -168
- package/src/schemas/creative.ts +235 -237
- package/src/schemas/notification.ts +0 -6
- package/src/schemas/user.ts +130 -123
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,136 +23,143 @@ import { InvestorEntitySchema } from "./investor";
|
|
|
23
23
|
import { 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
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
104
|
-
.object({
|
|
93
|
+
export const UserWithProjectLikesEntitySchema = z.object({
|
|
105
94
|
userId: z.cuid2(),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
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
|
-
|
|
124
|
-
|
|
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
|
-
|
|
129
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
158
|
+
results: UserWithFollowingEntitySchema,
|
|
152
159
|
});
|
|
153
160
|
|
|
154
161
|
export const GetUserFollowersOutputSchema = z.object({
|
|
155
|
-
|
|
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
|
-
|
|
170
|
+
UserWithProjectsEntitySchema;
|
|
164
171
|
|
|
165
172
|
export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
|
|
166
|
-
|
|
173
|
+
UserWithProjectBookmarksEntitySchema;
|
|
167
174
|
|
|
168
175
|
export const GetAuthenticatedUserWithUserFollowingOutputSchema =
|
|
169
|
-
|
|
176
|
+
UserWithFollowingEntitySchema;
|
|
170
177
|
|
|
171
178
|
export const GetAuthenticatedUserWithUserFollowersOutputSchema =
|
|
172
|
-
|
|
179
|
+
UserWithFollowersEntitySchema;
|
|
173
180
|
|
|
174
181
|
export const GetAuthenticatedUserWithProjectLikesOutputSchema =
|
|
175
|
-
|
|
182
|
+
UserWithProjectLikesEntitySchema;
|
|
176
183
|
|
|
177
184
|
export const GetUserActivityInputSchema = z.object({
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
);
|