@zyacreatives/shared 2.5.54 → 2.5.56

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.
Files changed (111) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/schemas/activity.d.ts +1 -0
  4. package/dist/schemas/auth.d.ts +2 -0
  5. package/dist/schemas/bookmark.d.ts +62 -7
  6. package/dist/schemas/bookmark.js +32 -30
  7. package/dist/schemas/brand.d.ts +3 -3
  8. package/dist/schemas/chat.d.ts +96 -52
  9. package/dist/schemas/chat.js +44 -18
  10. package/dist/schemas/comment.d.ts +65 -21
  11. package/dist/schemas/comment.js +48 -54
  12. package/dist/schemas/common.d.ts +15 -11
  13. package/dist/schemas/creative.d.ts +3 -3
  14. package/dist/schemas/discipline.d.ts +63 -12
  15. package/dist/schemas/discipline.js +62 -65
  16. package/dist/schemas/entity-stats.d.ts +35 -3
  17. package/dist/schemas/entity-stats.js +24 -38
  18. package/dist/schemas/feed.d.ts +50 -3
  19. package/dist/schemas/feed.js +43 -13
  20. package/dist/schemas/file.d.ts +65 -24
  21. package/dist/schemas/file.js +60 -49
  22. package/dist/schemas/index.d.ts +1 -0
  23. package/dist/schemas/index.js +1 -0
  24. package/dist/schemas/investor-shortlist.d.ts +68 -11
  25. package/dist/schemas/investor-shortlist.js +46 -24
  26. package/dist/schemas/investor-signal.d.ts +52 -12
  27. package/dist/schemas/investor-signal.js +59 -39
  28. package/dist/schemas/investor.d.ts +3 -3
  29. package/dist/schemas/job-application.d.ts +291 -279
  30. package/dist/schemas/job-application.js +59 -95
  31. package/dist/schemas/job.d.ts +200 -659
  32. package/dist/schemas/job.js +98 -231
  33. package/dist/schemas/like.d.ts +3 -0
  34. package/dist/schemas/message.d.ts +125 -94
  35. package/dist/schemas/message.js +54 -55
  36. package/dist/schemas/notification.d.ts +99 -32
  37. package/dist/schemas/notification.js +46 -42
  38. package/dist/schemas/payout-method.d.ts +51 -31
  39. package/dist/schemas/payout-method.js +48 -58
  40. package/dist/schemas/post.d.ts +295 -204
  41. package/dist/schemas/post.js +148 -272
  42. package/dist/schemas/product.d.ts +308 -229
  43. package/dist/schemas/product.js +111 -94
  44. package/dist/schemas/project.d.ts +512 -449
  45. package/dist/schemas/project.js +144 -102
  46. package/dist/schemas/seller.d.ts +10 -10
  47. package/dist/schemas/user-strike.d.ts +3 -0
  48. package/dist/schemas/user.d.ts +127 -136
  49. package/dist/schemas/username.d.ts +1 -0
  50. package/dist/schemas/view.d.ts +1 -0
  51. package/dist/types/activity.d.ts +1 -3
  52. package/dist/types/auth.d.ts +1 -4
  53. package/dist/types/bookmark.d.ts +1 -3
  54. package/dist/types/chat.d.ts +1 -11
  55. package/dist/types/comment.d.ts +1 -5
  56. package/dist/types/common.d.ts +2 -8
  57. package/dist/types/discipline.d.ts +1 -11
  58. package/dist/types/entity-stats.d.ts +1 -3
  59. package/dist/types/feed.d.ts +1 -5
  60. package/dist/types/investor-shortlist.d.ts +1 -6
  61. package/dist/types/investor-signal.d.ts +1 -7
  62. package/dist/types/like.d.ts +1 -3
  63. package/dist/types/message.d.ts +1 -9
  64. package/dist/types/notification.d.ts +1 -9
  65. package/dist/types/user-strike.d.ts +1 -5
  66. package/dist/types/username.d.ts +1 -3
  67. package/package.json +1 -1
  68. package/src/index.ts +4 -5
  69. package/src/schemas/activity.ts +5 -4
  70. package/src/schemas/auth.ts +14 -10
  71. package/src/schemas/bookmark.ts +48 -29
  72. package/src/schemas/chat.ts +79 -18
  73. package/src/schemas/comment.ts +63 -49
  74. package/src/schemas/common.ts +8 -3
  75. package/src/schemas/discipline.ts +103 -71
  76. package/src/schemas/entity-stats.ts +32 -38
  77. package/src/schemas/feed.ts +62 -15
  78. package/src/schemas/file.ts +85 -58
  79. package/src/schemas/index.ts +1 -0
  80. package/src/schemas/investor-shortlist.ts +57 -8
  81. package/src/schemas/investor-signal.ts +79 -27
  82. package/src/schemas/job-application.ts +81 -115
  83. package/src/schemas/job.ts +160 -301
  84. package/src/schemas/like.ts +5 -1
  85. package/src/schemas/message.ts +71 -64
  86. package/src/schemas/notification.ts +63 -51
  87. package/src/schemas/payout-method.ts +47 -63
  88. package/src/schemas/post.ts +211 -272
  89. package/src/schemas/product.ts +202 -139
  90. package/src/schemas/project.ts +265 -147
  91. package/src/schemas/user-strike.ts +7 -1
  92. package/src/schemas/user.ts +2 -6
  93. package/src/schemas/username.ts +5 -3
  94. package/src/schemas/view.ts +0 -50
  95. package/src/types/activity.ts +0 -4
  96. package/src/types/auth.ts +0 -5
  97. package/src/types/bookmark.ts +0 -4
  98. package/src/types/chat.ts +0 -31
  99. package/src/types/comment.ts +0 -12
  100. package/src/types/common.ts +0 -14
  101. package/src/types/discipline.ts +0 -32
  102. package/src/types/entity-stats.ts +0 -4
  103. package/src/types/feed.ts +0 -10
  104. package/src/types/index.ts +0 -16
  105. package/src/types/investor-shortlist.ts +0 -18
  106. package/src/types/investor-signal.ts +0 -26
  107. package/src/types/like.ts +0 -4
  108. package/src/types/message.ts +0 -26
  109. package/src/types/notification.ts +0 -34
  110. package/src/types/user-strike.ts +0 -10
  111. package/src/types/username.ts +0 -4
