@zyacreatives/shared 1.0.0 → 1.1.0
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/constants.d.ts +277 -0
- package/dist/constants.js +268 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/schemas/brand.d.ts +84 -0
- package/dist/schemas/brand.js +68 -0
- package/dist/schemas/common.d.ts +33 -0
- package/dist/schemas/common.js +58 -0
- package/dist/schemas/creative.d.ts +113 -0
- package/dist/schemas/creative.js +102 -0
- package/dist/schemas/user.d.ts +179 -0
- package/dist/schemas/user.js +93 -0
- package/dist/types/brand.d.ts +24 -0
- package/dist/types/brand.js +2 -0
- package/dist/types/common.d.ts +10 -0
- package/dist/types/common.js +2 -0
- package/dist/types/creative.d.ts +28 -0
- package/dist/types/creative.js +2 -0
- package/dist/types/discipline.d.ts +8 -0
- package/dist/types/discipline.js +2 -0
- package/dist/types/enums.d.ts +97 -0
- package/dist/types/enums.js +110 -0
- package/dist/types/file.d.ts +12 -0
- package/dist/types/file.js +2 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +24 -0
- package/dist/types/investor.d.ts +30 -0
- package/dist/types/investor.js +2 -0
- package/dist/types/project.d.ts +79 -0
- package/dist/types/project.js +2 -0
- package/dist/types/user.d.ts +42 -0
- package/dist/types/user.js +2 -0
- package/package.json +8 -3
- package/src/constants.ts +300 -0
- package/src/index.ts +1 -1
- package/src/schemas/brand.ts +91 -0
- package/src/schemas/common.ts +67 -0
- package/src/schemas/creative.ts +125 -0
- package/src/schemas/user.ts +125 -0
- package/src/types/brand.ts +27 -0
- package/src/types/common.ts +11 -0
- package/src/types/creative.ts +32 -0
- package/src/types/discipline.ts +9 -0
- package/src/types/file.ts +13 -0
- package/src/types/index.ts +8 -0
- package/src/types/investor.ts +38 -0
- package/src/types/project.ts +101 -0
- package/src/types/user.ts +60 -0
- package/tsconfig.json +5 -2
package/src/constants.ts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
export const ROLES = {
|
|
2
|
+
CREATIVE: "CREATIVE",
|
|
3
|
+
BRAND: "BRAND",
|
|
4
|
+
INVESTOR: "INVESTOR",
|
|
5
|
+
ADMIN: "ADMIN",
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export const USER_STATUSES = {
|
|
9
|
+
ACTIVE: "ACTIVE",
|
|
10
|
+
SUSPENDED: "SUSPENDED",
|
|
11
|
+
DELETED: "DELETED",
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export const CLIENT_TYPES = {
|
|
15
|
+
CREATIVE: "CREATIVE",
|
|
16
|
+
BRAND: "BRAND",
|
|
17
|
+
NONE: "NONE",
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
export const EXPERIENCE_LEVELS = {
|
|
21
|
+
YEAR_0_1: "0-1 year",
|
|
22
|
+
YEAR_1_3: "1-3 years",
|
|
23
|
+
YEAR_3_5: "3-5 years",
|
|
24
|
+
YEAR_5_PLUS: "5+ years",
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export const ONBOARDING_PAGES = {
|
|
28
|
+
EMAIL_VERIFICATION: "EMAIL_VERIFICATION",
|
|
29
|
+
USERNAME_SELECTION: "USERNAME_SELECTION",
|
|
30
|
+
ACCOUNT_TYPE_SELECTION: "ACCOUNT_TYPE_SELECTION",
|
|
31
|
+
CREATIVE_PROFILE_DETAILS: "CREATIVE_PROFILE_DETAILS",
|
|
32
|
+
CREATIVE_PROFILE_CUSTOMIZE_FEED: "CREATIVE_PROFILE_CUSTOMIZE_FEED",
|
|
33
|
+
CREATIVE_PROFILE_PORTFOLIO: "CREATIVE_PROFILE_PORTFOLIO",
|
|
34
|
+
BRAND_PROFILE_DETAILS: "BRAND_PROFILE_DETAILS",
|
|
35
|
+
BRAND_PROFILE_CUSTOMIZE_FEED: "BRAND_PROFILE_CUSTOMIZE_FEED",
|
|
36
|
+
BRAND_PROFILE_PORTFOLIO: "BRAND_PROFILE_PORTFOLIO",
|
|
37
|
+
INVESTOR_PROFILE_DETAILS: "INVESTOR_PROFILE_DETAILS",
|
|
38
|
+
INVESTOR_INVESTMENT_FOCUS: "INVESTOR_INVESTMENT_FOCUS",
|
|
39
|
+
INVESTOR_VERIFICATION: "INVESTOR_VERIFICATION",
|
|
40
|
+
DONE: "DONE",
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
export const INVESTOR_TYPES = {
|
|
44
|
+
ANGEL_INVESTOR: "Angel Investor",
|
|
45
|
+
VENTURE_CAPITALIST: "Venture Capitalist",
|
|
46
|
+
PRIVATE_EQUITY_FIRM: "Private Equity Firm",
|
|
47
|
+
VENTURE_DEBT_PROVIDER: "Venture Debt Provider",
|
|
48
|
+
BANK: "Bank",
|
|
49
|
+
CONVERTIBLE_NOTE_INVESTOR: "Convertible Note Investor",
|
|
50
|
+
REVENUE_BASED_FINANCING_INVESTOR: "Revenue Based Financing Investor",
|
|
51
|
+
CORPORATE_VENTURE_CAPITALIST: "Corporate Venture Capitalist",
|
|
52
|
+
GOVERNMENT: "Government",
|
|
53
|
+
SOCIAL_IMPACT_INVESTOR: "Social Impact Investor",
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
export const INVESTMENT_SIZES = {
|
|
57
|
+
UNDER_5K: "Under 5k USD",
|
|
58
|
+
BETWEEN_5K_25K: "5k - 25k USD",
|
|
59
|
+
BETWEEN_25K_100K: "25k - 100k USD",
|
|
60
|
+
BETWEEN_100K_500K: "100k - 500k USD",
|
|
61
|
+
BETWEEN_500K_1M: "500k - 1M USD",
|
|
62
|
+
OVER_1M: "1M+ USD",
|
|
63
|
+
} as const;
|
|
64
|
+
|
|
65
|
+
export const GEOGRAPHIC_FOCUS = {
|
|
66
|
+
AFRICA: "Africa",
|
|
67
|
+
ASIA: "Asia",
|
|
68
|
+
EUROPE: "Europe",
|
|
69
|
+
NORTH_AMERICA: "North America",
|
|
70
|
+
SOUTH_AMERICA: "South America",
|
|
71
|
+
MIDDLE_EAST: "Middle East",
|
|
72
|
+
OCEANIA: "Oceania",
|
|
73
|
+
UK: "United Kingdom (UK)",
|
|
74
|
+
US: "United States (US)",
|
|
75
|
+
GLOBAL: "Global",
|
|
76
|
+
OTHER: "Other",
|
|
77
|
+
} as const;
|
|
78
|
+
|
|
79
|
+
export const INVESTOR_VERIFICATION_DOCUMENT_STATUSES = {
|
|
80
|
+
PENDING: "PENDING",
|
|
81
|
+
APPROVED: "APPROVED",
|
|
82
|
+
REJECTED: "REJECTED",
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
export const INVESTOR_VERIFICATION_DOCUMENT_TYPES = {
|
|
86
|
+
ID_PROOF: "ID_PROOF",
|
|
87
|
+
BANK_STATEMENT: "BANK_STATEMENT",
|
|
88
|
+
TAX_DOCUMENT: "TAX_DOCUMENT",
|
|
89
|
+
BUSINESS_REGISTRATION: "BUSINESS_REGISTRATION",
|
|
90
|
+
OTHER_CERTIFICATE: "OTHER_CERTIFICATE",
|
|
91
|
+
} as const;
|
|
92
|
+
|
|
93
|
+
export const COMMENT_STATUSES = {
|
|
94
|
+
ACTIVE: "ACTIVE",
|
|
95
|
+
HIDDEN: "HIDDEN",
|
|
96
|
+
DELETED: "DELETED",
|
|
97
|
+
} as const;
|
|
98
|
+
|
|
99
|
+
export const FILE_VISIBILITIES = {
|
|
100
|
+
PUBLIC: "PUBLIC",
|
|
101
|
+
PRIVATE: "PRIVATE",
|
|
102
|
+
} as const;
|
|
103
|
+
|
|
104
|
+
export type Role = (typeof ROLES)[keyof typeof ROLES];
|
|
105
|
+
export type UserStatus = (typeof USER_STATUSES)[keyof typeof USER_STATUSES];
|
|
106
|
+
export type ClientType = (typeof CLIENT_TYPES)[keyof typeof CLIENT_TYPES];
|
|
107
|
+
export type ExperienceLevel =
|
|
108
|
+
(typeof EXPERIENCE_LEVELS)[keyof typeof EXPERIENCE_LEVELS];
|
|
109
|
+
export type OnboardingPage =
|
|
110
|
+
(typeof ONBOARDING_PAGES)[keyof typeof ONBOARDING_PAGES];
|
|
111
|
+
export type InvestorType = (typeof INVESTOR_TYPES)[keyof typeof INVESTOR_TYPES];
|
|
112
|
+
export type InvestmentSize =
|
|
113
|
+
(typeof INVESTMENT_SIZES)[keyof typeof INVESTMENT_SIZES];
|
|
114
|
+
export type GeographicFocus =
|
|
115
|
+
(typeof GEOGRAPHIC_FOCUS)[keyof typeof GEOGRAPHIC_FOCUS];
|
|
116
|
+
export type InvestorVerificationDocumentStatus =
|
|
117
|
+
(typeof INVESTOR_VERIFICATION_DOCUMENT_STATUSES)[keyof typeof INVESTOR_VERIFICATION_DOCUMENT_STATUSES];
|
|
118
|
+
export type InvestorVerificationDocumentType =
|
|
119
|
+
(typeof INVESTOR_VERIFICATION_DOCUMENT_TYPES)[keyof typeof INVESTOR_VERIFICATION_DOCUMENT_TYPES];
|
|
120
|
+
export type CommentStatus =
|
|
121
|
+
(typeof COMMENT_STATUSES)[keyof typeof COMMENT_STATUSES];
|
|
122
|
+
export type FileVisibility =
|
|
123
|
+
(typeof FILE_VISIBILITIES)[keyof typeof FILE_VISIBILITIES];
|
|
124
|
+
|
|
125
|
+
export const API_ROUTES = {
|
|
126
|
+
healthCheck: "/health",
|
|
127
|
+
username: {
|
|
128
|
+
base: "/usernames",
|
|
129
|
+
checkAvailability: "/:username/availability",
|
|
130
|
+
},
|
|
131
|
+
personal: {
|
|
132
|
+
base: "/me",
|
|
133
|
+
getUser: "",
|
|
134
|
+
getProfile: "/profile",
|
|
135
|
+
getProjects: "/projects",
|
|
136
|
+
getProjectBookmarks: "/project-bookmarks",
|
|
137
|
+
getFollowers: "/followers",
|
|
138
|
+
getFollowing: "/following",
|
|
139
|
+
},
|
|
140
|
+
user: {
|
|
141
|
+
base: "/users",
|
|
142
|
+
getUser: "/:value",
|
|
143
|
+
getProfile: "/:value/profile",
|
|
144
|
+
getProjects: "/:value/projects",
|
|
145
|
+
getFollowers: "/:userId/followers",
|
|
146
|
+
getFollowing: "/:userId/following",
|
|
147
|
+
followUser: "/:userId/follow",
|
|
148
|
+
unfollowUser: "/:userId/unfollow",
|
|
149
|
+
reserveUsername: "/reserve-username",
|
|
150
|
+
},
|
|
151
|
+
redirect: {
|
|
152
|
+
base: "/redirect",
|
|
153
|
+
passwordReset: "/password-reset",
|
|
154
|
+
verifiedUser: "/verified-user",
|
|
155
|
+
googleProfile: "/google-profile",
|
|
156
|
+
newGoogleProfile: "/new-google-profile",
|
|
157
|
+
},
|
|
158
|
+
file: {
|
|
159
|
+
base: "/files",
|
|
160
|
+
getPresignedUploadUrl: "/get-upload-url",
|
|
161
|
+
getPresignedDownloadUrl: "/:fileId/download-url",
|
|
162
|
+
getPublicUrl: "/:fileId/public-url",
|
|
163
|
+
createFile: "",
|
|
164
|
+
deleteFile: "/:fileId",
|
|
165
|
+
},
|
|
166
|
+
disciplines: {
|
|
167
|
+
base: "/disciplines",
|
|
168
|
+
getDisciplines: "",
|
|
169
|
+
getSingleDiscipline: "/:slug",
|
|
170
|
+
addDisciplines: "",
|
|
171
|
+
deleteDiscipline: "/:slug",
|
|
172
|
+
},
|
|
173
|
+
creatives: {
|
|
174
|
+
base: "/creatives",
|
|
175
|
+
createCreative: "",
|
|
176
|
+
getCreative: "/:value",
|
|
177
|
+
updateCreative: "",
|
|
178
|
+
},
|
|
179
|
+
brands: {
|
|
180
|
+
base: "/brands",
|
|
181
|
+
createBrand: "",
|
|
182
|
+
getBrand: "/:value",
|
|
183
|
+
updateBrand: "",
|
|
184
|
+
},
|
|
185
|
+
investors: {
|
|
186
|
+
base: "/investors",
|
|
187
|
+
createInvestor: "",
|
|
188
|
+
getInvestor: "/:value",
|
|
189
|
+
updateInvestor: "",
|
|
190
|
+
},
|
|
191
|
+
projects: {
|
|
192
|
+
base: "/projects",
|
|
193
|
+
createProject: "",
|
|
194
|
+
updateProject: "",
|
|
195
|
+
listProjects: "",
|
|
196
|
+
getProject: "/:projectId",
|
|
197
|
+
deleteProject: "/:projectId",
|
|
198
|
+
commentOnProject: "/:projectId/comment",
|
|
199
|
+
deleteCommentOnProject: "/:projectId/comments/:commentId",
|
|
200
|
+
bookmarkProject: "/:projectId/bookmark",
|
|
201
|
+
unbookmarkProject: "/:projectId/unbookmark",
|
|
202
|
+
likeProject: "/:projectId/like",
|
|
203
|
+
unlikeProject: "/:projectId/unlike",
|
|
204
|
+
viewProject: "/:projectId/view",
|
|
205
|
+
getProjectComments: "/:projectId/comments",
|
|
206
|
+
getProjectLikes: "/:projectId/likes",
|
|
207
|
+
getProjectBookmarks: "/:projectId/bookmarks",
|
|
208
|
+
getProjectViews: "/:projectId/views",
|
|
209
|
+
getProjectUser: "/:projectId/user",
|
|
210
|
+
},
|
|
211
|
+
} as const;
|
|
212
|
+
|
|
213
|
+
export const FRONTEND_API_ROUTES = {
|
|
214
|
+
healthCheck: "health",
|
|
215
|
+
username: {
|
|
216
|
+
base: "usernames",
|
|
217
|
+
checkAvailability: (username: string) => `${username}/availability`,
|
|
218
|
+
},
|
|
219
|
+
personal: {
|
|
220
|
+
base: "me",
|
|
221
|
+
getUser: "",
|
|
222
|
+
getProfile: "profile",
|
|
223
|
+
getProjects: "projects",
|
|
224
|
+
getProjectBookmarks: "project-bookmarks",
|
|
225
|
+
getFollowers: "followers",
|
|
226
|
+
getFollowing: "following",
|
|
227
|
+
},
|
|
228
|
+
user: {
|
|
229
|
+
base: "users",
|
|
230
|
+
getUser: (value: string) => `${value}`,
|
|
231
|
+
getProfile: (value: string) => `${value}/profile`,
|
|
232
|
+
getProjects: (value: string) => `${value}/projects`,
|
|
233
|
+
getFollowers: (userId: string) => `${userId}/followers`,
|
|
234
|
+
getFollowing: (userId: string) => `${userId}/following`,
|
|
235
|
+
followUser: (userId: string) => `${userId}/follow`,
|
|
236
|
+
unfollowUser: (userId: string) => `${userId}/unfollow`,
|
|
237
|
+
reserveUsername: "reserve-username",
|
|
238
|
+
},
|
|
239
|
+
redirect: {
|
|
240
|
+
base: "redirect",
|
|
241
|
+
passwordReset: "password-reset",
|
|
242
|
+
verifiedUser: "verified-user",
|
|
243
|
+
googleProfile: "google-profile",
|
|
244
|
+
newGoogleProfile: "new-google-profile",
|
|
245
|
+
},
|
|
246
|
+
file: {
|
|
247
|
+
base: "files",
|
|
248
|
+
getPresignedUploadUrl: "get-upload-url",
|
|
249
|
+
getPresignedDownloadUrl: (fileId: string) => `${fileId}/download-url`,
|
|
250
|
+
getPublicUrl: (fileId: string) => `${fileId}/public-url`,
|
|
251
|
+
createFile: "",
|
|
252
|
+
deleteFile: (fileId: string) => `${fileId}`,
|
|
253
|
+
},
|
|
254
|
+
disciplines: {
|
|
255
|
+
base: "disciplines",
|
|
256
|
+
getDisciplines: "",
|
|
257
|
+
getSingleDiscipline: (slug: string) => `${slug}`,
|
|
258
|
+
addDisciplines: "",
|
|
259
|
+
deleteDiscipline: (slug: string) => `${slug}`,
|
|
260
|
+
},
|
|
261
|
+
creatives: {
|
|
262
|
+
base: "creatives",
|
|
263
|
+
createCreative: "",
|
|
264
|
+
getCreative: (value: string) => `${value}`,
|
|
265
|
+
updateCreative: "",
|
|
266
|
+
},
|
|
267
|
+
brands: {
|
|
268
|
+
base: "brands",
|
|
269
|
+
createBrand: "",
|
|
270
|
+
getBrand: (value: string) => `${value}`,
|
|
271
|
+
updateBrand: "",
|
|
272
|
+
},
|
|
273
|
+
investors: {
|
|
274
|
+
base: "investors",
|
|
275
|
+
createInvestor: "",
|
|
276
|
+
getInvestor: (value: string) => `${value}`,
|
|
277
|
+
updateInvestor: "",
|
|
278
|
+
},
|
|
279
|
+
projects: {
|
|
280
|
+
base: "projects",
|
|
281
|
+
createProject: "",
|
|
282
|
+
updateProject: "",
|
|
283
|
+
listProjects: "",
|
|
284
|
+
getProject: (projectId: string) => `${projectId}`,
|
|
285
|
+
deleteProject: (projectId: string) => `${projectId}`,
|
|
286
|
+
commentOnProject: (projectId: string) => `${projectId}/comment`,
|
|
287
|
+
deleteCommentOnProject: (projectId: string, commentId: string) =>
|
|
288
|
+
`${projectId}/comments/${commentId}`,
|
|
289
|
+
bookmarkProject: (projectId: string) => `${projectId}/bookmark`,
|
|
290
|
+
unbookmarkProject: (projectId: string) => `${projectId}/unbookmark`,
|
|
291
|
+
likeProject: (projectId: string) => `${projectId}/like`,
|
|
292
|
+
unlikeProject: (projectId: string) => `${projectId}/unlike`,
|
|
293
|
+
viewProject: (projectId: string) => `${projectId}/view`,
|
|
294
|
+
getProjectComments: (projectId: string) => `${projectId}/comments`,
|
|
295
|
+
getProjectLikes: (projectId: string) => `${projectId}/likes`,
|
|
296
|
+
getProjectBookmarks: (projectId: string) => `${projectId}/bookmarks`,
|
|
297
|
+
getProjectViews: (projectId: string) => `${projectId}/views`,
|
|
298
|
+
getProjectUser: (projectId: string) => `${projectId}/user`,
|
|
299
|
+
},
|
|
300
|
+
} as const;
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./types/index";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { CuidSchema, ProfileIdentifierSchema } from "./common";
|
|
3
|
+
import { MinimalUserSchema } from "./user";
|
|
4
|
+
|
|
5
|
+
export const BrandEntitySchema = z
|
|
6
|
+
.object({
|
|
7
|
+
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
8
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
9
|
+
brandName: z.string().min(1).openapi({ example: "Acme Creative Studio" }),
|
|
10
|
+
searchVector: z.string().optional(),
|
|
11
|
+
bio: z.string().optional().openapi({
|
|
12
|
+
example: "A creative studio specializing in product design.",
|
|
13
|
+
}),
|
|
14
|
+
tags: z
|
|
15
|
+
.array(z.string())
|
|
16
|
+
.optional()
|
|
17
|
+
.openapi({ example: ["branding", "design", "marketing"] }),
|
|
18
|
+
createdAt: z.iso
|
|
19
|
+
.datetime()
|
|
20
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
21
|
+
updatedAt: z.iso
|
|
22
|
+
.datetime()
|
|
23
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
24
|
+
})
|
|
25
|
+
.openapi("BrandEntity");
|
|
26
|
+
|
|
27
|
+
export const CreateBrandProfileSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
brandName: z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1, "Brand name is required")
|
|
32
|
+
.openapi({ example: "Acme Creative Studio" }),
|
|
33
|
+
bio: z.string().max(210).optional().default("").openapi({
|
|
34
|
+
example: "We help brands tell their stories through design.",
|
|
35
|
+
}),
|
|
36
|
+
tags: z
|
|
37
|
+
.array(z.string())
|
|
38
|
+
.optional()
|
|
39
|
+
.default([])
|
|
40
|
+
.openapi({ example: ["branding", "ux", "campaigns"] }),
|
|
41
|
+
})
|
|
42
|
+
.openapi({
|
|
43
|
+
title: "create brand profile",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const UpdateBrandProfileSchema = z
|
|
47
|
+
.object({
|
|
48
|
+
brandName: z.string().min(1).optional().openapi({ example: "Acme Studio" }),
|
|
49
|
+
bio: z.string().max(210).optional().openapi({
|
|
50
|
+
example: "Updated bio for our creative agency.",
|
|
51
|
+
}),
|
|
52
|
+
tags: z
|
|
53
|
+
.array(z.string())
|
|
54
|
+
.optional()
|
|
55
|
+
.openapi({ example: ["branding", "product", "illustration"] }),
|
|
56
|
+
})
|
|
57
|
+
.openapi({
|
|
58
|
+
title: "update brand profile",
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const GetBrandParamsSchema = z.object({
|
|
62
|
+
value: CuidSchema,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const GetBrandQuerySchema = ProfileIdentifierSchema;
|
|
66
|
+
|
|
67
|
+
export const CreateBrandEndpointResponseSchema = BrandEntitySchema;
|
|
68
|
+
export const GetBrandEndpointResponseSchema = BrandEntitySchema.extend({
|
|
69
|
+
user: MinimalUserSchema,
|
|
70
|
+
});
|
|
71
|
+
export const UpdateBrandEndpointResponseSchema = BrandEntitySchema;
|
|
72
|
+
|
|
73
|
+
export type CreateBrandDto = z.infer<typeof CreateBrandProfileSchema> & {
|
|
74
|
+
userId: string;
|
|
75
|
+
};
|
|
76
|
+
export type UpdateBrandDto = z.infer<typeof UpdateBrandProfileSchema> & {
|
|
77
|
+
userId: string;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type GetBrandParams = z.infer<typeof GetBrandParamsSchema>;
|
|
81
|
+
export type GetBrandQuery = z.infer<typeof GetBrandQuerySchema>;
|
|
82
|
+
|
|
83
|
+
export type CreateBrandEndpointResponse = z.infer<
|
|
84
|
+
typeof CreateBrandEndpointResponseSchema
|
|
85
|
+
>;
|
|
86
|
+
export type GetBrandEndpointResponse = z.infer<
|
|
87
|
+
typeof GetBrandEndpointResponseSchema
|
|
88
|
+
>;
|
|
89
|
+
export type UpdateBrandEndpointResponse = z.infer<
|
|
90
|
+
typeof UpdateBrandEndpointResponseSchema
|
|
91
|
+
>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const CuidSchema = z.cuid2({ error: "Invalid CUID2 is written." });
|
|
4
|
+
|
|
5
|
+
export const UserIdentifierSchema = z.object({
|
|
6
|
+
by: z.enum(["id", "username"]).optional().default("id"),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type UserIdentifier = z.infer<typeof UserIdentifierSchema>;
|
|
10
|
+
|
|
11
|
+
export const ProfileIdentifierSchema = z.object({
|
|
12
|
+
by: z.enum(["id", "userId"]).optional().default("id"),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type ProfileIdentifier = z.infer<typeof ProfileIdentifierSchema>;
|
|
16
|
+
|
|
17
|
+
export const ProjectIdentifierSchema = z.object({
|
|
18
|
+
by: z.enum(["id", "userId"]).optional().default("id"),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ProjectIdentifier = z.infer<typeof ProjectIdentifierSchema>;
|
|
22
|
+
|
|
23
|
+
export const ProjectSocialGraphEntitySchema = z
|
|
24
|
+
.object({
|
|
25
|
+
noOfLikes: z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.nonnegative()
|
|
29
|
+
.optional()
|
|
30
|
+
.openapi({ example: 350 }),
|
|
31
|
+
noOfComments: z
|
|
32
|
+
.number()
|
|
33
|
+
.int()
|
|
34
|
+
.nonnegative()
|
|
35
|
+
.optional()
|
|
36
|
+
.openapi({ example: 78 }),
|
|
37
|
+
noOfBookmarks: z
|
|
38
|
+
.number()
|
|
39
|
+
.int()
|
|
40
|
+
.nonnegative()
|
|
41
|
+
.optional()
|
|
42
|
+
.openapi({ example: 25 }),
|
|
43
|
+
noOfViews: z
|
|
44
|
+
.number()
|
|
45
|
+
.int()
|
|
46
|
+
.nonnegative()
|
|
47
|
+
.optional()
|
|
48
|
+
.openapi({ example: 1024 }),
|
|
49
|
+
})
|
|
50
|
+
.openapi("ProjectSocialGraphEntity");
|
|
51
|
+
|
|
52
|
+
export const UserSocialGraphEntitySchema = z
|
|
53
|
+
.object({
|
|
54
|
+
followerCount: z
|
|
55
|
+
.number()
|
|
56
|
+
.int()
|
|
57
|
+
.nonnegative()
|
|
58
|
+
.optional()
|
|
59
|
+
.openapi({ example: 120 }),
|
|
60
|
+
followingCount: z
|
|
61
|
+
.number()
|
|
62
|
+
.int()
|
|
63
|
+
.nonnegative()
|
|
64
|
+
.optional()
|
|
65
|
+
.openapi({ example: 45 }),
|
|
66
|
+
})
|
|
67
|
+
.openapi("UserSocialGraphEntity");
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { EXPERIENCE_LEVELS } from "../constants";
|
|
3
|
+
import { CuidSchema, ProfileIdentifierSchema } from "./common";
|
|
4
|
+
import { MinimalUserSchema } from "./user";
|
|
5
|
+
|
|
6
|
+
export const CreativeEntitySchema = z
|
|
7
|
+
.object({
|
|
8
|
+
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
9
|
+
userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
10
|
+
bio: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.openapi({ example: "Passionate visual artist." }),
|
|
14
|
+
location: z.string().optional().openapi({ example: "Lagos, Nigeria" }),
|
|
15
|
+
searchVector: z.string().optional(),
|
|
16
|
+
experienceLevel: z
|
|
17
|
+
.enum(Object.values(EXPERIENCE_LEVELS) as [string, ...string[]])
|
|
18
|
+
.optional()
|
|
19
|
+
.openapi({ example: "1-3 years" }),
|
|
20
|
+
tags: z
|
|
21
|
+
.array(z.string())
|
|
22
|
+
.optional()
|
|
23
|
+
.openapi({ example: ["digital-art", "illustration"] }),
|
|
24
|
+
disciplines: z
|
|
25
|
+
.array(z.string())
|
|
26
|
+
.optional()
|
|
27
|
+
.openapi({ example: ["painting", "animation"] }),
|
|
28
|
+
createdAt: z.iso
|
|
29
|
+
.datetime()
|
|
30
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
31
|
+
updatedAt: z.iso
|
|
32
|
+
.datetime()
|
|
33
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
34
|
+
})
|
|
35
|
+
.openapi("CreativeEntity");
|
|
36
|
+
|
|
37
|
+
export const CreateCreativeProfileSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
experienceLevel: z
|
|
40
|
+
.enum(EXPERIENCE_LEVELS)
|
|
41
|
+
.default(EXPERIENCE_LEVELS.YEAR_0_1)
|
|
42
|
+
.openapi({ example: EXPERIENCE_LEVELS.YEAR_1_3 }),
|
|
43
|
+
bio: z
|
|
44
|
+
.string()
|
|
45
|
+
.max(210)
|
|
46
|
+
.optional()
|
|
47
|
+
.default("")
|
|
48
|
+
.openapi({ example: "I am a freelance UI/UX designer." }),
|
|
49
|
+
location: z
|
|
50
|
+
.string()
|
|
51
|
+
.max(100)
|
|
52
|
+
.optional()
|
|
53
|
+
.default("")
|
|
54
|
+
.openapi({ example: "Lagos, Nigeria" }),
|
|
55
|
+
disciplineSlugs: z
|
|
56
|
+
.array(z.string())
|
|
57
|
+
.min(1, "At least one discipline is required")
|
|
58
|
+
.default([])
|
|
59
|
+
.openapi({ example: ["ui-ux", "frontend"] }),
|
|
60
|
+
})
|
|
61
|
+
.openapi({
|
|
62
|
+
title: "create creative profile",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const UpdateCreativeProfileSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
experienceLevel: z
|
|
68
|
+
.enum(EXPERIENCE_LEVELS)
|
|
69
|
+
.optional()
|
|
70
|
+
.openapi({ example: EXPERIENCE_LEVELS.YEAR_3_5 }),
|
|
71
|
+
tags: z
|
|
72
|
+
.array(z.string())
|
|
73
|
+
.optional()
|
|
74
|
+
.openapi({ example: ["react", "design", "product"] }),
|
|
75
|
+
bio: z
|
|
76
|
+
.string()
|
|
77
|
+
.max(210)
|
|
78
|
+
.optional()
|
|
79
|
+
.openapi({ example: "I am a freelance UI/UX designer." }),
|
|
80
|
+
location: z
|
|
81
|
+
.string()
|
|
82
|
+
.max(100)
|
|
83
|
+
.optional()
|
|
84
|
+
.openapi({ example: "Lagos, Nigeria" }),
|
|
85
|
+
disciplineSlugs: z
|
|
86
|
+
.array(z.string())
|
|
87
|
+
.min(1, "At least one discipline is required")
|
|
88
|
+
.optional()
|
|
89
|
+
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
90
|
+
})
|
|
91
|
+
.openapi({
|
|
92
|
+
title: "update creative profile",
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const GetCreativeParamsSchema = z.object({
|
|
96
|
+
value: CuidSchema,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export const GetCreativeQuerySchema = ProfileIdentifierSchema;
|
|
100
|
+
|
|
101
|
+
export const CreateCreativeEndpointResponseSchema = CreativeEntitySchema;
|
|
102
|
+
export const GetCreativeEndpointResponseSchema = CreativeEntitySchema.extend({
|
|
103
|
+
user: MinimalUserSchema,
|
|
104
|
+
})
|
|
105
|
+
export const UpdateCreativeEndpointResponseSchema = CreativeEntitySchema;
|
|
106
|
+
|
|
107
|
+
export type CreateCreativeDto = z.infer<typeof CreateCreativeProfileSchema> & {
|
|
108
|
+
userId: string;
|
|
109
|
+
};
|
|
110
|
+
export type UpdateCreativeDto = z.infer<typeof UpdateCreativeProfileSchema> & {
|
|
111
|
+
userId: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type GetCreativeParams = z.infer<typeof GetCreativeParamsSchema>;
|
|
115
|
+
export type GetCreativeQuery = z.infer<typeof GetCreativeQuerySchema>;
|
|
116
|
+
|
|
117
|
+
export type CreateCreativeEndpointResponse = z.infer<
|
|
118
|
+
typeof CreateCreativeEndpointResponseSchema
|
|
119
|
+
>;
|
|
120
|
+
export type GetCreativeEndpointResponse = z.infer<
|
|
121
|
+
typeof GetCreativeEndpointResponseSchema
|
|
122
|
+
>;
|
|
123
|
+
export type UpdateCreativeEndpointResponse = z.infer<
|
|
124
|
+
typeof UpdateCreativeEndpointResponseSchema
|
|
125
|
+
>;
|