@zyacreatives/shared 1.3.8 → 1.3.9
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/project.d.ts +337 -39
- package/dist/schemas/project.js +321 -115
- package/dist/types/project.d.ts +35 -91
- package/package.json +1 -1
- package/src/schemas/project.ts +351 -123
- package/src/types/project.ts +88 -106
package/src/schemas/project.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { CLIENT_TYPES, ROLES } from "../constants";
|
|
3
|
-
import { CreateFileInputSchema } from "./file";
|
|
3
|
+
import { CreateFileInputSchema, FileEntitySchema } from "./file";
|
|
4
4
|
export const ProjectEntitySchema = z
|
|
5
5
|
.object({
|
|
6
6
|
description: z.string().optional().openapi({
|
|
@@ -91,118 +91,6 @@ export const ProjectEntitySchema = z
|
|
|
91
91
|
description: "Schema representing a project stored in the database.",
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
export const CreateProjectSchema = z
|
|
95
|
-
.object({
|
|
96
|
-
userId: z.string().openapi({
|
|
97
|
-
description: "CUID2 of the user creating the project.",
|
|
98
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
99
|
-
}),
|
|
100
|
-
title: z.string().min(1).max(100).openapi({
|
|
101
|
-
description: "Title of the project, 1–100 characters.",
|
|
102
|
-
example: "E-commerce Mobile App",
|
|
103
|
-
}),
|
|
104
|
-
projectCreatorType: z.enum(ROLES).default(ROLES.CREATIVE).openapi({
|
|
105
|
-
description: "Type of creator who made this project.",
|
|
106
|
-
example: "CREATIVE",
|
|
107
|
-
}),
|
|
108
|
-
imagePlaceholderUrl: z.url().openapi({
|
|
109
|
-
description: "URL for the placeholder image of the project.",
|
|
110
|
-
example: "https://img.com",
|
|
111
|
-
}),
|
|
112
|
-
id: z.string().optional().openapi({
|
|
113
|
-
description: "CUID2 of the project.",
|
|
114
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
115
|
-
}),
|
|
116
|
-
description: z.string().optional().openapi({
|
|
117
|
-
description: "Detailed description of the project, max 1000 characters.",
|
|
118
|
-
example:
|
|
119
|
-
"A modern e-commerce mobile application built with React Native.",
|
|
120
|
-
}),
|
|
121
|
-
overview: z.string().optional().openapi({
|
|
122
|
-
description: "Brief overview of the project.",
|
|
123
|
-
example: "A comprehensive e-commerce solution for mobile devices.",
|
|
124
|
-
}),
|
|
125
|
-
url: z.string().optional().openapi({
|
|
126
|
-
description: "URL to the project or live demo.",
|
|
127
|
-
example: "https://example.com/project",
|
|
128
|
-
}),
|
|
129
|
-
clientId: z.string().optional().openapi({
|
|
130
|
-
description: "CUID2 of the client if this is a client project.",
|
|
131
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
132
|
-
}),
|
|
133
|
-
clientType: z
|
|
134
|
-
.enum(CLIENT_TYPES)
|
|
135
|
-
.optional()
|
|
136
|
-
.default(CLIENT_TYPES.NONE)
|
|
137
|
-
.openapi({
|
|
138
|
-
description: "Type of client for this project.",
|
|
139
|
-
example: "BRAND",
|
|
140
|
-
}),
|
|
141
|
-
clientName: z.string().optional().openapi({
|
|
142
|
-
description: "Name of the client.",
|
|
143
|
-
example: "Acme Corp",
|
|
144
|
-
}),
|
|
145
|
-
tags: z
|
|
146
|
-
.array(z.string())
|
|
147
|
-
.optional()
|
|
148
|
-
.openapi({
|
|
149
|
-
description: "Array of tags associated with the project.",
|
|
150
|
-
example: ["react-native", "e-commerce", "mobile"],
|
|
151
|
-
}),
|
|
152
|
-
searchVector: z.string().optional().openapi({
|
|
153
|
-
description: "Search vector for full-text search indexing.",
|
|
154
|
-
example: "ecommerce mobile app react native",
|
|
155
|
-
}),
|
|
156
|
-
isFeatured: z.boolean().optional().openapi({
|
|
157
|
-
description: "Whether the project is featured.",
|
|
158
|
-
example: true,
|
|
159
|
-
}),
|
|
160
|
-
startDate: z.coerce
|
|
161
|
-
.date()
|
|
162
|
-
.optional()
|
|
163
|
-
.openapi({
|
|
164
|
-
description: "Start date of the project.",
|
|
165
|
-
example: new Date("2024-01-01"),
|
|
166
|
-
}),
|
|
167
|
-
endDate: z.coerce
|
|
168
|
-
.date()
|
|
169
|
-
.optional()
|
|
170
|
-
.openapi({
|
|
171
|
-
description: "End date of the project.",
|
|
172
|
-
example: new Date("2024-06-30"),
|
|
173
|
-
}),
|
|
174
|
-
createdAt: z.coerce
|
|
175
|
-
.date()
|
|
176
|
-
.optional()
|
|
177
|
-
.openapi({
|
|
178
|
-
description: "Timestamp when the project was created.",
|
|
179
|
-
example: new Date("2024-01-01T00:00:00.000Z"),
|
|
180
|
-
}),
|
|
181
|
-
updatedAt: z.coerce
|
|
182
|
-
.date()
|
|
183
|
-
.optional()
|
|
184
|
-
.openapi({
|
|
185
|
-
description: "Timestamp when the project was last updated.",
|
|
186
|
-
example: new Date("2024-06-30T00:00:00.000Z"),
|
|
187
|
-
}),
|
|
188
|
-
files: z
|
|
189
|
-
.array(
|
|
190
|
-
CreateFileInputSchema.extend({
|
|
191
|
-
isPlaceholder: z.boolean().default(false),
|
|
192
|
-
order: z.number().int().default(1),
|
|
193
|
-
})
|
|
194
|
-
)
|
|
195
|
-
.optional()
|
|
196
|
-
.openapi({
|
|
197
|
-
description: "Array of files/images for the project.",
|
|
198
|
-
example: [],
|
|
199
|
-
}),
|
|
200
|
-
})
|
|
201
|
-
.openapi({
|
|
202
|
-
title: "Create Project",
|
|
203
|
-
description: "Schema for creating a new project.",
|
|
204
|
-
});
|
|
205
|
-
|
|
206
94
|
export const ProjectFileEntitySchema = z
|
|
207
95
|
.object({
|
|
208
96
|
isPlaceholder: z.boolean().openapi({
|
|
@@ -240,16 +128,18 @@ export const ProjectSocialGraphEntitySchema = z
|
|
|
240
128
|
})
|
|
241
129
|
.openapi("ProjectSocialGraphEntity");
|
|
242
130
|
|
|
243
|
-
export const ProjectWithFilesEntitySchema = ProjectEntitySchema.extend(
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
131
|
+
export const ProjectWithFilesEntitySchema = ProjectEntitySchema.extend({
|
|
132
|
+
projectFiles: z
|
|
133
|
+
.array(
|
|
134
|
+
ProjectFileEntitySchema.extend({
|
|
135
|
+
file: FileEntitySchema,
|
|
136
|
+
})
|
|
137
|
+
)
|
|
138
|
+
.optional()
|
|
139
|
+
.openapi({ description: "Files associated with the project." }),
|
|
140
|
+
}).openapi({
|
|
141
|
+
title: "ProjectWithFilesEntity",
|
|
142
|
+
});
|
|
253
143
|
|
|
254
144
|
export const ProjectViewEntitySchema = z
|
|
255
145
|
.object({
|
|
@@ -314,3 +204,341 @@ export const ProjectUpdateOutputEntitySchema = z
|
|
|
314
204
|
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
315
205
|
})
|
|
316
206
|
.openapi("ProjectUpdateOutputEntity");
|
|
207
|
+
|
|
208
|
+
export const CreateProjectInputSchema = z
|
|
209
|
+
.object({
|
|
210
|
+
title: z.string().min(1).max(100).openapi({
|
|
211
|
+
description: "Title of the project, 1-100 characters.",
|
|
212
|
+
example: "E-commerce Mobile App",
|
|
213
|
+
}),
|
|
214
|
+
description: z.string().max(1000).optional().default("").openapi({
|
|
215
|
+
description: "Detailed description of the project, max 1000 characters.",
|
|
216
|
+
example:
|
|
217
|
+
"A modern e-commerce mobile application built with React Native.",
|
|
218
|
+
}),
|
|
219
|
+
url: z.string().openapi({
|
|
220
|
+
description: "URL to the project or live demo.",
|
|
221
|
+
example: "https://example.com/project",
|
|
222
|
+
}),
|
|
223
|
+
imagePlaceholderUrl: z.url().openapi({ example: "https://img.com" }),
|
|
224
|
+
tags: z
|
|
225
|
+
.array(z.string())
|
|
226
|
+
.default([])
|
|
227
|
+
.openapi({
|
|
228
|
+
description: "Array of tags associated with the project.",
|
|
229
|
+
example: ["react-native", "e-commerce", "mobile"],
|
|
230
|
+
}),
|
|
231
|
+
startDate: z.coerce.date().openapi({
|
|
232
|
+
description: "Start date of the project.",
|
|
233
|
+
example: new Date("2024-01-01"),
|
|
234
|
+
}),
|
|
235
|
+
endDate: z.coerce
|
|
236
|
+
.date()
|
|
237
|
+
.optional()
|
|
238
|
+
.openapi({
|
|
239
|
+
description: "End date of the project.",
|
|
240
|
+
example: new Date("2024-06-30"),
|
|
241
|
+
}),
|
|
242
|
+
overview: z.string().optional().openapi({
|
|
243
|
+
description: "Brief overview of the project.",
|
|
244
|
+
example: "A comprehensive e-commerce solution for mobile devices.",
|
|
245
|
+
}),
|
|
246
|
+
projectCreatorType: z.enum(ROLES).default(ROLES.CREATIVE).openapi({
|
|
247
|
+
description: "Type of creator who made this project.",
|
|
248
|
+
example: "CREATIVE",
|
|
249
|
+
}),
|
|
250
|
+
clientId: z.string().optional().openapi({
|
|
251
|
+
description: "CUID2 of the client if this is a client project.",
|
|
252
|
+
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
253
|
+
}),
|
|
254
|
+
clientType: z.enum(CLIENT_TYPES).default(CLIENT_TYPES.NONE).openapi({
|
|
255
|
+
description: "Type of client for this project.",
|
|
256
|
+
example: "BRAND",
|
|
257
|
+
}),
|
|
258
|
+
clientName: z.string().optional().default("").openapi({
|
|
259
|
+
description: "Name of the client.",
|
|
260
|
+
example: "Acme Corp",
|
|
261
|
+
}),
|
|
262
|
+
files: z
|
|
263
|
+
.array(
|
|
264
|
+
CreateFileInputSchema.extend({
|
|
265
|
+
isPlaceholder: z.boolean().default(false),
|
|
266
|
+
order: z.int().default(1),
|
|
267
|
+
})
|
|
268
|
+
)
|
|
269
|
+
.openapi({
|
|
270
|
+
description: "Array of files/images for the project.",
|
|
271
|
+
example: [],
|
|
272
|
+
}),
|
|
273
|
+
})
|
|
274
|
+
.openapi({
|
|
275
|
+
title: "Create Project",
|
|
276
|
+
description: "Schema for creating a new project.",
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
export const CreateProjectOutputSchema = ProjectEntitySchema;
|
|
280
|
+
|
|
281
|
+
export const UpdateProjectInputSchema = z
|
|
282
|
+
.object({
|
|
283
|
+
id: z.cuid2().openapi({
|
|
284
|
+
description: "CUID2 identifier of the project to update.",
|
|
285
|
+
example: "ckl1z0abc0000qv7a0h1abcd2",
|
|
286
|
+
}),
|
|
287
|
+
title: z.string().optional().openapi({
|
|
288
|
+
description: "Updated title of the project.",
|
|
289
|
+
example: "Updated E-commerce Mobile App",
|
|
290
|
+
}),
|
|
291
|
+
description: z.string().optional().openapi({
|
|
292
|
+
description: "Updated description of the project.",
|
|
293
|
+
example: "An updated description of the project.",
|
|
294
|
+
}),
|
|
295
|
+
imagePlaceholderUrl: z.url().optional().openapi({
|
|
296
|
+
example: "https://img.com",
|
|
297
|
+
}),
|
|
298
|
+
overview: z.string().optional().openapi({
|
|
299
|
+
description: "Updated overview of the project.",
|
|
300
|
+
example: "Updated project overview.",
|
|
301
|
+
}),
|
|
302
|
+
url: z.url().optional().openapi({
|
|
303
|
+
description: "Updated URL to the project or live demo.",
|
|
304
|
+
example: "https://updated-example.com/project",
|
|
305
|
+
}),
|
|
306
|
+
clientId: z.cuid2().optional().openapi({
|
|
307
|
+
description: "Updated client ID.",
|
|
308
|
+
example: "ckl1y9xyz0000qv7a0h1efgh5",
|
|
309
|
+
}),
|
|
310
|
+
clientType: z.enum(["CREATIVE", "BRAND", "NONE"]).optional().openapi({
|
|
311
|
+
description: "Updated client type.",
|
|
312
|
+
example: "BRAND",
|
|
313
|
+
}),
|
|
314
|
+
clientName: z.string().optional().openapi({
|
|
315
|
+
description: "Updated client name.",
|
|
316
|
+
example: "Updated Acme Corp",
|
|
317
|
+
}),
|
|
318
|
+
projectCreatorType: z
|
|
319
|
+
.enum(["CREATIVE", "BRAND", "INVESTOR", "ADMIN"])
|
|
320
|
+
.optional()
|
|
321
|
+
.openapi({
|
|
322
|
+
description: "Updated project creator type.",
|
|
323
|
+
example: "CREATIVE",
|
|
324
|
+
}),
|
|
325
|
+
tags: z
|
|
326
|
+
.array(z.string())
|
|
327
|
+
.optional()
|
|
328
|
+
.openapi({
|
|
329
|
+
description: "Updated array of tags.",
|
|
330
|
+
example: ["react-native", "e-commerce", "mobile", "updated"],
|
|
331
|
+
}),
|
|
332
|
+
isFeatured: z.boolean().optional().openapi({
|
|
333
|
+
description: "Whether the project should be featured.",
|
|
334
|
+
example: true,
|
|
335
|
+
}),
|
|
336
|
+
startDate: z
|
|
337
|
+
.date()
|
|
338
|
+
.optional()
|
|
339
|
+
.openapi({
|
|
340
|
+
description: "Updated start date of the project.",
|
|
341
|
+
example: new Date("2024-02-01"),
|
|
342
|
+
}),
|
|
343
|
+
endDate: z
|
|
344
|
+
.date()
|
|
345
|
+
.optional()
|
|
346
|
+
.openapi({
|
|
347
|
+
description: "Updated end date of the project.",
|
|
348
|
+
example: new Date("2024-07-30"),
|
|
349
|
+
}),
|
|
350
|
+
createdAt: z
|
|
351
|
+
.date()
|
|
352
|
+
.optional()
|
|
353
|
+
.openapi({
|
|
354
|
+
description: "Creation date (read-only).",
|
|
355
|
+
example: new Date("2024-01-01T12:00:00Z"),
|
|
356
|
+
}),
|
|
357
|
+
updatedAt: z
|
|
358
|
+
.date()
|
|
359
|
+
.optional()
|
|
360
|
+
.openapi({
|
|
361
|
+
description: "Last update date (read-only).",
|
|
362
|
+
example: new Date("2024-06-30T18:00:00Z"),
|
|
363
|
+
}),
|
|
364
|
+
})
|
|
365
|
+
.openapi({
|
|
366
|
+
title: "Update Project",
|
|
367
|
+
description: "Schema for updating an existing project.",
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
export const UpdateProjectOutputSchema = ProjectEntitySchema;
|
|
371
|
+
export const ProjectIdSchema = z.object({
|
|
372
|
+
projectId: z.cuid2(),
|
|
373
|
+
});
|
|
374
|
+
export const CommentOnProjectParamsSchema = ProjectIdSchema;
|
|
375
|
+
export const CommentOnProjectInputSchema = z
|
|
376
|
+
.object({
|
|
377
|
+
content: z.string().openapi({
|
|
378
|
+
description: "Content of the comment.",
|
|
379
|
+
example: "This is a great project!",
|
|
380
|
+
}),
|
|
381
|
+
parentCommentId: z.cuid2().optional().openapi({
|
|
382
|
+
description: "CUID2 of the parent comment if this is a reply.",
|
|
383
|
+
example: "ckl1z0abc0000qv7a0h1abcd4",
|
|
384
|
+
}),
|
|
385
|
+
})
|
|
386
|
+
.openapi({
|
|
387
|
+
title: "Comment on Project",
|
|
388
|
+
description: "Schema for commenting on a project.",
|
|
389
|
+
});
|
|
390
|
+
export const CommentOnProjectOutputSchema = ProjectCommentEntitySchema;
|
|
391
|
+
|
|
392
|
+
export const DeleteProjectInputSchema = ProjectIdSchema;
|
|
393
|
+
|
|
394
|
+
export const DeleteProjectCommentParamsSchema = z.object({
|
|
395
|
+
commentId: z.cuid2(),
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
export const DeleteProjectCommentOutputSchema = ProjectCommentEntitySchema;
|
|
399
|
+
|
|
400
|
+
export const DeleteProjectOutputSchema = ProjectEntitySchema;
|
|
401
|
+
|
|
402
|
+
export const GetProjectParamsSchema = ProjectIdSchema;
|
|
403
|
+
|
|
404
|
+
export const GetProjectOutputSchema = ProjectWithFilesEntitySchema;
|
|
405
|
+
|
|
406
|
+
export const BookmarkProjectParamsSchema = ProjectIdSchema;
|
|
407
|
+
|
|
408
|
+
export const BookmarkProjectOutputSchema = ProjectBookmarkEntitySchema;
|
|
409
|
+
|
|
410
|
+
export const LikeProjectParamsSchema = ProjectIdSchema;
|
|
411
|
+
|
|
412
|
+
export const UnlikeProjectParamsSchema = ProjectIdSchema;
|
|
413
|
+
|
|
414
|
+
export const ViewProjectInputSchema = z
|
|
415
|
+
.object({
|
|
416
|
+
projectId: z.cuid2().openapi({
|
|
417
|
+
description: "CUID2 identifier of the project being viewed.",
|
|
418
|
+
example: "ckl1z0abc0000qv7a0h1abcd2",
|
|
419
|
+
}),
|
|
420
|
+
id: z.cuid2().optional().openapi({
|
|
421
|
+
description: "CUID2 identifier of the view record (auto-generated).",
|
|
422
|
+
example: "ckl1z0abc0000qv7a0h1abcd5",
|
|
423
|
+
}),
|
|
424
|
+
userId: z.cuid2().optional().openapi({
|
|
425
|
+
description: "CUID2 of the user who viewed the project.",
|
|
426
|
+
example: "ckl1y9xyz0000qv7a0h1efgh3",
|
|
427
|
+
}),
|
|
428
|
+
sessionId: z.string().optional().openapi({
|
|
429
|
+
description: "Session ID for anonymous users.",
|
|
430
|
+
example: "sess_123456789",
|
|
431
|
+
}),
|
|
432
|
+
ipAddress: z.string().optional().openapi({
|
|
433
|
+
description: "IP address of the viewer.",
|
|
434
|
+
example: "192.168.1.1",
|
|
435
|
+
}),
|
|
436
|
+
userAgent: z.string().optional().openapi({
|
|
437
|
+
description: "User agent string of the viewer.",
|
|
438
|
+
example: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
|
|
439
|
+
}),
|
|
440
|
+
viewedAt: z
|
|
441
|
+
.date()
|
|
442
|
+
.optional()
|
|
443
|
+
.openapi({
|
|
444
|
+
description: "Date and time when the project was viewed.",
|
|
445
|
+
example: new Date("2024-01-15T14:30:00Z"),
|
|
446
|
+
}),
|
|
447
|
+
viewDate: z
|
|
448
|
+
.date()
|
|
449
|
+
.optional()
|
|
450
|
+
.openapi({
|
|
451
|
+
description: "Date when the project was viewed.",
|
|
452
|
+
example: new Date("2024-01-15"),
|
|
453
|
+
}),
|
|
454
|
+
})
|
|
455
|
+
.openapi({
|
|
456
|
+
title: "View Project",
|
|
457
|
+
description: "Schema for recording a project view.",
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
export const MinimalProjectSchema = ProjectEntitySchema.pick({
|
|
461
|
+
id: true,
|
|
462
|
+
title: true,
|
|
463
|
+
description: true,
|
|
464
|
+
tags: true,
|
|
465
|
+
startDate: true,
|
|
466
|
+
endDate: true,
|
|
467
|
+
imagePlaceholderUrl: true,
|
|
468
|
+
}).openapi({
|
|
469
|
+
title: "MinimalProject",
|
|
470
|
+
description: "Subset of project fields for lightweight listings.",
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
export const ListProjectsInputSchema = z
|
|
474
|
+
.object({
|
|
475
|
+
query: z.string().optional().openapi({
|
|
476
|
+
description: "Search query for projects.",
|
|
477
|
+
example: "ecommerce app",
|
|
478
|
+
}),
|
|
479
|
+
tags: z
|
|
480
|
+
.array(z.string())
|
|
481
|
+
.optional()
|
|
482
|
+
.openapi({
|
|
483
|
+
description: "Tags to filter projects by.",
|
|
484
|
+
example: ["react", "design"],
|
|
485
|
+
}),
|
|
486
|
+
clientName: z.string().optional().openapi({
|
|
487
|
+
description: "Client name to filter projects by.",
|
|
488
|
+
example: "Acme Corp",
|
|
489
|
+
}),
|
|
490
|
+
userId: z.string().optional().openapi({
|
|
491
|
+
description: "Filter projects by user ID.",
|
|
492
|
+
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
493
|
+
}),
|
|
494
|
+
page: z.number().int().optional().default(1).openapi({
|
|
495
|
+
description: "Page number for pagination.",
|
|
496
|
+
example: 1,
|
|
497
|
+
}),
|
|
498
|
+
perPage: z.number().int().optional().default(10).openapi({
|
|
499
|
+
description: "Number of items per page.",
|
|
500
|
+
example: 10,
|
|
501
|
+
}),
|
|
502
|
+
})
|
|
503
|
+
.openapi({
|
|
504
|
+
title: "ListProjectsInput",
|
|
505
|
+
description: "Parameters for listing or searching projects.",
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
export const ProjectWithProjectViewsEntitySchema = MinimalProjectSchema.extend({
|
|
509
|
+
views: z.array(ProjectViewEntitySchema).openapi({
|
|
510
|
+
description: "Array of project view records.",
|
|
511
|
+
}),
|
|
512
|
+
}).openapi({
|
|
513
|
+
title: "ProjectWithProjectViewsEntity",
|
|
514
|
+
description: "Project entity with associated views.",
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
export const ProjectWithProjectCommentsEntitySchema =
|
|
518
|
+
MinimalProjectSchema.extend({
|
|
519
|
+
comments: z.array(ProjectCommentEntitySchema).openapi({
|
|
520
|
+
description: "Array of comments on the project.",
|
|
521
|
+
}),
|
|
522
|
+
}).openapi({
|
|
523
|
+
title: "ProjectWithProjectCommentsEntity",
|
|
524
|
+
description: "Project entity with associated comments.",
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
export const ProjectWithProjectLikesEntitySchema = MinimalProjectSchema.extend({
|
|
528
|
+
likes: z.array(ProjectLikeEntitySchema).openapi({
|
|
529
|
+
description: "Array of likes on the project.",
|
|
530
|
+
}),
|
|
531
|
+
}).openapi({
|
|
532
|
+
title: "ProjectWithProjectLikesEntity",
|
|
533
|
+
description: "Project entity with associated likes.",
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
export const ProjectWithProjectBookmarksEntitySchema =
|
|
537
|
+
MinimalProjectSchema.extend({
|
|
538
|
+
bookmarks: z.array(ProjectBookmarkEntitySchema).openapi({
|
|
539
|
+
description: "Array of bookmarks for the project.",
|
|
540
|
+
}),
|
|
541
|
+
}).openapi({
|
|
542
|
+
title: "ProjectWithProjectBookmarksEntity",
|
|
543
|
+
description: "Project entity with associated bookmarks.",
|
|
544
|
+
});
|
package/src/types/project.ts
CHANGED
|
@@ -1,112 +1,94 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { z } from "@hono/zod-openapi";
|
|
2
|
+
import type {
|
|
3
|
+
ProjectEntitySchema,
|
|
4
|
+
ProjectFileEntitySchema,
|
|
5
|
+
ProjectWithFilesEntitySchema,
|
|
6
|
+
ProjectViewEntitySchema,
|
|
7
|
+
ProjectLikeEntitySchema,
|
|
8
|
+
ProjectCommentEntitySchema,
|
|
9
|
+
ProjectBookmarkEntitySchema,
|
|
10
|
+
ProjectUpdateOutputEntitySchema,
|
|
11
|
+
CreateProjectInputSchema,
|
|
12
|
+
CreateProjectOutputSchema,
|
|
13
|
+
UpdateProjectInputSchema,
|
|
14
|
+
UpdateProjectOutputSchema,
|
|
15
|
+
ProjectIdSchema,
|
|
16
|
+
CommentOnProjectParamsSchema,
|
|
17
|
+
CommentOnProjectInputSchema,
|
|
18
|
+
CommentOnProjectOutputSchema,
|
|
19
|
+
DeleteProjectInputSchema,
|
|
20
|
+
DeleteProjectCommentParamsSchema,
|
|
21
|
+
DeleteProjectCommentOutputSchema,
|
|
22
|
+
DeleteProjectOutputSchema,
|
|
23
|
+
GetProjectParamsSchema,
|
|
24
|
+
GetProjectOutputSchema,
|
|
25
|
+
BookmarkProjectParamsSchema,
|
|
26
|
+
BookmarkProjectOutputSchema,
|
|
27
|
+
LikeProjectParamsSchema,
|
|
28
|
+
UnlikeProjectParamsSchema,
|
|
29
|
+
ViewProjectInputSchema,
|
|
30
|
+
MinimalProjectSchema,
|
|
31
|
+
ListProjectsInputSchema,
|
|
32
|
+
ProjectWithProjectViewsEntitySchema,
|
|
33
|
+
ProjectWithProjectCommentsEntitySchema,
|
|
34
|
+
ProjectWithProjectLikesEntitySchema,
|
|
35
|
+
ProjectWithProjectBookmarksEntitySchema,
|
|
36
|
+
} from "../schemas/project";
|
|
5
37
|
|
|
6
|
-
export type
|
|
7
|
-
|
|
8
|
-
projectId: string;
|
|
9
|
-
fileId: string;
|
|
10
|
-
order: number;
|
|
11
|
-
isPlaceholder: boolean;
|
|
12
|
-
};
|
|
38
|
+
export type ProjectEntity = z.infer<typeof ProjectEntitySchema>;
|
|
39
|
+
export type ProjectFileEntity = z.infer<typeof ProjectFileEntitySchema>;
|
|
13
40
|
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
clientId?: string;
|
|
24
|
-
clientType?: ClientType;
|
|
25
|
-
clientName?: string;
|
|
26
|
-
projectCreatorType: Role;
|
|
27
|
-
tags?: string[];
|
|
28
|
-
isFeatured?: boolean;
|
|
29
|
-
startDate?: Date;
|
|
30
|
-
imagePlaceholderUrl?: string;
|
|
31
|
-
endDate?: Date;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type ProjectStatsEntity = ProjectSocialGraphEntity;
|
|
35
|
-
|
|
36
|
-
export type ProjectViewEntity = {
|
|
37
|
-
id: string;
|
|
38
|
-
userId?: string;
|
|
39
|
-
ipAddress?: string;
|
|
40
|
-
userAgent?: string;
|
|
41
|
-
projectId: string;
|
|
42
|
-
sessionId?: string;
|
|
43
|
-
viewedAt: Date;
|
|
44
|
-
viewDate: Date;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type ProjectLikeEntity = {
|
|
48
|
-
createdAt: Date;
|
|
49
|
-
userId: string;
|
|
50
|
-
projectId: string;
|
|
51
|
-
};
|
|
52
|
-
export type ProjectCommentEntity = {
|
|
53
|
-
id: string;
|
|
54
|
-
createdAt: Date;
|
|
55
|
-
userId: string;
|
|
56
|
-
projectId: string;
|
|
57
|
-
parentCommentId?: string;
|
|
58
|
-
content: string;
|
|
59
|
-
};
|
|
60
|
-
export type ProjectBookmarkEntity = {
|
|
61
|
-
createdAt: Date;
|
|
62
|
-
userId: string;
|
|
63
|
-
projectId: string;
|
|
64
|
-
};
|
|
65
|
-
export type ProjectUpdateOutputEntity = {
|
|
66
|
-
id: string;
|
|
67
|
-
};
|
|
68
|
-
export type MinimalProject = Pick<
|
|
69
|
-
ProjectEntity,
|
|
70
|
-
| "id"
|
|
71
|
-
| "title"
|
|
72
|
-
| "description"
|
|
73
|
-
| "tags"
|
|
74
|
-
| "startDate"
|
|
75
|
-
| "endDate"
|
|
76
|
-
| "imagePlaceholderUrl"
|
|
41
|
+
export type ProjectWithFilesEntity = z.infer<
|
|
42
|
+
typeof ProjectWithFilesEntitySchema
|
|
43
|
+
>;
|
|
44
|
+
export type ProjectViewEntity = z.infer<typeof ProjectViewEntitySchema>;
|
|
45
|
+
export type ProjectLikeEntity = z.infer<typeof ProjectLikeEntitySchema>;
|
|
46
|
+
export type ProjectCommentEntity = z.infer<typeof ProjectCommentEntitySchema>;
|
|
47
|
+
export type ProjectBookmarkEntity = z.infer<typeof ProjectBookmarkEntitySchema>;
|
|
48
|
+
export type ProjectUpdateOutputEntity = z.infer<
|
|
49
|
+
typeof ProjectUpdateOutputEntitySchema
|
|
77
50
|
>;
|
|
78
51
|
|
|
79
|
-
export type
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
export type ProjectWithProjectFilesEntity = MinimalProject & {
|
|
84
|
-
projectFiles: (ProjectFileEntity & {
|
|
85
|
-
file: FileEntity;
|
|
86
|
-
})[];
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export type ListProjectsInput = {
|
|
90
|
-
query?: string;
|
|
91
|
-
tags?: string[];
|
|
92
|
-
clientName?: string;
|
|
93
|
-
userId?: string;
|
|
94
|
-
page?: number;
|
|
95
|
-
perPage?: number;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type ProjectWithProjectViewsEntity = MinimalProject & {
|
|
99
|
-
views: ProjectViewEntity[];
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type ProjectWithProjectCommentsEntity = MinimalProject & {
|
|
103
|
-
comments: ProjectCommentEntity[];
|
|
104
|
-
};
|
|
52
|
+
export type CreateProjectInput = z.infer<typeof CreateProjectInputSchema>;
|
|
53
|
+
export type CreateProjectOutput = z.infer<typeof CreateProjectOutputSchema>;
|
|
54
|
+
export type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;
|
|
55
|
+
export type UpdateProjectOutput = z.infer<typeof UpdateProjectOutputSchema>;
|
|
105
56
|
|
|
106
|
-
export type
|
|
107
|
-
|
|
108
|
-
|
|
57
|
+
export type ProjectId = z.infer<typeof ProjectIdSchema>;
|
|
58
|
+
export type CommentOnProjectParams = z.infer<
|
|
59
|
+
typeof CommentOnProjectParamsSchema
|
|
60
|
+
>;
|
|
61
|
+
export type CommentOnProjectInput = z.infer<typeof CommentOnProjectInputSchema>;
|
|
62
|
+
export type CommentOnProjectOutput = z.infer<
|
|
63
|
+
typeof CommentOnProjectOutputSchema
|
|
64
|
+
>;
|
|
65
|
+
export type DeleteProjectInput = z.infer<typeof DeleteProjectInputSchema>;
|
|
66
|
+
export type DeleteProjectCommentParams = z.infer<
|
|
67
|
+
typeof DeleteProjectCommentParamsSchema
|
|
68
|
+
>;
|
|
69
|
+
export type DeleteProjectCommentOutput = z.infer<
|
|
70
|
+
typeof DeleteProjectCommentOutputSchema
|
|
71
|
+
>;
|
|
72
|
+
export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
|
|
73
|
+
export type GetProjectParams = z.infer<typeof GetProjectParamsSchema>;
|
|
74
|
+
export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
|
|
75
|
+
export type BookmarkProjectParams = z.infer<typeof BookmarkProjectParamsSchema>;
|
|
76
|
+
export type BookmarkProjectOutput = z.infer<typeof BookmarkProjectOutputSchema>;
|
|
77
|
+
export type LikeProjectParams = z.infer<typeof LikeProjectParamsSchema>;
|
|
78
|
+
export type UnlikeProjectParams = z.infer<typeof UnlikeProjectParamsSchema>;
|
|
79
|
+
export type ViewProjectInput = z.infer<typeof ViewProjectInputSchema>;
|
|
109
80
|
|
|
110
|
-
export type
|
|
111
|
-
|
|
112
|
-
|
|
81
|
+
export type MinimalProject = z.infer<typeof MinimalProjectSchema>;
|
|
82
|
+
export type ListProjectsInput = z.infer<typeof ListProjectsInputSchema>;
|
|
83
|
+
export type ProjectWithProjectViewsEntity = z.infer<
|
|
84
|
+
typeof ProjectWithProjectViewsEntitySchema
|
|
85
|
+
>;
|
|
86
|
+
export type ProjectWithProjectCommentsEntity = z.infer<
|
|
87
|
+
typeof ProjectWithProjectCommentsEntitySchema
|
|
88
|
+
>;
|
|
89
|
+
export type ProjectWithProjectLikesEntity = z.infer<
|
|
90
|
+
typeof ProjectWithProjectLikesEntitySchema
|
|
91
|
+
>;
|
|
92
|
+
export type ProjectWithProjectBookmarksEntity = z.infer<
|
|
93
|
+
typeof ProjectWithProjectBookmarksEntitySchema
|
|
94
|
+
>;
|