@@ -1,4 +1,5 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+
2
3
  import {
3
4
  CLIENT_TYPES,
4
5
  PROJECT_STATUS,
@@ -6,50 +7,86 @@ import {
6
7
  VENTURE_STAGES,
7
8
  WAGES_CURRENCY,
8
9
  } from "../constants";
10
+
9
11
  import { CommentEntitySchema } from "./comment";
10
12
  import { BookmarkEntitySchema } from "./bookmark";
11
- import { ViewEntitySchema } from "./view";
12
13
  import { MinimalUserSchema } from "./user";
13
14
  import { ActivitySchema } from "./activity";
14
15
  import { FileEntitySchema } from "./file";
15
16
  import { LikeEntitySchema } from "./like";
16
17
 
18
+ /**
19
+ * --------------------------------
20
+ * SHAPE
21
+ * --------------------------------
22
+ */
23
+
24
+ const ProjectShape = z.object({
25
+ title: z.string(),
26
+ description: z.string().optional(),
27
+ overview: z.string().optional(),
28
+ url: z.url().optional(),
29
+
30
+ imagePlaceholderUrl: z.url(),
31
+
32
+ tags: z.array(z.string()).optional(),
33
+
34
+ projectCreatorType: z.enum(ROLES),
35
+
36
+ clientId: z.cuid2().optional(),
37
+ clientType: z.enum(CLIENT_TYPES).optional(),
38
+ clientName: z.string().optional(),
39
+
40
+ status: z.enum(PROJECT_STATUS),
41
+
42
+ isFeatured: z.boolean().optional(),
43
+
44
+ problemBeingSolved: z.string().max(600).optional(),
45
+ whoItsFor: z.string().max(600).optional(),
46
+
47
+ ventureStage: z.enum(VENTURE_STAGES).optional(),
48
+ capitalLookingToRaise: z.number(),
49
+ capitalLookingToRaiseCurrency: z.enum(WAGES_CURRENCY).optional(),
50
+
51
+ currentTraction: z.string().max(600),
52
+ isOpenToInvestment: z.boolean().default(false),
53
+
54
+ startDate: z.iso.datetime().optional(),
55
+ endDate: z.iso.datetime().optional(),
56
+ });
57
+
58
+ export type ProjectShapeType = z.infer<typeof ProjectShape>;
59
+
60
+ /**
61
+ * --------------------------------
62
+ * BASE ENTITY
63
+ * --------------------------------
64
+ */
65
+
17
66
  export const ProjectEntitySchema = z
18
67
  .object({
19
68
  id: z.cuid2(),
20
69
  userId: z.cuid2(),
21
- title: z.string(),
22
- description: z.string().optional(),
23
- overview: z.string().optional(),
24
- url: z.url().optional(),
25
- imagePlaceholderUrl: z.url(),
26
- tags: z.array(z.string()).optional(),
27
- projectCreatorType: z.enum(ROLES),
28
- clientId: z.cuid2().optional(),
29
- status: z.enum(PROJECT_STATUS),
30
- clientType: z.enum(CLIENT_TYPES).optional(),
31
- clientName: z.string().optional(),
32
- isFeatured: z.boolean().optional(),
33
- problemBeingSolved: z.string().max(600).optional(),
34
- whoItsFor: z.string().max(600).optional(),
35
- ventureStage: z.enum(VENTURE_STAGES).optional(),
36
- capitalLookingToRaise: z.number(),
37
- capitalLookingToRaiseCurrency: z.enum(WAGES_CURRENCY).optional(),
38
- currentTraction: z.string().max(600),
39
- isOpenToInvestment: z.boolean().default(false),
40
- startDate: z.coerce.date().optional(),
41
- endDate: z.coerce.date().optional(),
42
- createdAt: z.coerce.date(),
43
- updatedAt: z.coerce.date(),
44
- version: z.number().int(),
70
+
71
+ ...ProjectShape.shape,
72
+
73
+ createdAt: z.iso.datetime(),
74
+ updatedAt: z.iso.datetime(),
75
+ version: z.int(),
45
76
  })
46
- .openapi("ProjectEntity");
77
+ .openapi("Project");
47
78
 
48
79
  export type ProjectEntity = z.infer<typeof ProjectEntitySchema>;
49
80
 
81
+ /**
82
+ * --------------------------------
83
+ * DERIVED ENTITIES
84
+ * --------------------------------
85
+ */
86
+
50
87
  export const ProjectWithFilesEntitySchema = ProjectEntitySchema.extend({
51
88
  files: z.array(FileEntitySchema).optional(),
52
- }).openapi("ProjectWithFilesEntity");
89
+ }).openapi("ProjectWithFiles");
53
90
 
