@zyacreatives/shared 1.6.4 → 1.6.6
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/bookmark.d.ts +8 -0
- package/dist/schemas/bookmark.js +31 -0
- package/dist/schemas/comment.d.ts +14 -0
- package/dist/schemas/comment.js +44 -0
- package/dist/schemas/entity-stats.d.ts +14 -0
- package/dist/schemas/entity-stats.js +44 -0
- package/dist/schemas/like.d.ts +7 -0
- package/dist/schemas/like.js +27 -0
- package/dist/schemas/project.d.ts +43 -59
- package/dist/schemas/project.js +12 -47
- package/dist/schemas/user.d.ts +14 -8
- package/dist/schemas/user.js +4 -2
- package/dist/schemas/view.d.ts +15 -0
- package/dist/schemas/view.js +48 -0
- package/dist/types/bookmark.d.ts +3 -0
- package/dist/types/bookmark.js +2 -0
- package/dist/types/comment.d.ts +3 -0
- package/dist/types/comment.js +2 -0
- package/dist/types/entity-stats.d.ts +3 -0
- package/dist/types/entity-stats.js +2 -0
- package/dist/types/like.d.ts +3 -0
- package/dist/types/like.js +2 -0
- package/dist/types/project.d.ts +7 -5
- package/package.json +1 -1
- package/src/schemas/bookmark.ts +29 -0
- package/src/schemas/comment.ts +40 -0
- package/src/schemas/entity-stats.ts +43 -0
- package/src/schemas/like.ts +25 -0
- package/src/schemas/project.ts +11 -52
- package/src/schemas/user.ts +5 -4
- package/src/schemas/view.ts +50 -0
- package/src/types/bookmark.ts +4 -0
- package/src/types/comment.ts +4 -0
- package/src/types/entity-stats.ts +4 -0
- package/src/types/like.ts +4 -0
- package/src/types/project.ts +6 -8
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BookmarkEntitySchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
exports.BookmarkEntitySchema = zod_openapi_1.z
|
|
6
|
+
.object({
|
|
7
|
+
id: zod_openapi_1.z.cuid2().openapi({
|
|
8
|
+
description: "Unique identifier for the bookmark.",
|
|
9
|
+
title: "Bookmark ID",
|
|
10
|
+
}),
|
|
11
|
+
createdAt: zod_openapi_1.z.string().datetime().openapi({
|
|
12
|
+
description: "Timestamp when the bookmark was created.",
|
|
13
|
+
title: "Created At",
|
|
14
|
+
}),
|
|
15
|
+
userId: zod_openapi_1.z.cuid2().openapi({
|
|
16
|
+
description: "Identifier of the user who created the bookmark.",
|
|
17
|
+
title: "User ID",
|
|
18
|
+
}),
|
|
19
|
+
parentId: zod_openapi_1.z.cuid2().openapi({
|
|
20
|
+
description: "Identifier of the parent entity that was bookmarked.",
|
|
21
|
+
title: "Parent ID",
|
|
22
|
+
}),
|
|
23
|
+
parentType: zod_openapi_1.z.string().openapi({
|
|
24
|
+
description: "Type of the parent entity (e.g., project, post, etc.).",
|
|
25
|
+
title: "Parent Type",
|
|
26
|
+
}),
|
|
27
|
+
})
|
|
28
|
+
.openapi({
|
|
29
|
+
title: "Bookmark",
|
|
30
|
+
description: "Represents a user bookmark on a specific parent entity.",
|
|
31
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const CommentEntitySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodCUID2;
|
|
4
|
+
userId: z.ZodCUID2;
|
|
5
|
+
parentId: z.ZodCUID2;
|
|
6
|
+
parentType: z.ZodEnum<{
|
|
7
|
+
readonly PROJECT: "PROJECT";
|
|
8
|
+
readonly POST: "POST";
|
|
9
|
+
}>;
|
|
10
|
+
content: z.ZodString;
|
|
11
|
+
replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
12
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
13
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CommentEntitySchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
exports.CommentEntitySchema = zod_1.default.object({
|
|
10
|
+
id: zod_1.default.cuid2().openapi({
|
|
11
|
+
description: "The unique CUID2 identifier for the comment.",
|
|
12
|
+
example: "tr4q2k7k0000c7625z2k8ggy",
|
|
13
|
+
}),
|
|
14
|
+
userId: zod_1.default.cuid2().openapi({
|
|
15
|
+
description: "The CUID2 of the user who created the comment.",
|
|
16
|
+
example: "clq9p8f2z0000c762s7k4g1b",
|
|
17
|
+
}),
|
|
18
|
+
parentId: zod_1.default.cuid2().openapi({
|
|
19
|
+
description: "The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
|
|
20
|
+
example: "clq9p8f2z0000c762s7k4g1b",
|
|
21
|
+
}),
|
|
22
|
+
parentType: zod_1.default.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
|
|
23
|
+
description: "The type of the parent entity this comment is attached to.",
|
|
24
|
+
example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
|
|
25
|
+
}),
|
|
26
|
+
content: zod_1.default.string().openapi({
|
|
27
|
+
description: "The text content of the comment. May contain Markdown.",
|
|
28
|
+
example: "This is a great point! I hadn't considered that perspective.",
|
|
29
|
+
}),
|
|
30
|
+
replyToId: zod_1.default.cuid2().optional().nullable().openapi({
|
|
31
|
+
description: "The ID of the parent comment if this is a reply. Null for top-level comments.",
|
|
32
|
+
example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
|
|
33
|
+
}),
|
|
34
|
+
createdAt: zod_1.default.coerce.date().optional().openapi({
|
|
35
|
+
description: "The date and time the comment was created.",
|
|
36
|
+
example: "2023-10-27T10:00:00.000Z",
|
|
37
|
+
format: "date-time",
|
|
38
|
+
}),
|
|
39
|
+
updatedAt: zod_1.default.coerce.date().optional().openapi({
|
|
40
|
+
description: "The date and time the comment was last updated.",
|
|
41
|
+
example: "2023-10-27T10:05:00.000Z",
|
|
42
|
+
format: "date-time",
|
|
43
|
+
})
|
|
44
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const EntityStatsSchema: z.ZodObject<{
|
|
3
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
4
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
5
|
+
parentId: z.ZodCUID2;
|
|
6
|
+
parentType: z.ZodEnum<{
|
|
7
|
+
readonly PROJECT: "PROJECT";
|
|
8
|
+
readonly POST: "POST";
|
|
9
|
+
}>;
|
|
10
|
+
likesCount: z.ZodNumber;
|
|
11
|
+
bookmarksCount: z.ZodNumber;
|
|
12
|
+
viewsCount: z.ZodNumber;
|
|
13
|
+
commentsCount: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityStatsSchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
exports.EntityStatsSchema = zod_openapi_1.z
|
|
7
|
+
.object({
|
|
8
|
+
updatedAt: zod_openapi_1.z.coerce.date().optional().openapi({
|
|
9
|
+
description: "Timestamp of the last update to the entity statistics.",
|
|
10
|
+
title: "Updated At",
|
|
11
|
+
}),
|
|
12
|
+
createdAt: zod_openapi_1.z.coerce.date().optional().openapi({
|
|
13
|
+
description: "Timestamp of the creationn to the entity statistics.",
|
|
14
|
+
title: "Updated At",
|
|
15
|
+
}),
|
|
16
|
+
parentId: zod_openapi_1.z.cuid2().openapi({
|
|
17
|
+
description: "Unique identifier of the parent entity (e.g., project, post, etc.).",
|
|
18
|
+
title: "Parent ID",
|
|
19
|
+
}),
|
|
20
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
|
|
21
|
+
description: "Type of the parent entity this statistic belongs to.",
|
|
22
|
+
title: "Parent Type",
|
|
23
|
+
}),
|
|
24
|
+
likesCount: zod_openapi_1.z.number().openapi({
|
|
25
|
+
description: "Total number of likes associated with the entity.",
|
|
26
|
+
title: "Likes Count",
|
|
27
|
+
}),
|
|
28
|
+
bookmarksCount: zod_openapi_1.z.number().openapi({
|
|
29
|
+
description: "Total number of bookmarks associated with the entity.",
|
|
30
|
+
title: "Bookmarks Count",
|
|
31
|
+
}),
|
|
32
|
+
viewsCount: zod_openapi_1.z.number().openapi({
|
|
33
|
+
description: "Total number of views recorded for the entity.",
|
|
34
|
+
title: "Views Count",
|
|
35
|
+
}),
|
|
36
|
+
commentsCount: zod_openapi_1.z.number().openapi({
|
|
37
|
+
description: "Total number of comments linked to the entity.",
|
|
38
|
+
title: "Comments Count",
|
|
39
|
+
}),
|
|
40
|
+
})
|
|
41
|
+
.openapi({
|
|
42
|
+
description: "Represents engagement statistics for a specific entity.",
|
|
43
|
+
title: "EntityStats",
|
|
44
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LikeEntitySchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
exports.LikeEntitySchema = zod_openapi_1.z
|
|
6
|
+
.object({
|
|
7
|
+
createdAt: zod_openapi_1.z.coerce.date().optional().openapi({
|
|
8
|
+
description: "Timestamp when the like was created.",
|
|
9
|
+
title: "Created At",
|
|
10
|
+
}),
|
|
11
|
+
userId: zod_openapi_1.z.cuid2().openapi({
|
|
12
|
+
description: "Identifier of the user who performed the like.",
|
|
13
|
+
title: "User ID",
|
|
14
|
+
}),
|
|
15
|
+
parentId: zod_openapi_1.z.cuid2().openapi({
|
|
16
|
+
description: "Identifier of the parent entity that was liked.",
|
|
17
|
+
title: "Parent ID",
|
|
18
|
+
}),
|
|
19
|
+
parentType: zod_openapi_1.z.string().openapi({
|
|
20
|
+
description: "Type of the parent entity (e.g., project, post, etc.).",
|
|
21
|
+
title: "Parent Type",
|
|
22
|
+
}),
|
|
23
|
+
})
|
|
24
|
+
.openapi({
|
|
25
|
+
description: "Represents a single like event on a parent entity.",
|
|
26
|
+
title: "Like",
|
|
27
|
+
});
|
|
@@ -86,37 +86,6 @@ export declare const ProjectWithFilesEntitySchema: z.ZodObject<{
|
|
|
86
86
|
}, z.core.$strip>;
|
|
87
87
|
}, z.core.$strip>>>;
|
|
88
88
|
}, z.core.$strip>;
|
|
89
|
-
export declare const ProjectViewEntitySchema: z.ZodObject<{
|
|
90
|
-
id: z.ZodCUID2;
|
|
91
|
-
projectId: z.ZodCUID2;
|
|
92
|
-
userId: z.ZodOptional<z.ZodCUID2>;
|
|
93
|
-
ipAddress: z.ZodOptional<z.ZodIPv4>;
|
|
94
|
-
userAgent: z.ZodOptional<z.ZodString>;
|
|
95
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
96
|
-
viewedAt: z.ZodCoercedDate<unknown>;
|
|
97
|
-
viewDate: z.ZodCoercedDate<unknown>;
|
|
98
|
-
}, z.core.$strip>;
|
|
99
|
-
export declare const ProjectLikeEntitySchema: z.ZodObject<{
|
|
100
|
-
projectId: z.ZodCUID2;
|
|
101
|
-
userId: z.ZodCUID2;
|
|
102
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
103
|
-
}, z.core.$strip>;
|
|
104
|
-
export declare const ProjectCommentEntitySchema: z.ZodObject<{
|
|
105
|
-
id: z.ZodCUID2;
|
|
106
|
-
projectId: z.ZodCUID2;
|
|
107
|
-
userId: z.ZodCUID2;
|
|
108
|
-
commenterName: z.ZodString;
|
|
109
|
-
commenterUsername: z.ZodString;
|
|
110
|
-
commenterImageUrl: z.ZodOptional<z.ZodString>;
|
|
111
|
-
parentCommentId: z.ZodOptional<z.ZodCUID2>;
|
|
112
|
-
content: z.ZodString;
|
|
113
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
114
|
-
}, z.core.$strip>;
|
|
115
|
-
export declare const ProjectBookmarkEntitySchema: z.ZodObject<{
|
|
116
|
-
projectId: z.ZodCUID2;
|
|
117
|
-
userId: z.ZodCUID2;
|
|
118
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
119
|
-
}, z.core.$strip>;
|
|
120
89
|
export declare const ProjectUpdateOutputEntitySchema: z.ZodObject<{
|
|
121
90
|
id: z.ZodCUID2;
|
|
122
91
|
}, z.core.$strip>;
|
|
@@ -253,25 +222,29 @@ export declare const UpdateProjectOutputSchema: z.ZodObject<{
|
|
|
253
222
|
}, z.core.$strip>;
|
|
254
223
|
export declare const CommentOnProjectOutputSchema: z.ZodObject<{
|
|
255
224
|
id: z.ZodCUID2;
|
|
256
|
-
projectId: z.ZodCUID2;
|
|
257
225
|
userId: z.ZodCUID2;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
226
|
+
parentId: z.ZodCUID2;
|
|
227
|
+
parentType: z.ZodEnum<{
|
|
228
|
+
readonly PROJECT: "PROJECT";
|
|
229
|
+
readonly POST: "POST";
|
|
230
|
+
}>;
|
|
262
231
|
content: z.ZodString;
|
|
232
|
+
replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
263
233
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
234
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
264
235
|
}, z.core.$strip>;
|
|
265
236
|
export declare const DeleteProjectCommentOutputSchema: z.ZodObject<{
|
|
266
237
|
id: z.ZodCUID2;
|
|
267
|
-
projectId: z.ZodCUID2;
|
|
268
238
|
userId: z.ZodCUID2;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
239
|
+
parentId: z.ZodCUID2;
|
|
240
|
+
parentType: z.ZodEnum<{
|
|
241
|
+
readonly PROJECT: "PROJECT";
|
|
242
|
+
readonly POST: "POST";
|
|
243
|
+
}>;
|
|
273
244
|
content: z.ZodString;
|
|
245
|
+
replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
274
246
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
247
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
275
248
|
}, z.core.$strip>;
|
|
276
249
|
export declare const DeleteProjectOutputSchema: z.ZodObject<{
|
|
277
250
|
id: z.ZodString;
|
|
@@ -348,9 +321,11 @@ export declare const GetProjectOutputSchema: z.ZodObject<{
|
|
|
348
321
|
}, z.core.$strip>>>;
|
|
349
322
|
}, z.core.$strip>;
|
|
350
323
|
export declare const BookmarkProjectOutputSchema: z.ZodObject<{
|
|
351
|
-
|
|
324
|
+
id: z.ZodCUID2;
|
|
325
|
+
createdAt: z.ZodString;
|
|
352
326
|
userId: z.ZodCUID2;
|
|
353
|
-
|
|
327
|
+
parentId: z.ZodCUID2;
|
|
328
|
+
parentType: z.ZodString;
|
|
354
329
|
}, z.core.$strip>;
|
|
355
330
|
export declare const ProjectIdSchema: z.ZodObject<{
|
|
356
331
|
projectId: z.ZodCUID2;
|
|
@@ -385,13 +360,17 @@ export declare const ProjectWithProjectViewsEntitySchema: z.ZodObject<{
|
|
|
385
360
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
386
361
|
views: z.ZodArray<z.ZodObject<{
|
|
387
362
|
id: z.ZodCUID2;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
363
|
+
userId: z.ZodNullable<z.ZodCUID2>;
|
|
364
|
+
ipAddress: z.ZodNullable<z.ZodString>;
|
|
365
|
+
userAgent: z.ZodNullable<z.ZodString>;
|
|
366
|
+
parentId: z.ZodCUID2;
|
|
367
|
+
parentType: z.ZodEnum<{
|
|
368
|
+
readonly PROJECT: "PROJECT";
|
|
369
|
+
readonly POST: "POST";
|
|
370
|
+
}>;
|
|
371
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
372
|
+
viewedAt: z.ZodString;
|
|
373
|
+
viewDate: z.ZodString;
|
|
395
374
|
}, z.core.$strip>>;
|
|
396
375
|
}, z.core.$strip>;
|
|
397
376
|
export declare const ProjectWithProjectCommentsEntitySchema: z.ZodObject<{
|
|
@@ -404,14 +383,16 @@ export declare const ProjectWithProjectCommentsEntitySchema: z.ZodObject<{
|
|
|
404
383
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
405
384
|
comments: z.ZodArray<z.ZodObject<{
|
|
406
385
|
id: z.ZodCUID2;
|
|
407
|
-
projectId: z.ZodCUID2;
|
|
408
386
|
userId: z.ZodCUID2;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
387
|
+
parentId: z.ZodCUID2;
|
|
388
|
+
parentType: z.ZodEnum<{
|
|
389
|
+
readonly PROJECT: "PROJECT";
|
|
390
|
+
readonly POST: "POST";
|
|
391
|
+
}>;
|
|
413
392
|
content: z.ZodString;
|
|
393
|
+
replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
414
394
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
395
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
415
396
|
}, z.core.$strip>>;
|
|
416
397
|
}, z.core.$strip>;
|
|
417
398
|
export declare const ProjectWithProjectLikesEntitySchema: z.ZodObject<{
|
|
@@ -423,9 +404,10 @@ export declare const ProjectWithProjectLikesEntitySchema: z.ZodObject<{
|
|
|
423
404
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
424
405
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
425
406
|
likes: z.ZodArray<z.ZodObject<{
|
|
426
|
-
projectId: z.ZodCUID2;
|
|
427
|
-
userId: z.ZodCUID2;
|
|
428
407
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
408
|
+
userId: z.ZodCUID2;
|
|
409
|
+
parentId: z.ZodCUID2;
|
|
410
|
+
parentType: z.ZodString;
|
|
429
411
|
}, z.core.$strip>>;
|
|
430
412
|
}, z.core.$strip>;
|
|
431
413
|
export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
|
|
@@ -437,8 +419,10 @@ export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
|
|
|
437
419
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
438
420
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
439
421
|
bookmarks: z.ZodArray<z.ZodObject<{
|
|
440
|
-
|
|
422
|
+
id: z.ZodCUID2;
|
|
423
|
+
createdAt: z.ZodString;
|
|
441
424
|
userId: z.ZodCUID2;
|
|
442
|
-
|
|
425
|
+
parentId: z.ZodCUID2;
|
|
426
|
+
parentType: z.ZodString;
|
|
443
427
|
}, z.core.$strip>>;
|
|
444
428
|
}, z.core.$strip>;
|
package/dist/schemas/project.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithProjectLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.ListProjectsInputSchema = exports.MinimalProjectSchema = exports.CommentOnProjectParamsSchema = exports.ProjectIdSchema = exports.BookmarkProjectOutputSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.DeleteProjectCommentOutputSchema = exports.CommentOnProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.DeleteProjectCommentInputSchema = exports.CommentOnProjectInputSchema = exports.ViewProjectInputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.
|
|
3
|
+
exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithProjectLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.ListProjectsInputSchema = exports.MinimalProjectSchema = exports.CommentOnProjectParamsSchema = exports.ProjectIdSchema = exports.BookmarkProjectOutputSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.DeleteProjectCommentOutputSchema = exports.CommentOnProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.DeleteProjectCommentInputSchema = exports.CommentOnProjectInputSchema = exports.ViewProjectInputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.ProjectWithFilesEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.ProjectEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const file_1 = require("./file");
|
|
7
|
+
const comment_1 = require("./comment");
|
|
8
|
+
const bookmark_1 = require("./bookmark");
|
|
9
|
+
const view_1 = require("./view");
|
|
10
|
+
const like_1 = require("./like");
|
|
7
11
|
/* ------------------------------ Core Entities ------------------------------ */
|
|
8
12
|
exports.ProjectEntitySchema = zod_openapi_1.z
|
|
9
13
|
.object({
|
|
@@ -132,45 +136,6 @@ exports.ProjectWithFilesEntitySchema = exports.ProjectEntitySchema.extend({
|
|
|
132
136
|
.optional()
|
|
133
137
|
.openapi({ description: "Files associated with the project." }),
|
|
134
138
|
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
135
|
-
exports.ProjectViewEntitySchema = zod_openapi_1.z
|
|
136
|
-
.object({
|
|
137
|
-
id: zod_openapi_1.z.cuid2(),
|
|
138
|
-
projectId: zod_openapi_1.z.cuid2(),
|
|
139
|
-
userId: zod_openapi_1.z.cuid2().optional(),
|
|
140
|
-
ipAddress: zod_openapi_1.z.ipv4().optional(),
|
|
141
|
-
userAgent: zod_openapi_1.z.string().optional(),
|
|
142
|
-
sessionId: zod_openapi_1.z.string().optional(),
|
|
143
|
-
viewedAt: zod_openapi_1.z.coerce.date(),
|
|
144
|
-
viewDate: zod_openapi_1.z.coerce.date(),
|
|
145
|
-
})
|
|
146
|
-
.openapi("ProjectViewEntity");
|
|
147
|
-
exports.ProjectLikeEntitySchema = zod_openapi_1.z
|
|
148
|
-
.object({
|
|
149
|
-
projectId: zod_openapi_1.z.cuid2(),
|
|
150
|
-
userId: zod_openapi_1.z.cuid2(),
|
|
151
|
-
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
152
|
-
})
|
|
153
|
-
.openapi("ProjectLikeEntity");
|
|
154
|
-
exports.ProjectCommentEntitySchema = zod_openapi_1.z
|
|
155
|
-
.object({
|
|
156
|
-
id: zod_openapi_1.z.cuid2(),
|
|
157
|
-
projectId: zod_openapi_1.z.cuid2(),
|
|
158
|
-
userId: zod_openapi_1.z.cuid2(),
|
|
159
|
-
commenterName: zod_openapi_1.z.string(),
|
|
160
|
-
commenterUsername: zod_openapi_1.z.string(),
|
|
161
|
-
commenterImageUrl: zod_openapi_1.z.string().optional(),
|
|
162
|
-
parentCommentId: zod_openapi_1.z.cuid2().optional(),
|
|
163
|
-
content: zod_openapi_1.z.string().min(1),
|
|
164
|
-
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
165
|
-
})
|
|
166
|
-
.openapi("ProjectCommentEntity");
|
|
167
|
-
exports.ProjectBookmarkEntitySchema = zod_openapi_1.z
|
|
168
|
-
.object({
|
|
169
|
-
projectId: zod_openapi_1.z.cuid2(),
|
|
170
|
-
userId: zod_openapi_1.z.cuid2(),
|
|
171
|
-
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
172
|
-
})
|
|
173
|
-
.openapi("ProjectBookmarkEntity");
|
|
174
139
|
exports.ProjectUpdateOutputEntitySchema = zod_openapi_1.z
|
|
175
140
|
.object({ id: zod_openapi_1.z.cuid2() })
|
|
176
141
|
.openapi("ProjectUpdateOutputEntity");
|
|
@@ -261,11 +226,11 @@ exports.DeleteProjectCommentInputSchema = zod_openapi_1.z.object({
|
|
|
261
226
|
});
|
|
262
227
|
exports.CreateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
263
228
|
exports.UpdateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
264
|
-
exports.CommentOnProjectOutputSchema =
|
|
265
|
-
exports.DeleteProjectCommentOutputSchema =
|
|
229
|
+
exports.CommentOnProjectOutputSchema = comment_1.CommentEntitySchema;
|
|
230
|
+
exports.DeleteProjectCommentOutputSchema = comment_1.CommentEntitySchema;
|
|
266
231
|
exports.DeleteProjectOutputSchema = exports.ProjectEntitySchema;
|
|
267
232
|
exports.GetProjectOutputSchema = exports.ProjectWithFilesEntitySchema;
|
|
268
|
-
exports.BookmarkProjectOutputSchema =
|
|
233
|
+
exports.BookmarkProjectOutputSchema = bookmark_1.BookmarkEntitySchema;
|
|
269
234
|
exports.ProjectIdSchema = zod_openapi_1.z.object({ projectId: zod_openapi_1.z.cuid2() });
|
|
270
235
|
exports.CommentOnProjectParamsSchema = exports.ProjectIdSchema;
|
|
271
236
|
exports.MinimalProjectSchema = exports.ProjectEntitySchema.pick({
|
|
@@ -292,22 +257,22 @@ exports.ListProjectsInputSchema = zod_openapi_1.z
|
|
|
292
257
|
title: "ListProjectsInput",
|
|
293
258
|
});
|
|
294
259
|
exports.ProjectWithProjectViewsEntitySchema = exports.MinimalProjectSchema.extend({
|
|
295
|
-
views: zod_openapi_1.z.array(
|
|
260
|
+
views: zod_openapi_1.z.array(view_1.ViewEntitySchema),
|
|
296
261
|
}).openapi({
|
|
297
262
|
title: "ProjectWithProjectViewsEntity",
|
|
298
263
|
});
|
|
299
264
|
exports.ProjectWithProjectCommentsEntitySchema = exports.MinimalProjectSchema.extend({
|
|
300
|
-
comments: zod_openapi_1.z.array(
|
|
265
|
+
comments: zod_openapi_1.z.array(comment_1.CommentEntitySchema),
|
|
301
266
|
}).openapi({
|
|
302
267
|
title: "ProjectWithProjectCommentsEntity",
|
|
303
268
|
});
|
|
304
269
|
exports.ProjectWithProjectLikesEntitySchema = exports.MinimalProjectSchema.extend({
|
|
305
|
-
likes: zod_openapi_1.z.array(
|
|
270
|
+
likes: zod_openapi_1.z.array(like_1.LikeEntitySchema),
|
|
306
271
|
}).openapi({
|
|
307
272
|
title: "ProjectWithProjectLikesEntity",
|
|
308
273
|
});
|
|
309
274
|
exports.ProjectWithProjectBookmarksEntitySchema = exports.MinimalProjectSchema.extend({
|
|
310
|
-
bookmarks: zod_openapi_1.z.array(
|
|
275
|
+
bookmarks: zod_openapi_1.z.array(bookmark_1.BookmarkEntitySchema),
|
|
311
276
|
}).openapi({
|
|
312
277
|
title: "ProjectWithProjectBookmarksEntity",
|
|
313
278
|
});
|
package/dist/schemas/user.d.ts
CHANGED
|
@@ -180,9 +180,10 @@ export declare const UserWithProjectsEntitySchema: z.ZodObject<{
|
|
|
180
180
|
export declare const UserWithProjectLikesEntitySchema: z.ZodObject<{
|
|
181
181
|
userId: z.ZodCUID2;
|
|
182
182
|
projectLikes: z.ZodArray<z.ZodObject<{
|
|
183
|
-
projectId: z.ZodCUID2;
|
|
184
|
-
userId: z.ZodCUID2;
|
|
185
183
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
184
|
+
userId: z.ZodCUID2;
|
|
185
|
+
parentId: z.ZodCUID2;
|
|
186
|
+
parentType: z.ZodString;
|
|
186
187
|
project: z.ZodObject<{
|
|
187
188
|
id: z.ZodString;
|
|
188
189
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -197,9 +198,11 @@ export declare const UserWithProjectLikesEntitySchema: z.ZodObject<{
|
|
|
197
198
|
export declare const UserWithProjectBookmarksEntitySchema: z.ZodObject<{
|
|
198
199
|
userId: z.ZodCUID2;
|
|
199
200
|
projectBookmarks: z.ZodArray<z.ZodObject<{
|
|
200
|
-
|
|
201
|
+
id: z.ZodCUID2;
|
|
202
|
+
createdAt: z.ZodString;
|
|
201
203
|
userId: z.ZodCUID2;
|
|
202
|
-
|
|
204
|
+
parentId: z.ZodCUID2;
|
|
205
|
+
parentType: z.ZodString;
|
|
203
206
|
project: z.ZodObject<{
|
|
204
207
|
id: z.ZodString;
|
|
205
208
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -454,9 +457,11 @@ export declare const GetAuthenticatedUserWithProjectsOutputSchema: z.ZodObject<{
|
|
|
454
457
|
export declare const GetAuthenticatedUserWithProjectBookmarksOutputSchema: z.ZodObject<{
|
|
455
458
|
userId: z.ZodCUID2;
|
|
456
459
|
projectBookmarks: z.ZodArray<z.ZodObject<{
|
|
457
|
-
|
|
460
|
+
id: z.ZodCUID2;
|
|
461
|
+
createdAt: z.ZodString;
|
|
458
462
|
userId: z.ZodCUID2;
|
|
459
|
-
|
|
463
|
+
parentId: z.ZodCUID2;
|
|
464
|
+
parentType: z.ZodString;
|
|
460
465
|
project: z.ZodObject<{
|
|
461
466
|
id: z.ZodString;
|
|
462
467
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -523,9 +528,10 @@ export declare const GetAuthenticatedUserWithUserFollowersOutputSchema: z.ZodObj
|
|
|
523
528
|
export declare const GetAuthenticatedUserWithProjectLikesOutputSchema: z.ZodObject<{
|
|
524
529
|
userId: z.ZodCUID2;
|
|
525
530
|
projectLikes: z.ZodArray<z.ZodObject<{
|
|
526
|
-
projectId: z.ZodCUID2;
|
|
527
|
-
userId: z.ZodCUID2;
|
|
528
531
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
532
|
+
userId: z.ZodCUID2;
|
|
533
|
+
parentId: z.ZodCUID2;
|
|
534
|
+
parentType: z.ZodString;
|
|
529
535
|
project: z.ZodObject<{
|
|
530
536
|
id: z.ZodString;
|
|
531
537
|
description: z.ZodOptional<z.ZodString>;
|
package/dist/schemas/user.js
CHANGED
|
@@ -4,6 +4,8 @@ exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthentica
|
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const project_1 = require("./project");
|
|
7
|
+
const bookmark_1 = require("./bookmark");
|
|
8
|
+
const like_1 = require("./like");
|
|
7
9
|
exports.UserSocialGraphEntitySchema = zod_openapi_1.z
|
|
8
10
|
.object({
|
|
9
11
|
followerCount: zod_openapi_1.z
|
|
@@ -79,7 +81,7 @@ exports.UserWithProjectsEntitySchema = zod_openapi_1.z
|
|
|
79
81
|
.openapi("UserWithProjectsEntity");
|
|
80
82
|
exports.UserWithProjectLikesEntitySchema = zod_openapi_1.z.object({
|
|
81
83
|
userId: zod_openapi_1.z.cuid2(),
|
|
82
|
-
projectLikes: zod_openapi_1.z.array(
|
|
84
|
+
projectLikes: zod_openapi_1.z.array(like_1.LikeEntitySchema.extend({
|
|
83
85
|
project: project_1.ProjectEntitySchema.pick({
|
|
84
86
|
id: true,
|
|
85
87
|
title: true,
|
|
@@ -94,7 +96,7 @@ exports.UserWithProjectLikesEntitySchema = zod_openapi_1.z.object({
|
|
|
94
96
|
exports.UserWithProjectBookmarksEntitySchema = zod_openapi_1.z
|
|
95
97
|
.object({
|
|
96
98
|
userId: zod_openapi_1.z.cuid2(),
|
|
97
|
-
projectBookmarks: zod_openapi_1.z.array(
|
|
99
|
+
projectBookmarks: zod_openapi_1.z.array(bookmark_1.BookmarkEntitySchema.extend({
|
|
98
100
|
project: project_1.ProjectEntitySchema.pick({
|
|
99
101
|
id: true,
|
|
100
102
|
title: true,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const ViewEntitySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodCUID2;
|
|
4
|
+
userId: z.ZodNullable<z.ZodCUID2>;
|
|
5
|
+
ipAddress: z.ZodNullable<z.ZodString>;
|
|
6
|
+
userAgent: z.ZodNullable<z.ZodString>;
|
|
7
|
+
parentId: z.ZodCUID2;
|
|
8
|
+
parentType: z.ZodEnum<{
|
|
9
|
+
readonly PROJECT: "PROJECT";
|
|
10
|
+
readonly POST: "POST";
|
|
11
|
+
}>;
|
|
12
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
13
|
+
viewedAt: z.ZodString;
|
|
14
|
+
viewDate: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewEntitySchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
exports.ViewEntitySchema = zod_openapi_1.z
|
|
7
|
+
.object({
|
|
8
|
+
id: zod_openapi_1.z.cuid2().openapi({
|
|
9
|
+
description: "Unique identifier of the view record.",
|
|
10
|
+
title: "View ID",
|
|
11
|
+
}),
|
|
12
|
+
userId: zod_openapi_1.z.cuid2().nullable().openapi({
|
|
13
|
+
description: "Identifier of the user who viewed the entity, if authenticated.",
|
|
14
|
+
title: "User ID",
|
|
15
|
+
}),
|
|
16
|
+
ipAddress: zod_openapi_1.z.string().nullable().openapi({
|
|
17
|
+
description: "IP address from which the entity was viewed.",
|
|
18
|
+
title: "IP Address",
|
|
19
|
+
}),
|
|
20
|
+
userAgent: zod_openapi_1.z.string().nullable().openapi({
|
|
21
|
+
description: "User agent string identifying the client device or browser.",
|
|
22
|
+
title: "User Agent",
|
|
23
|
+
}),
|
|
24
|
+
parentId: zod_openapi_1.z.cuid2().openapi({
|
|
25
|
+
description: "Identifier of the parent entity being viewed.",
|
|
26
|
+
title: "Parent ID",
|
|
27
|
+
}),
|
|
28
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
|
|
29
|
+
description: "Type of the parent entity (e.g., project, post, etc.).",
|
|
30
|
+
title: "Parent Type",
|
|
31
|
+
}),
|
|
32
|
+
sessionId: zod_openapi_1.z.string().nullable().openapi({
|
|
33
|
+
description: "Session identifier associated with the view event, if available.",
|
|
34
|
+
title: "Session ID",
|
|
35
|
+
}),
|
|
36
|
+
viewedAt: zod_openapi_1.z.string().datetime().openapi({
|
|
37
|
+
description: "Exact timestamp when the view occurred.",
|
|
38
|
+
title: "Viewed At",
|
|
39
|
+
}),
|
|
40
|
+
viewDate: zod_openapi_1.z.string().date().openapi({
|
|
41
|
+
description: "Calendar date corresponding to the view event, used for aggregation.",
|
|
42
|
+
title: "View Date",
|
|
43
|
+
}),
|
|
44
|
+
})
|
|
45
|
+
.openapi({
|
|
46
|
+
description: "Represents a record of a single view event for an entity.",
|
|
47
|
+
title: "View",
|
|
48
|
+
});
|
package/dist/types/project.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { z } from "@hono/zod-openapi";
|
|
2
|
-
import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema,
|
|
2
|
+
import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema, ProjectWithFilesEntitySchema, ProjectWithProjectViewsEntitySchema, ProjectWithProjectCommentsEntitySchema, ProjectWithProjectLikesEntitySchema, ProjectWithProjectBookmarksEntitySchema, CreateProjectInputSchema, CreateProjectOutputSchema, UpdateProjectInputSchema, UpdateProjectOutputSchema, DeleteProjectOutputSchema, GetProjectOutputSchema, ListProjectsInputSchema, ViewProjectInputSchema, CommentOnProjectInputSchema, CommentOnProjectOutputSchema, DeleteProjectCommentOutputSchema, BookmarkProjectOutputSchema } from "../schemas/project";
|
|
3
|
+
import { ViewEntitySchema } from "../schemas/view";
|
|
4
|
+
import { LikeEntitySchema } from "../schemas/like";
|
|
5
|
+
import { CommentEntitySchema } from "../schemas/comment";
|
|
3
6
|
export type ProjectEntity = z.infer<typeof ProjectEntitySchema>;
|
|
4
7
|
export type ProjectIdInput = z.infer<typeof ProjectIdSchema>;
|
|
5
8
|
export type MinimalProject = z.infer<typeof MinimalProjectSchema>;
|
|
6
9
|
export type ProjectFileEntity = z.infer<typeof ProjectFileEntitySchema>;
|
|
7
|
-
export type ProjectViewEntity = z.infer<typeof
|
|
8
|
-
export type ProjectLikeEntity = z.infer<typeof
|
|
9
|
-
export type ProjectCommentEntity = z.infer<typeof
|
|
10
|
-
export type ProjectBookmarkEntity = z.infer<typeof ProjectBookmarkEntitySchema>;
|
|
10
|
+
export type ProjectViewEntity = z.infer<typeof ViewEntitySchema>;
|
|
11
|
+
export type ProjectLikeEntity = z.infer<typeof LikeEntitySchema>;
|
|
12
|
+
export type ProjectCommentEntity = z.infer<typeof CommentEntitySchema>;
|
|
11
13
|
export type ProjectWithFilesEntity = z.infer<typeof ProjectWithFilesEntitySchema>;
|
|
12
14
|
export type ProjectWithProjectViewsEntity = z.infer<typeof ProjectWithProjectViewsEntitySchema>;
|
|
13
15
|
export type ProjectWithProjectCommentsEntity = z.infer<typeof ProjectWithProjectCommentsEntitySchema>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const BookmarkEntitySchema = z
|
|
4
|
+
.object({
|
|
5
|
+
id: z.cuid2().openapi({
|
|
6
|
+
description: "Unique identifier for the bookmark.",
|
|
7
|
+
title: "Bookmark ID",
|
|
8
|
+
}),
|
|
9
|
+
createdAt: z.string().datetime().openapi({
|
|
10
|
+
description: "Timestamp when the bookmark was created.",
|
|
11
|
+
title: "Created At",
|
|
12
|
+
}),
|
|
13
|
+
userId: z.cuid2().openapi({
|
|
14
|
+
description: "Identifier of the user who created the bookmark.",
|
|
15
|
+
title: "User ID",
|
|
16
|
+
}),
|
|
17
|
+
parentId: z.cuid2().openapi({
|
|
18
|
+
description: "Identifier of the parent entity that was bookmarked.",
|
|
19
|
+
title: "Parent ID",
|
|
20
|
+
}),
|
|
21
|
+
parentType: z.string().openapi({
|
|
22
|
+
description: "Type of the parent entity (e.g., project, post, etc.).",
|
|
23
|
+
title: "Parent Type",
|
|
24
|
+
}),
|
|
25
|
+
})
|
|
26
|
+
.openapi({
|
|
27
|
+
title: "Bookmark",
|
|
28
|
+
description: "Represents a user bookmark on a specific parent entity.",
|
|
29
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
+
|
|
4
|
+
export const CommentEntitySchema = z.object({
|
|
5
|
+
id: z.cuid2().openapi({
|
|
6
|
+
description: "The unique CUID2 identifier for the comment.",
|
|
7
|
+
example: "tr4q2k7k0000c7625z2k8ggy",
|
|
8
|
+
}),
|
|
9
|
+
userId: z.cuid2().openapi({
|
|
10
|
+
description: "The CUID2 of the user who created the comment.",
|
|
11
|
+
example: "clq9p8f2z0000c762s7k4g1b",
|
|
12
|
+
}),
|
|
13
|
+
parentId: z.cuid2().openapi({
|
|
14
|
+
description: "The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
|
|
15
|
+
example: "clq9p8f2z0000c762s7k4g1b",
|
|
16
|
+
}),
|
|
17
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
18
|
+
description: "The type of the parent entity this comment is attached to.",
|
|
19
|
+
example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
|
|
20
|
+
}),
|
|
21
|
+
content: z.string().openapi({
|
|
22
|
+
description: "The text content of the comment. May contain Markdown.",
|
|
23
|
+
example: "This is a great point! I hadn't considered that perspective.",
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
replyToId: z.cuid2().optional().nullable().openapi({
|
|
27
|
+
description: "The ID of the parent comment if this is a reply. Null for top-level comments.",
|
|
28
|
+
example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
|
|
29
|
+
}),
|
|
30
|
+
createdAt: z.coerce.date().optional().openapi({
|
|
31
|
+
description: "The date and time the comment was created.",
|
|
32
|
+
example: "2023-10-27T10:00:00.000Z",
|
|
33
|
+
format: "date-time",
|
|
34
|
+
}),
|
|
35
|
+
updatedAt: z.coerce.date().optional().openapi({
|
|
36
|
+
description: "The date and time the comment was last updated.",
|
|
37
|
+
example: "2023-10-27T10:05:00.000Z",
|
|
38
|
+
format: "date-time",
|
|
39
|
+
})
|
|
40
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
+
|
|
4
|
+
export const EntityStatsSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
updatedAt: z.coerce.date().optional().openapi({
|
|
7
|
+
description: "Timestamp of the last update to the entity statistics.",
|
|
8
|
+
title: "Updated At",
|
|
9
|
+
}),
|
|
10
|
+
createdAt: z.coerce.date().optional().openapi({
|
|
11
|
+
description: "Timestamp of the creationn to the entity statistics.",
|
|
12
|
+
title: "Updated At",
|
|
13
|
+
}),
|
|
14
|
+
parentId: z.cuid2().openapi({
|
|
15
|
+
description:
|
|
16
|
+
"Unique identifier of the parent entity (e.g., project, post, etc.).",
|
|
17
|
+
title: "Parent ID",
|
|
18
|
+
}),
|
|
19
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
20
|
+
description: "Type of the parent entity this statistic belongs to.",
|
|
21
|
+
title: "Parent Type",
|
|
22
|
+
}),
|
|
23
|
+
likesCount: z.number().openapi({
|
|
24
|
+
description: "Total number of likes associated with the entity.",
|
|
25
|
+
title: "Likes Count",
|
|
26
|
+
}),
|
|
27
|
+
bookmarksCount: z.number().openapi({
|
|
28
|
+
description: "Total number of bookmarks associated with the entity.",
|
|
29
|
+
title: "Bookmarks Count",
|
|
30
|
+
}),
|
|
31
|
+
viewsCount: z.number().openapi({
|
|
32
|
+
description: "Total number of views recorded for the entity.",
|
|
33
|
+
title: "Views Count",
|
|
34
|
+
}),
|
|
35
|
+
commentsCount: z.number().openapi({
|
|
36
|
+
description: "Total number of comments linked to the entity.",
|
|
37
|
+
title: "Comments Count",
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
40
|
+
.openapi({
|
|
41
|
+
description: "Represents engagement statistics for a specific entity.",
|
|
42
|
+
title: "EntityStats",
|
|
43
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const LikeEntitySchema = z
|
|
4
|
+
.object({
|
|
5
|
+
createdAt: z.coerce.date().optional().openapi({
|
|
6
|
+
description: "Timestamp when the like was created.",
|
|
7
|
+
title: "Created At",
|
|
8
|
+
}),
|
|
9
|
+
userId: z.cuid2().openapi({
|
|
10
|
+
description: "Identifier of the user who performed the like.",
|
|
11
|
+
title: "User ID",
|
|
12
|
+
}),
|
|
13
|
+
parentId: z.cuid2().openapi({
|
|
14
|
+
description: "Identifier of the parent entity that was liked.",
|
|
15
|
+
title: "Parent ID",
|
|
16
|
+
}),
|
|
17
|
+
parentType: z.string().openapi({
|
|
18
|
+
description: "Type of the parent entity (e.g., project, post, etc.).",
|
|
19
|
+
title: "Parent Type",
|
|
20
|
+
}),
|
|
21
|
+
})
|
|
22
|
+
.openapi({
|
|
23
|
+
description: "Represents a single like event on a parent entity.",
|
|
24
|
+
title: "Like",
|
|
25
|
+
});
|
package/src/schemas/project.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { CLIENT_TYPES, ROLES } from "../constants";
|
|
3
3
|
import { CreateFileInputSchema, FileEntitySchema } from "./file";
|
|
4
|
+
import { CommentEntitySchema } from "./comment";
|
|
5
|
+
import { BookmarkEntitySchema } from "./bookmark";
|
|
6
|
+
import { ViewEntitySchema } from "./view";
|
|
7
|
+
import { LikeEntitySchema } from "./like";
|
|
4
8
|
|
|
5
9
|
/* ------------------------------ Core Entities ------------------------------ */
|
|
6
10
|
export const ProjectEntitySchema = z
|
|
@@ -137,54 +141,10 @@ export const ProjectWithFilesEntitySchema = ProjectEntitySchema.extend({
|
|
|
137
141
|
.openapi({ description: "Files associated with the project." }),
|
|
138
142
|
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
139
143
|
|
|
140
|
-
export const ProjectViewEntitySchema = z
|
|
141
|
-
.object({
|
|
142
|
-
id: z.cuid2(),
|
|
143
|
-
projectId: z.cuid2(),
|
|
144
|
-
userId: z.cuid2().optional(),
|
|
145
|
-
ipAddress: z.ipv4().optional(),
|
|
146
|
-
userAgent: z.string().optional(),
|
|
147
|
-
sessionId: z.string().optional(),
|
|
148
|
-
viewedAt: z.coerce.date(),
|
|
149
|
-
viewDate: z.coerce.date(),
|
|
150
|
-
})
|
|
151
|
-
.openapi("ProjectViewEntity");
|
|
152
|
-
|
|
153
|
-
export const ProjectLikeEntitySchema = z
|
|
154
|
-
.object({
|
|
155
|
-
projectId: z.cuid2(),
|
|
156
|
-
userId: z.cuid2(),
|
|
157
|
-
createdAt: z.coerce.date().optional(),
|
|
158
|
-
})
|
|
159
|
-
.openapi("ProjectLikeEntity");
|
|
160
|
-
|
|
161
|
-
export const ProjectCommentEntitySchema = z
|
|
162
|
-
.object({
|
|
163
|
-
id: z.cuid2(),
|
|
164
|
-
projectId: z.cuid2(),
|
|
165
|
-
userId: z.cuid2(),
|
|
166
|
-
commenterName: z.string(),
|
|
167
|
-
commenterUsername:z.string(),
|
|
168
|
-
commenterImageUrl: z.string().optional(),
|
|
169
|
-
parentCommentId: z.cuid2().optional(),
|
|
170
|
-
content: z.string().min(1),
|
|
171
|
-
createdAt: z.coerce.date().optional(),
|
|
172
|
-
})
|
|
173
|
-
.openapi("ProjectCommentEntity");
|
|
174
|
-
|
|
175
|
-
export const ProjectBookmarkEntitySchema = z
|
|
176
|
-
.object({
|
|
177
|
-
projectId: z.cuid2(),
|
|
178
|
-
userId: z.cuid2(),
|
|
179
|
-
createdAt: z.coerce.date().optional(),
|
|
180
|
-
})
|
|
181
|
-
.openapi("ProjectBookmarkEntity");
|
|
182
|
-
|
|
183
144
|
export const ProjectUpdateOutputEntitySchema = z
|
|
184
145
|
.object({ id: z.cuid2() })
|
|
185
146
|
.openapi("ProjectUpdateOutputEntity");
|
|
186
147
|
|
|
187
|
-
|
|
188
148
|
export const CreateProjectInputSchema = z
|
|
189
149
|
.object({
|
|
190
150
|
title: z.string().min(1).max(100),
|
|
@@ -279,12 +239,11 @@ export const DeleteProjectCommentInputSchema = z.object({
|
|
|
279
239
|
|
|
280
240
|
export const CreateProjectOutputSchema = ProjectEntitySchema;
|
|
281
241
|
export const UpdateProjectOutputSchema = ProjectEntitySchema;
|
|
282
|
-
export const CommentOnProjectOutputSchema =
|
|
283
|
-
export const DeleteProjectCommentOutputSchema =
|
|
242
|
+
export const CommentOnProjectOutputSchema = CommentEntitySchema;
|
|
243
|
+
export const DeleteProjectCommentOutputSchema = CommentEntitySchema;
|
|
284
244
|
export const DeleteProjectOutputSchema = ProjectEntitySchema;
|
|
285
245
|
export const GetProjectOutputSchema = ProjectWithFilesEntitySchema;
|
|
286
|
-
export const BookmarkProjectOutputSchema =
|
|
287
|
-
|
|
246
|
+
export const BookmarkProjectOutputSchema = BookmarkEntitySchema;
|
|
288
247
|
|
|
289
248
|
export const ProjectIdSchema = z.object({ projectId: z.cuid2() });
|
|
290
249
|
export const CommentOnProjectParamsSchema = ProjectIdSchema;
|
|
@@ -315,27 +274,27 @@ export const ListProjectsInputSchema = z
|
|
|
315
274
|
});
|
|
316
275
|
|
|
317
276
|
export const ProjectWithProjectViewsEntitySchema = MinimalProjectSchema.extend({
|
|
318
|
-
views: z.array(
|
|
277
|
+
views: z.array(ViewEntitySchema),
|
|
319
278
|
}).openapi({
|
|
320
279
|
title: "ProjectWithProjectViewsEntity",
|
|
321
280
|
});
|
|
322
281
|
|
|
323
282
|
export const ProjectWithProjectCommentsEntitySchema =
|
|
324
283
|
MinimalProjectSchema.extend({
|
|
325
|
-
comments: z.array(
|
|
284
|
+
comments: z.array(CommentEntitySchema),
|
|
326
285
|
}).openapi({
|
|
327
286
|
title: "ProjectWithProjectCommentsEntity",
|
|
328
287
|
});
|
|
329
288
|
|
|
330
289
|
export const ProjectWithProjectLikesEntitySchema = MinimalProjectSchema.extend({
|
|
331
|
-
likes: z.array(
|
|
290
|
+
likes: z.array(LikeEntitySchema),
|
|
332
291
|
}).openapi({
|
|
333
292
|
title: "ProjectWithProjectLikesEntity",
|
|
334
293
|
});
|
|
335
294
|
|
|
336
295
|
export const ProjectWithProjectBookmarksEntitySchema =
|
|
337
296
|
MinimalProjectSchema.extend({
|
|
338
|
-
bookmarks: z.array(
|
|
297
|
+
bookmarks: z.array(BookmarkEntitySchema),
|
|
339
298
|
}).openapi({
|
|
340
299
|
title: "ProjectWithProjectBookmarksEntity",
|
|
341
300
|
});
|
package/src/schemas/user.ts
CHANGED
|
@@ -3,10 +3,11 @@ import { z } from "@hono/zod-openapi";
|
|
|
3
3
|
import { ROLES, USER_STATUSES, ONBOARDING_PAGES } from "../constants";
|
|
4
4
|
import type { Role, UserStatus, OnboardingPage } from "../constants";
|
|
5
5
|
import {
|
|
6
|
-
ProjectBookmarkEntitySchema,
|
|
7
6
|
ProjectEntitySchema,
|
|
8
|
-
|
|
7
|
+
|
|
9
8
|
} from "./project";
|
|
9
|
+
import { BookmarkEntitySchema } from "./bookmark";
|
|
10
|
+
import { LikeEntitySchema } from "./like";
|
|
10
11
|
|
|
11
12
|
export const UserSocialGraphEntitySchema = z
|
|
12
13
|
.object({
|
|
@@ -94,7 +95,7 @@ export const UserWithProjectsEntitySchema = z
|
|
|
94
95
|
export const UserWithProjectLikesEntitySchema = z.object({
|
|
95
96
|
userId: z.cuid2(),
|
|
96
97
|
projectLikes: z.array(
|
|
97
|
-
|
|
98
|
+
LikeEntitySchema.extend({
|
|
98
99
|
project: ProjectEntitySchema.pick({
|
|
99
100
|
id: true,
|
|
100
101
|
title: true,
|
|
@@ -112,7 +113,7 @@ export const UserWithProjectBookmarksEntitySchema = z
|
|
|
112
113
|
.object({
|
|
113
114
|
userId: z.cuid2(),
|
|
114
115
|
projectBookmarks: z.array(
|
|
115
|
-
|
|
116
|
+
BookmarkEntitySchema.extend({
|
|
116
117
|
project: ProjectEntitySchema.pick({
|
|
117
118
|
id: true,
|
|
118
119
|
title: true,
|
|
@@ -0,0 +1,50 @@
|
|
|
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.string().datetime().openapi({
|
|
38
|
+
description: "Exact timestamp when the view occurred.",
|
|
39
|
+
title: "Viewed At",
|
|
40
|
+
}),
|
|
41
|
+
viewDate: z.string().date().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
|
+
});
|
package/src/types/project.ts
CHANGED
|
@@ -4,10 +4,6 @@ import type {
|
|
|
4
4
|
ProjectIdSchema,
|
|
5
5
|
MinimalProjectSchema,
|
|
6
6
|
ProjectFileEntitySchema,
|
|
7
|
-
ProjectViewEntitySchema,
|
|
8
|
-
ProjectLikeEntitySchema,
|
|
9
|
-
ProjectCommentEntitySchema,
|
|
10
|
-
ProjectBookmarkEntitySchema,
|
|
11
7
|
ProjectWithFilesEntitySchema,
|
|
12
8
|
ProjectWithProjectViewsEntitySchema,
|
|
13
9
|
ProjectWithProjectCommentsEntitySchema,
|
|
@@ -26,16 +22,18 @@ import type {
|
|
|
26
22
|
DeleteProjectCommentOutputSchema,
|
|
27
23
|
BookmarkProjectOutputSchema,
|
|
28
24
|
} from "../schemas/project";
|
|
25
|
+
import { ViewEntitySchema } from "../schemas/view";
|
|
26
|
+
import { LikeEntitySchema } from "../schemas/like";
|
|
27
|
+
import { CommentEntitySchema } from "../schemas/comment";
|
|
29
28
|
|
|
30
29
|
export type ProjectEntity = z.infer<typeof ProjectEntitySchema>;
|
|
31
30
|
export type ProjectIdInput = z.infer<typeof ProjectIdSchema>;
|
|
32
31
|
export type MinimalProject = z.infer<typeof MinimalProjectSchema>;
|
|
33
32
|
|
|
34
33
|
export type ProjectFileEntity = z.infer<typeof ProjectFileEntitySchema>;
|
|
35
|
-
export type ProjectViewEntity = z.infer<typeof
|
|
36
|
-
export type ProjectLikeEntity = z.infer<typeof
|
|
37
|
-
export type ProjectCommentEntity = z.infer<typeof
|
|
38
|
-
export type ProjectBookmarkEntity = z.infer<typeof ProjectBookmarkEntitySchema>;
|
|
34
|
+
export type ProjectViewEntity = z.infer<typeof ViewEntitySchema>;
|
|
35
|
+
export type ProjectLikeEntity = z.infer<typeof LikeEntitySchema>;
|
|
36
|
+
export type ProjectCommentEntity = z.infer<typeof CommentEntitySchema>;
|
|
39
37
|
|
|
40
38
|
export type ProjectWithFilesEntity = z.infer<
|
|
41
39
|
typeof ProjectWithFilesEntitySchema
|