54
91
  export type ProjectWithFilesEntity = z.infer<
55
92
  typeof ProjectWithFilesEntitySchema
@@ -74,7 +111,92 @@ export const ProjectSocialGraphEntitySchema = z
74
111
  noOfBookmarks: z.number().int().optional(),
75
112
  noOfViews: z.number().int().optional(),
76
113
  })
77
- .openapi("ProjectSocialGraphEntity");
114
+ .openapi("ProjectSocialGraph");
115
+
116
+ export type ProjectSocialGraphEntity = z.infer<
117
+ typeof ProjectSocialGraphEntitySchema
118
+ >;
119
+
120
+ export type PostSocialGraphEntity = z.infer<
121
+ typeof ProjectSocialGraphEntitySchema
122
+ >;
123
+
124
+ export const ProjectDetailsEntitySchema = ProjectEntitySchema.extend({
125
+ user: MinimalUserSchema,
126
+ files: z.array(FileEntitySchema).optional(),
127
+ }).openapi("ProjectDetails");
128
+
129
+ export type ProjectDetailsEntity = z.infer<typeof ProjectDetailsEntitySchema>;
130
+
131
+ export const ProjectWithProjectCommentsEntitySchema =
132
+ MinimalProjectSchema.extend({
133
+ comments: z.array(CommentEntitySchema),
134
+ }).openapi("ProjectWithProjectComments");
135
+
136
+ export type ProjectWithProjectCommentsEntity = z.infer<
137
+ typeof ProjectWithProjectCommentsEntitySchema
138
+ >;
139
+
140
+ export const ProjectWithLikesEntitySchema = MinimalProjectSchema.extend({
141
+ likes: z.array(
142
+ ActivitySchema.extend({
143
+ followsYou: z.boolean().optional(),
144
+ isFollowing: z.boolean().optional(),
145
+ }),
146
+ ),
147
+ }).openapi("ProjectWithLikes");
148
+
149
+ export type ProjectWithLikesEntity = z.infer<
150
+ typeof ProjectWithLikesEntitySchema
151
+ >;
152
+
153
+ export const ProjectWithProjectBookmarksEntitySchema =
154
+ MinimalProjectSchema.extend({
155
+ bookmarks: z.array(BookmarkEntitySchema),
156
+ }).openapi("ProjectWithProjectBookmarks");
157
+
158
+ export type ProjectWithProjectBookmarksEntity = z.infer<
159
+ typeof ProjectWithProjectBookmarksEntitySchema
160
+ >;
161
+
162
+ /**
163
+ * --------------------------------
164
+ * INPUT HELPERS
165
+ * --------------------------------
166
+ */
167
+
168
+ const coerceArray = (value: unknown) => {
169
+ if (typeof value === "string") return value === "" ? [] : value.split(",");
170
+ return value;
171
+ };
172
+
173
+ const coerceBoolean = (value: unknown) => {
174
+ if (value === "true") return true;
175
+ if (value === "false") return false;
176
+ return value;
177
+ };
178
+
179
+ const nullableStringToUndefined = (value: unknown) => {
180
+ if (value === "" || value === null || value === undefined) return undefined;
181
+ return value;
182
+ };
183
+
184
+ const urlInputSchema = z
185
+ .string()
186
+ .transform((value) => {
187
+ if (!value) return value;
188
+ if (value.startsWith("http://") || value.startsWith("https://")) {
189
+ return value;
190
+ }
191
+ return `https://${value}`;
192
+ })
193
+ .pipe(z.url().or(z.literal("")));
194
+
195
+ /**
196
+ * --------------------------------
197
+ * INPUTS
198
+ * --------------------------------
199
+ */
78
200
 
79
201
  export const CreateProjectInputSchema = z
80
202
  .object({
@@ -91,67 +213,81 @@ export type CreateProjectInput = z.infer<typeof CreateProjectInputSchema>;
91
213
  export const UpdateProjectInputSchema = z
92
214
  .object({
93
215
  id: z.cuid2(),
216
+
94
217
  title: z.string().optional(),
218
+
95
219
  description: z
96
220
  .string()
97
221
  .min(10, "Add a bit more detail to your description.")
98
222
  .optional(),
223
+
99
224
  overview: z.string().optional(),
100
- url: z
101
- .string()
102
- .transform((val) => {
103
- if (!val) return val;
104
- if (val.startsWith("http://") || val.startsWith("https://")) return val;
105
- return `https://${val}`;
106
- })
107
- .pipe(z.url("Check your link.").or(z.literal("")))
108
- .optional(),
225
+
226
+ url: urlInputSchema.optional(),
227
+
109
228
  imagePlaceholderUrl: z.url().optional().or(z.literal("")),
229
+
110
230
  tags: z.array(z.string()).optional(),
231
+
111
232
  projectCreatorType: z.enum(ROLES).optional(),
112
- clientId: z
113
- .string()
114
- .optional()
115
- .transform((val) => (val === "" || val === undefined ? undefined : val))
116
- .pipe(z.cuid2().optional()),
233
+
234
+ clientId: z.preprocess(nullableStringToUndefined, z.cuid2().optional()),
235
+
117
236
  clientType: z.enum(CLIENT_TYPES).optional(),
118
237
  clientName: z.string().optional(),
238
+
119
239
  isFeatured: z.boolean().optional(),
240
+
120
241
  status: z.enum(PROJECT_STATUS).optional(),
242
+
121
243
  problemBeingSolved: z
122
244
  .string()
123
245
  .min(20, "Describe the problem you're solving.")
124
246
  .max(600)
125
247
  .optional(),
248
+
126
249
  whoItsFor: z
127
250
  .string()
128
251
  .min(5, "Tell us who this is for.")
129
252
  .max(600)
130
253
  .optional(),
254
+
131
255
  ventureStage: z.enum(VENTURE_STAGES).optional(),
256
+
132
257
  capitalLookingToRaise: z.number().optional(),
133
258
  capitalLookingToRaiseCurrency: z.enum(WAGES_CURRENCY).optional(),
259
+
134
260
  currentTraction: z
135
261
  .string()
136
262
  .min(10, "Share your current traction.")
137
263
  .max(600)
138
264
  .optional(),
265
+
139
266
  isOpenToInvestment: z.boolean().default(false),
140
- startDate: z.coerce.date().optional(),
141
- endDate: z.coerce.date().optional(),
142
- version: z.number().int().default(1),
267
+
268
+ startDate: z.iso.datetime().optional(),
269
+ endDate: z.iso.datetime().optional(),
270
+
271
+ version: z.int().default(1),
143
272
  })
144
273
  .superRefine(({ startDate, endDate }, ctx) => {
274
+ if (!startDate) return;
275
+
145
276
  const today = new Date();
146
277
  today.setHours(0, 0, 0, 0);
147
- if (startDate && startDate > today) {
278
+
279
+ const parsedStartDate = new Date(startDate);
280
+ const parsedEndDate = endDate ? new Date(endDate) : undefined;
281
+
282
+ if (parsedStartDate > today) {
148
283
  ctx.addIssue({
149
284
  path: ["startDate"],
150
285
  code: "custom",
151
286
  message: "Start date cannot be in the future.",
152
287
  });
153
288
  }
154
- if (startDate && endDate && startDate > endDate) {
289
+
290
+ if (parsedEndDate && parsedStartDate > parsedEndDate) {
155
291
  ctx.addIssue({
156
292
  path: ["endDate"],
157
293
  code: "custom",
@@ -167,182 +303,164 @@ export const CommentOnProjectInputSchema = CommentEntitySchema;
167
303
 
168
304
  export type CommentOnProjectInput = z.infer<typeof CommentOnProjectInputSchema>;
169
305
 
170
- export const ProjectDetailsEntitySchema = ProjectEntitySchema.extend({
171
- user: MinimalUserSchema,
172
- files: z.array(FileEntitySchema).optional(),
173
- }).openapi("ProjectDetailsEntity");
306
+ export const SearchProjectsInputSchema = z
307
+ .object({
308
+ query: z.string().optional(),
174
309
 
175
- export type ProjectDetailsEntity = z.infer<typeof ProjectDetailsEntitySchema>;
310
+ limit: z.coerce.number().min(1).max(100).default(40),
311
+ cursor: z.string().optional(),
176
312
 
177
- export const GetProjectOutputSchema = ProjectDetailsEntitySchema.extend({
178
- isLiked: z.boolean().optional(),
179
- isBookmarked: z.boolean().optional(),
180
- }).openapi("GetProjectOutput");
313
+ tags: z.preprocess(coerceArray, z.array(z.string())).optional(),
181
314
 
182
- export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
315
+ isOpenToInvestment: z.preprocess(coerceBoolean, z.boolean()).optional(),
316
+
317
+ minCapital: z.coerce.number().optional(),
318
+ maxCapital: z.coerce.number().optional(),
319
+
320
+ ventureStages: z
321
+ .preprocess(coerceArray, z.array(z.enum(VENTURE_STAGES)))
322
+ .optional(),
323
+
324
+ projectCreatorTypes: z
325
+ .preprocess(coerceArray, z.array(z.enum(ROLES)))
326
+ .optional(),
327
+
328
+ clientTypes: z
329
+ .preprocess(coerceArray, z.array(z.enum(CLIENT_TYPES)))
330
+ .optional(),
331
+ })
332
+ .openapi("SearchProjectsInput");
333
+
334
+ export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
335
+
336
+ export const ProjectIdSchema = z.object({
337
+ projectId: z.cuid2(),
338
+ });
339
+
340
+ export type ProjectIdInput = z.infer<typeof ProjectIdSchema>;
341
+
342
+ /**
343
+ * --------------------------------
344
+ * SEARCH DOCUMENT
345
+ * --------------------------------
346
+ */
183
347
 
184
348
  export const ProjectSearchDocumentSchema = z
185
349
  .object({
186
- id: z.string(),
187
- userId: z.string(),
350
+ id: z.cuid2(),
351
+ userId: z.cuid2(),
352
+
188
353
  title: z.string(),
189
354
  imagePlaceholderUrl: z.url(),
355
+
190
356
  projectCreatorType: z.enum(ROLES),
191
357
  isOpenToInvestment: z.boolean(),
192
- createdAt: z.number(),
193
- updatedAt: z.number(),
358
+
359
+ createdAt: z.iso.datetime(),
360
+ updatedAt: z.iso.datetime(),
361
+
194
362
  description: z.string().optional(),
363
+
195
364
  capitalLookingToRaise: z.number().optional(),
196
365
  capitalLookingToRaiseCurrency: z.enum(WAGES_CURRENCY).optional(),
197
366
  ventureStage: z.enum(VENTURE_STAGES).optional(),
367
+
198
368
  url: z.url().optional(),
199
369
  tags: z.array(z.string()).optional(),
370
+
200
371
  creatorUsername: z.string(),
201
372
  creatorImageUrl: z.string(),
202
373
  creatorName: z.string(),
203
- clientId: z.string().optional(),
374
+
375
+ clientId: z.cuid2().optional(),
204
376
  clientType: z.enum(CLIENT_TYPES).optional(),
205
377
  clientName: z.string().optional(),
378
+
206
379
  isFeatured: z.boolean().optional(),
207
- startDate: z.number().optional(),
208
- endDate: z.number().optional(),
380
+
381
+ startDate: z.iso.datetime().optional(),
382
+ endDate: z.iso.datetime().optional(),
383
+
209
384
  files: z.array(FileEntitySchema).optional(),
210
385
  })
211
386
  .openapi("ProjectSearchDocument");
212
387
 
213
388
  export type ProjectSearchDocument = z.infer<typeof ProjectSearchDocumentSchema>;
214
389
 
215
- const coerceArray = (val: unknown) => {
216
- if (typeof val === "string") return val === "" ? [] : val.split(",");
217
- return val;
218
- };
219
-
220
- const coerceBoolean = (val: unknown) => {
221
- if (val === "true") return true;
222
- if (val === "false") return false;
223
- return val;
224
- };
225
-
226
- export const SearchProjectsInputSchema = z
227
- .object({
228
- query: z.string().optional(),
229
-
230
- limit: z.coerce.number().optional().default(40),
231
- cursor: z.string().optional().nullable(),
232
-
233
- tags: z.preprocess(coerceArray, z.array(z.string())).optional(),
234
-
235
- isOpenToInvestment: z.preprocess(coerceBoolean, z.boolean()).optional(),
236
-
237
- minCapital: z.coerce.number().optional(),
238
- maxCapital: z.coerce.number().optional(),
239
-
240
- ventureStages: z
241
- .preprocess(coerceArray, z.array(z.enum(VENTURE_STAGES)))
242
- .optional(),
390
+ /**
391
+ * --------------------------------
392
+ * OUTPUTS
393
+ * --------------------------------
394
+ */
243
395
 
244
- projectCreatorTypes: z
245
- .preprocess(coerceArray, z.array(z.enum(ROLES)))
246
- .optional(),
247
-
248
- clientTypes: z
249
- .preprocess(coerceArray, z.array(z.enum(CLIENT_TYPES)))
250
- .optional(),
251
- })
252
- .openapi("SearchProjectsInput");
396
+ export const GetProjectOutputSchema = ProjectDetailsEntitySchema.extend({
397
+ isLiked: z.boolean().optional(),
398
+ isBookmarked: z.boolean().optional(),
399
+ }).openapi("GetProjectOutput");
253
400
 
254
- export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
401
+ export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
255
402
 
256
403
  export const SearchProjectsOutputSchema = z
257
404
  .object({
258
405
  projects: z.array(ProjectSearchDocumentSchema),
259
- nextCursor: z.string().optional().nullable(),
406
+ nextCursor: z.string().optional(),
260
407
  })
261
408
  .openapi("SearchProjectsOutput");
262
409
 
263
410
  export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;
264
411
 
265
- export const ProjectWithProjectCommentsEntitySchema =
266
- MinimalProjectSchema.extend({
267
- comments: z.array(CommentEntitySchema),
268
- }).openapi("ProjectWithProjectCommentsEntity");
269
-
270
- export type ProjectWithProjectCommentsEntity = z.infer<
271
- typeof ProjectWithProjectCommentsEntitySchema
272
- >;
273
-
274
412
  export const GetProjectWithCommentsOutputSchema =
275
413
  ProjectWithProjectCommentsEntitySchema.extend({
276
- nextCursor: z.string().optional().nullable(),
414
+ nextCursor: z.string().optional(),
277
415
  }).openapi("GetProjectWithCommentsOutput");
278
416
 
279
417
  export type GetProjectWithCommentsOutput = z.infer<
280
418
  typeof GetProjectWithCommentsOutputSchema
281
419
  >;
282
420
 
283
- export const ProjectWithLikesEntitySchema = MinimalProjectSchema.extend({
284
- likes: z.array(
285
- ActivitySchema.extend({
286
- followsYou: z.boolean().optional(),
287
- isFollowing: z.boolean().optional(),
288
- }),
289
- ),
290
- }).openapi("ProjectWithLikesEntity");
291
-
292
- export type ProjectWithLikesEntity = z.infer<
293
- typeof ProjectWithLikesEntitySchema
294
- >;
295
-
296
421
  export const GetProjectWithLikesOutputSchema =
297
422
  ProjectWithLikesEntitySchema.extend({
298
- nextCursor: z.string().optional().nullable(),
423
+ nextCursor: z.string().optional(),
299
424
  }).openapi("GetProjectWithLikesOutput");
300
425
 
301
426
  export type GetProjectWithLikesOutput = z.infer<
302
427
  typeof GetProjectWithLikesOutputSchema
303
428
  >;
304
429
 
305
- export const ProjectWithProjectViewsEntitySchema = MinimalProjectSchema.extend({
306
- views: z.array(ViewEntitySchema),
307
- }).openapi("ProjectWithProjectViewsEntity");
308
-
309
- export type ProjectWithProjectViewsEntity = z.infer<
310
- typeof ProjectWithProjectViewsEntitySchema
311
- >;
312
-
313
- export const ProjectWithProjectBookmarksEntitySchema =
314
- MinimalProjectSchema.extend({
315
- bookmarks: z.array(BookmarkEntitySchema),
316
- }).openapi("ProjectWithProjectBookmarksEntity");
317
-
318
- export type ProjectWithProjectBookmarksEntity = z.infer<
319
- typeof ProjectWithProjectBookmarksEntitySchema
320
- >;
321
-
322
430
  export const ProjectUpdateOutputEntitySchema = z.object({
323
431
  id: z.cuid2(),
324
432
  });
325
433
 
434
+ export type ProjectUpdateOutputEntity = z.infer<
435
+ typeof ProjectUpdateOutputEntitySchema
436
+ >;
437
+
326
438
  export const CreateProjectOutputSchema = ProjectEntitySchema;
439
+
327
440
  export type CreateProjectOutput = z.infer<typeof CreateProjectOutputSchema>;
328
441
 
329
442
  export const UpdateProjectOutputSchema = ProjectEntitySchema;
443
+
330
444
  export type UpdateProjectOutput = z.infer<typeof UpdateProjectOutputSchema>;
331
445
 
332
446
  export const DeleteProjectOutputSchema = ProjectEntitySchema;
447
+
333
448
  export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
334
449
 
335
450
  export const CommentOnProjectOutputSchema = CommentEntitySchema.omit({
336
451
  likesCount: true,
337
452
  isLiked: true,
338
453
  });
454
+
339
455
  export type CommentOnProjectOutput = z.infer<
340
456
  typeof CommentOnProjectOutputSchema
341
457
  >;
342
458
 
343
- export const ProjectIdSchema = z.object({ projectId: z.cuid2() });
344
- export type ProjectIdInput = z.infer<typeof ProjectIdSchema>;
459
+ /**
460
+ * --------------------------------
461
+ * ALIASES
462
+ * --------------------------------
463
+ */
345
464
 
346
- export type ProjectViewEntity = z.infer<typeof ViewEntitySchema>;
347
465
  export type ProjectLikeEntity = z.infer<typeof LikeEntitySchema>;
348
466
  export type ProjectCommentEntity = z.infer<typeof CommentEntitySchema>;
@@ -18,4 +18,10 @@ export const UpsertUserStrikeInputSchema = z.object({
18
18
  parentType: z.enum(ACTIVITY_PARENT_TYPES).optional(),
19
19
  });
20
20
 
21
- export const UpsertUserStrikeOutputSchema = UserStrikeEntitySchema;
21
+ export const UpsertUserStrikeOutputSchema = UserStrikeEntitySchema;
22
+
23
+ export type UserStrikeEntity = z.infer<typeof UserStrikeEntitySchema>;
24
+ export type UpsertUserStrikeInput = z.infer<typeof UpsertUserStrikeInputSchema>;
25
+ export type UpsertUserStrikeOutput = z.infer<
26
+ typeof UpsertUserStrikeOutputSchema
27
+ >;
@@ -22,11 +22,7 @@ import { LikeEntitySchema } from "./like";
22
22
  import { BrandEntitySchema } from "./brand";
23
23
  import { CreativeEntitySchema } from "./creative";
24
24
  import { InvestorEntitySchema } from "./investor";
25
- import {
26
- FeedPostEntitySchema,
27
- PostEntitySchema,
28
- PostWithFilesEntitySchema,
29
- } from "./post";
25
+ import { PostEntitySchema, PostWithFilesEntitySchema } from "./post";
30
26
  import { JobSearchDocumentSchema } from "./job";
31
27
  import { ProductEntitySchema } from "./product";
32
28
 
@@ -226,7 +222,7 @@ export const UserWithJobBookmarksInputSchema = z.object({
226
222
  export type UserAuthStatusEntity = z.infer<typeof UserAuthStatusEntitySchema>;
227
223
  export type UserWithJobBookmarksInput = z.infer<
228
224
  typeof UserWithJobBookmarksEntitySchema
229
- >;
225
+ >;
230
226
 
231
227
  /**
232
228
  * --------------------------------
@@ -1,11 +1,13 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
 
3
- export const UsernameSchema = z.object({
3
+ export const UsernameSchema = z.object({
4
4
  username: z
5
5
  .string()
6
6
  .min(3, { message: "Username must be at least 3 characters" })
7
7
  .max(32, { message: "Username must be at most 32 characters" })
8
8
  .regex(/^[a-zA-Z0-9_]+$/, {
9
9
  message: "Username may only contain letters, numbers, and underscores",
10
- }),
11
- });
10
+ }),
11
+ });
12
+
13
+ export type UsernameInput = z.infer<typeof UsernameSchema>;
@@ -1,50 +0,0 @@
1
- import { z } from "@hono/zod-openapi";
2
- import { ACTIVITY_PARENT_TYPES } from "../constants";
3
-
4
- export const ViewEntitySchema = z
5
- .object({
6
- id: z.cuid2().openapi({
7
- description: "Unique identifier of the view record.",
8
- title: "View ID",
9
- }),
10
- userId: z.cuid2().nullable().openapi({
11
- description:
12
- "Identifier of the user who viewed the entity, if authenticated.",
13
- title: "User ID",
14
- }),
15
- ipAddress: z.string().nullable().openapi({
16
- description: "IP address from which the entity was viewed.",
17
- title: "IP Address",
18
- }),
19
- userAgent: z.string().nullable().openapi({
20
- description:
21
- "User agent string identifying the client device or browser.",
22
- title: "User Agent",
23
- }),
24
- parentId: z.cuid2().openapi({
25
- description: "Identifier of the parent entity being viewed.",
26
- title: "Parent ID",
27
- }),
28
- parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
29
- description: "Type of the parent entity (e.g., project, post, etc.).",
30
- title: "Parent Type",
31
- }),
32
- sessionId: z.string().nullable().openapi({
33
- description:
34
- "Session identifier associated with the view event, if available.",
35
- title: "Session ID",
36
- }),
37
- viewedAt: z.coerce.date().optional().openapi({
38
- description: "Exact timestamp when the view occurred.",
39
- title: "Viewed At",
40
- }),
41
- viewDate: z.coerce.date().optional().openapi({
42
- description:
43
- "Calendar date corresponding to the view event, used for aggregation.",
44
- title: "View Date",
45
- }),
46
- })
47
- .openapi({
48
- description: "Represents a record of a single view event for an entity.",
49
- title: "View",
50
- });
@@ -1,4 +0,0 @@
1
- import z from "zod";
2
- import { ActivitySchema } from "../schemas/activity";
3
-
4
- export type ActivityEntity = z.infer<typeof ActivitySchema>;
package/src/types/auth.ts DELETED
@@ -1,5 +0,0 @@
1
- import z from "zod";
2
- import { LoginSchema, RegisterSchema } from "../schemas/auth";
3
-
4
- export type RegisterInput = z.infer<typeof RegisterSchema>;
5
- export type LoginInput = z.infer<typeof LoginSchema>;