@zyacreatives/shared 2.5.54 → 2.5.55
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/schemas/activity.d.ts +1 -0
- package/dist/schemas/auth.d.ts +2 -0
- package/dist/schemas/bookmark.d.ts +62 -7
- package/dist/schemas/bookmark.js +32 -30
- package/dist/schemas/brand.d.ts +3 -3
- package/dist/schemas/chat.d.ts +96 -52
- package/dist/schemas/chat.js +44 -18
- package/dist/schemas/comment.d.ts +65 -21
- package/dist/schemas/comment.js +48 -54
- package/dist/schemas/common.d.ts +15 -11
- package/dist/schemas/creative.d.ts +3 -3
- package/dist/schemas/discipline.d.ts +63 -12
- package/dist/schemas/discipline.js +62 -65
- package/dist/schemas/entity-stats.d.ts +35 -3
- package/dist/schemas/entity-stats.js +24 -38
- package/dist/schemas/feed.d.ts +50 -3
- package/dist/schemas/feed.js +43 -13
- package/dist/schemas/file.d.ts +65 -24
- package/dist/schemas/file.js +60 -49
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/investor-shortlist.d.ts +68 -11
- package/dist/schemas/investor-shortlist.js +46 -24
- package/dist/schemas/investor-signal.d.ts +52 -12
- package/dist/schemas/investor-signal.js +59 -39
- package/dist/schemas/investor.d.ts +3 -3
- package/dist/schemas/job-application.d.ts +291 -279
- package/dist/schemas/job-application.js +59 -95
- package/dist/schemas/job.d.ts +200 -659
- package/dist/schemas/job.js +98 -231
- package/dist/schemas/like.d.ts +3 -0
- package/dist/schemas/message.d.ts +125 -94
- package/dist/schemas/message.js +54 -55
- package/dist/schemas/notification.d.ts +99 -32
- package/dist/schemas/notification.js +46 -42
- package/dist/schemas/payout-method.d.ts +51 -31
- package/dist/schemas/payout-method.js +48 -58
- package/dist/schemas/post.d.ts +295 -204
- package/dist/schemas/post.js +148 -272
- package/dist/schemas/product.d.ts +308 -229
- package/dist/schemas/product.js +111 -94
- package/dist/schemas/project.d.ts +75 -107
- package/dist/schemas/project.js +1 -5
- package/dist/schemas/seller.d.ts +10 -10
- package/dist/schemas/user-strike.d.ts +3 -0
- package/dist/schemas/user.d.ts +114 -123
- package/dist/schemas/username.d.ts +1 -0
- package/dist/schemas/view.d.ts +1 -0
- package/dist/types/activity.d.ts +1 -3
- package/dist/types/auth.d.ts +1 -4
- package/dist/types/bookmark.d.ts +1 -3
- package/dist/types/chat.d.ts +1 -11
- package/dist/types/comment.d.ts +1 -5
- package/dist/types/common.d.ts +2 -8
- package/dist/types/discipline.d.ts +1 -11
- package/dist/types/entity-stats.d.ts +1 -3
- package/dist/types/feed.d.ts +1 -5
- package/dist/types/investor-shortlist.d.ts +1 -6
- package/dist/types/investor-signal.d.ts +1 -7
- package/dist/types/like.d.ts +1 -3
- package/dist/types/message.d.ts +1 -9
- package/dist/types/notification.d.ts +1 -9
- package/dist/types/user-strike.d.ts +1 -5
- package/dist/types/username.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +4 -5
- package/src/schemas/activity.ts +5 -4
- package/src/schemas/auth.ts +14 -10
- package/src/schemas/bookmark.ts +48 -29
- package/src/schemas/chat.ts +79 -18
- package/src/schemas/comment.ts +63 -49
- package/src/schemas/common.ts +8 -3
- package/src/schemas/discipline.ts +103 -71
- package/src/schemas/entity-stats.ts +32 -38
- package/src/schemas/feed.ts +62 -15
- package/src/schemas/file.ts +85 -58
- package/src/schemas/index.ts +1 -0
- package/src/schemas/investor-shortlist.ts +57 -8
- package/src/schemas/investor-signal.ts +79 -27
- package/src/schemas/job-application.ts +81 -115
- package/src/schemas/job.ts +160 -301
- package/src/schemas/like.ts +5 -1
- package/src/schemas/message.ts +71 -64
- package/src/schemas/notification.ts +63 -51
- package/src/schemas/payout-method.ts +47 -63
- package/src/schemas/post.ts +211 -272
- package/src/schemas/product.ts +202 -139
- package/src/schemas/project.ts +7 -10
- package/src/schemas/user-strike.ts +7 -1
- package/src/schemas/user.ts +2 -6
- package/src/schemas/username.ts +5 -3
- package/src/schemas/view.ts +0 -50
- package/src/types/activity.ts +0 -4
- package/src/types/auth.ts +0 -5
- package/src/types/bookmark.ts +0 -4
- package/src/types/chat.ts +0 -31
- package/src/types/comment.ts +0 -12
- package/src/types/common.ts +0 -14
- package/src/types/discipline.ts +0 -32
- package/src/types/entity-stats.ts +0 -4
- package/src/types/feed.ts +0 -10
- package/src/types/index.ts +0 -16
- package/src/types/investor-shortlist.ts +0 -18
- package/src/types/investor-signal.ts +0 -26
- package/src/types/like.ts +0 -4
- package/src/types/message.ts +0 -26
- package/src/types/notification.ts +0 -34
- package/src/types/user-strike.ts +0 -10
- package/src/types/username.ts +0 -4
package/src/schemas/auth.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
|
|
3
|
-
export const RegisterSchema = z.object({
|
|
3
|
+
export const RegisterSchema = z.object({
|
|
4
4
|
firstName: z.string().max(255, { message: "First name is too long" }),
|
|
5
5
|
lastName: z.string().max(255, { message: "Last name is too long" }),
|
|
6
6
|
email: z
|
|
@@ -13,13 +13,15 @@ export const RegisterSchema = z.object({
|
|
|
13
13
|
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
14
14
|
error: "Username can only contain letters, numbers, and underscores",
|
|
15
15
|
}),
|
|
16
|
-
password: z
|
|
17
|
-
.string()
|
|
18
|
-
.min(8, { message: "Password must be at least 8 characters" })
|
|
19
|
-
.max(100, { message: "Password must be at most 100 characters" }),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export
|
|
16
|
+
password: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
19
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type RegisterInput = z.infer<typeof RegisterSchema>;
|
|
23
|
+
|
|
24
|
+
export const LoginSchema = z.object({
|
|
23
25
|
identifier: z
|
|
24
26
|
.string()
|
|
25
27
|
.trim()
|
|
@@ -39,5 +41,7 @@ export const LoginSchema = z.object({
|
|
|
39
41
|
.string()
|
|
40
42
|
.min(8, { message: "Password must be at least 8 characters" })
|
|
41
43
|
.max(100, { message: "Password must be at most 100 characters" }),
|
|
42
|
-
rememberMe: z.boolean(),
|
|
43
|
-
});
|
|
44
|
+
rememberMe: z.boolean(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export type LoginInput = z.infer<typeof LoginSchema>;
|
package/src/schemas/bookmark.ts
CHANGED
|
@@ -1,38 +1,57 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
2
3
|
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* --------------------------------
|
|
7
|
+
* SHAPE
|
|
8
|
+
* --------------------------------
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const BookmarkShape = z.object({
|
|
12
|
+
parentId: z.cuid2(),
|
|
13
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type BookmarkShapeType = z.infer<typeof BookmarkShape>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* --------------------------------
|
|
20
|
+
* BASE ENTITY
|
|
21
|
+
* --------------------------------
|
|
22
|
+
*/
|
|
23
|
+
|
|
4
24
|
export const BookmarkEntitySchema = z
|
|
5
25
|
.object({
|
|
6
|
-
id: z.cuid2()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
createdAt: z.coerce.date().optional().openapi({
|
|
11
|
-
description: "Timestamp when the bookmark was created.",
|
|
12
|
-
title: "Created At",
|
|
13
|
-
}),
|
|
14
|
-
userId: z.cuid2().openapi({
|
|
15
|
-
description: "Identifier of the user who created the bookmark.",
|
|
16
|
-
title: "User ID",
|
|
17
|
-
}),
|
|
18
|
-
parentId: z.cuid2().openapi({
|
|
19
|
-
description: "Identifier of the parent entity that was bookmarked.",
|
|
20
|
-
title: "Parent ID",
|
|
21
|
-
}),
|
|
22
|
-
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
23
|
-
description: "Type of the parent entity this statistic belongs to.",
|
|
24
|
-
title: "Parent Type",
|
|
25
|
-
}),
|
|
26
|
+
id: z.cuid2(),
|
|
27
|
+
userId: z.cuid2(),
|
|
28
|
+
...BookmarkShape.shape,
|
|
29
|
+
createdAt: z.iso.datetime(),
|
|
26
30
|
})
|
|
27
|
-
.openapi(
|
|
28
|
-
title: "Bookmark",
|
|
29
|
-
description: "Represents a user bookmark on a specific parent entity.",
|
|
30
|
-
});
|
|
31
|
+
.openapi("Bookmark");
|
|
31
32
|
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
export type BookmarkEntity = z.infer<typeof BookmarkEntitySchema>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* --------------------------------
|
|
37
|
+
* INPUTS
|
|
38
|
+
* --------------------------------
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export const CreateBookmarkInputSchema = BookmarkShape.extend({});
|
|
42
|
+
|
|
43
|
+
export type CreateBookmarkInput = z.infer<typeof CreateBookmarkInputSchema>;
|
|
44
|
+
|
|
45
|
+
export const DeleteBookmarkInputSchema = BookmarkShape.extend({});
|
|
46
|
+
|
|
47
|
+
export type DeleteBookmarkInput = z.infer<typeof DeleteBookmarkInputSchema>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* --------------------------------
|
|
51
|
+
* OUTPUTS
|
|
52
|
+
* --------------------------------
|
|
53
|
+
*/
|
|
37
54
|
|
|
38
55
|
export const BookmarkOutputSchema = BookmarkEntitySchema;
|
|
56
|
+
|
|
57
|
+
export type BookmarkOutput = z.infer<typeof BookmarkOutputSchema>;
|
package/src/schemas/chat.ts
CHANGED
|
@@ -1,19 +1,48 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
2
3
|
import { MESSAGE_REQUEST_STATUS } from "../constants";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* --------------------------------
|
|
7
|
+
* SHAPE
|
|
8
|
+
* --------------------------------
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const ChatShape = z.object({
|
|
6
12
|
senderId: z.cuid2(),
|
|
7
13
|
receiverId: z.cuid2(),
|
|
8
14
|
isMessageRequest: z.boolean().default(true),
|
|
9
15
|
messageRequestStatus: z.enum(MESSAGE_REQUEST_STATUS).default("PENDING"),
|
|
10
|
-
acceptedAt: z.coerce.date().nullable(),
|
|
11
|
-
declinedAt: z.coerce.date().nullable(),
|
|
12
|
-
createdAt: z.coerce.date(),
|
|
13
|
-
updatedAt: z.coerce.date().nullable(),
|
|
14
|
-
deletedAt: z.coerce.date().nullable(),
|
|
15
16
|
});
|
|
16
17
|
|
|
18
|
+
export type ChatShapeType = z.infer<typeof ChatShape>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* --------------------------------
|
|
22
|
+
* BASE ENTITY
|
|
23
|
+
* --------------------------------
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const BaseChatEntitySchema = z
|
|
27
|
+
.object({
|
|
28
|
+
id: z.cuid2(),
|
|
29
|
+
...ChatShape.shape,
|
|
30
|
+
acceptedAt: z.iso.datetime().nullable(),
|
|
31
|
+
declinedAt: z.iso.datetime().nullable(),
|
|
32
|
+
createdAt: z.iso.datetime(),
|
|
33
|
+
updatedAt: z.iso.datetime().nullable(),
|
|
34
|
+
deletedAt: z.iso.datetime().nullable(),
|
|
35
|
+
})
|
|
36
|
+
.openapi("BaseChat");
|
|
37
|
+
|
|
38
|
+
export type BaseChatEntity = z.infer<typeof BaseChatEntitySchema>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* --------------------------------
|
|
42
|
+
* DERIVED ENTITIES
|
|
43
|
+
* --------------------------------
|
|
44
|
+
*/
|
|
45
|
+
|
|
17
46
|
export const ChatEntitySchema = BaseChatEntitySchema.extend({
|
|
18
47
|
senderName: z.string(),
|
|
19
48
|
senderUsername: z.string(),
|
|
@@ -24,35 +53,67 @@ export const ChatEntitySchema = BaseChatEntitySchema.extend({
|
|
|
24
53
|
receiverImgUrl: z.string().nullable(),
|
|
25
54
|
|
|
26
55
|
lastMessageSent: z.string().nullable(),
|
|
27
|
-
lastMessageAt: z.
|
|
56
|
+
lastMessageAt: z.iso.datetime().nullable(),
|
|
28
57
|
isUnread: z.boolean().default(false),
|
|
29
58
|
isOnline: z.boolean().default(false),
|
|
30
|
-
});
|
|
59
|
+
}).openapi("Chat");
|
|
60
|
+
|
|
61
|
+
export type ChatEntity = z.infer<typeof ChatEntitySchema>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* --------------------------------
|
|
65
|
+
* INPUTS
|
|
66
|
+
* --------------------------------
|
|
67
|
+
*/
|
|
31
68
|
|
|
32
69
|
export const CreateChatInputSchema = z.object({
|
|
33
|
-
senderId: z.cuid2(),
|
|
34
70
|
receiverId: z.cuid2(),
|
|
35
71
|
});
|
|
36
72
|
|
|
37
|
-
export
|
|
73
|
+
export type CreateChatInput = z.infer<typeof CreateChatInputSchema>;
|
|
38
74
|
|
|
39
|
-
export const
|
|
75
|
+
export const ChatIdInputSchema = z.object({
|
|
40
76
|
chatId: z.cuid2(),
|
|
41
77
|
});
|
|
42
78
|
|
|
79
|
+
export type ChatIdInput = z.infer<typeof ChatIdInputSchema>;
|
|
80
|
+
|
|
81
|
+
export const AcceptMessageRequestInputSchema = ChatIdInputSchema.extend({});
|
|
82
|
+
|
|
83
|
+
export type AcceptMessageRequestInput = z.infer<
|
|
84
|
+
typeof AcceptMessageRequestInputSchema
|
|
85
|
+
>;
|
|
86
|
+
|
|
87
|
+
export const DeclineMessageRequestInputSchema = ChatIdInputSchema.extend({});
|
|
88
|
+
|
|
89
|
+
export type DeclineMessageRequestInput = z.infer<
|
|
90
|
+
typeof DeclineMessageRequestInputSchema
|
|
91
|
+
>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* --------------------------------
|
|
95
|
+
* OUTPUTS
|
|
96
|
+
* --------------------------------
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
export const CreateChatOutputSchema = BaseChatEntitySchema;
|
|
100
|
+
|
|
101
|
+
export type CreateChatOutput = z.infer<typeof CreateChatOutputSchema>;
|
|
102
|
+
|
|
43
103
|
export const GetChatsOutputSchema = z.array(ChatEntitySchema);
|
|
44
104
|
|
|
105
|
+
export type GetChatsOutput = z.infer<typeof GetChatsOutputSchema>;
|
|
106
|
+
|
|
45
107
|
export const GetChatsForUserOutputSchema = z.object({
|
|
46
108
|
chats: z.array(ChatEntitySchema),
|
|
47
109
|
nextCursor: z.string().nullable(),
|
|
48
110
|
});
|
|
49
111
|
|
|
112
|
+
export type GetChatsForUserOutput = z.infer<typeof GetChatsForUserOutputSchema>;
|
|
113
|
+
|
|
50
114
|
export const GetMessageRequestsForUserOutputSchema =
|
|
51
115
|
GetChatsForUserOutputSchema;
|
|
52
116
|
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const DeclineMessageRequestInputSchema = AcceptMessageRequestInputSchema;
|
|
117
|
+
export type GetMessageRequestsForUserOutput = z.infer<
|
|
118
|
+
typeof GetMessageRequestsForUserOutputSchema
|
|
119
|
+
>;
|
package/src/schemas/comment.ts
CHANGED
|
@@ -1,62 +1,76 @@
|
|
|
1
|
-
import z from "zod";
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
2
3
|
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description:
|
|
15
|
-
"The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
|
|
16
|
-
example: "clq9p8f2z0000c762s7k4g1b",
|
|
17
|
-
}),
|
|
5
|
+
/**
|
|
6
|
+
* --------------------------------
|
|
7
|
+
* SHAPE
|
|
8
|
+
* --------------------------------
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const CommentShape = z.object({
|
|
12
|
+
parentId: z.cuid2(),
|
|
13
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
14
|
+
content: z.string(),
|
|
18
15
|
parentCommentId: z.cuid2().optional(),
|
|
19
|
-
|
|
20
|
-
description: "The type of the parent entity this comment is attached to.",
|
|
21
|
-
example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
|
|
22
|
-
}),
|
|
23
|
-
content: z.string().openapi({
|
|
24
|
-
description: "The text content of the comment. May contain Markdown.",
|
|
25
|
-
example: "This is a great point! I hadn't considered that perspective.",
|
|
26
|
-
}),
|
|
27
|
-
commenterUsername: z.string().optional(),
|
|
28
|
-
commenterName: z.string().optional(),
|
|
29
|
-
commenterImageUrl: z.string().optional(),
|
|
30
|
-
replyToId: z.cuid2().optional().nullable().openapi({
|
|
31
|
-
description:
|
|
32
|
-
"The ID of the parent comment if this is a reply. Null for top-level comments.",
|
|
33
|
-
example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
|
|
34
|
-
}),
|
|
35
|
-
createdAt: z.coerce.date().optional().openapi({
|
|
36
|
-
description: "The date and time the comment was created.",
|
|
37
|
-
example: "2023-10-27T10:00:00.000Z",
|
|
38
|
-
format: "date-time",
|
|
39
|
-
}),
|
|
40
|
-
isLiked: z.boolean().default(false),
|
|
41
|
-
likesCount: z.int().default(0),
|
|
42
|
-
hasReplies: z.boolean().optional(),
|
|
43
|
-
updatedAt: z.coerce.date().optional().openapi({
|
|
44
|
-
description: "The date and time the comment was last updated.",
|
|
45
|
-
example: "2023-10-27T10:05:00.000Z",
|
|
46
|
-
format: "date-time",
|
|
47
|
-
}),
|
|
16
|
+
replyToId: z.cuid2().optional().nullable(),
|
|
48
17
|
});
|
|
49
18
|
|
|
50
|
-
export
|
|
19
|
+
export type CommentShapeType = z.infer<typeof CommentShape>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* --------------------------------
|
|
23
|
+
* BASE ENTITY
|
|
24
|
+
* --------------------------------
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export const CommentEntitySchema = z
|
|
51
28
|
.object({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
id: z.cuid2(),
|
|
30
|
+
userId: z.cuid2(),
|
|
31
|
+
...CommentShape.shape,
|
|
32
|
+
|
|
33
|
+
commenterUsername: z.string().optional(),
|
|
34
|
+
commenterName: z.string().optional(),
|
|
35
|
+
commenterImageUrl: z.string().optional(),
|
|
36
|
+
|
|
37
|
+
isLiked: z.boolean().default(false),
|
|
38
|
+
likesCount: z.int().default(0),
|
|
39
|
+
hasReplies: z.boolean().optional(),
|
|
40
|
+
|
|
41
|
+
createdAt: z.iso.datetime(),
|
|
42
|
+
updatedAt: z.iso.datetime().optional(),
|
|
55
43
|
})
|
|
56
|
-
.openapi(
|
|
44
|
+
.openapi("Comment");
|
|
45
|
+
|
|
46
|
+
export type CommentEntity = z.infer<typeof CommentEntitySchema>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* --------------------------------
|
|
50
|
+
* INPUTS
|
|
51
|
+
* --------------------------------
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export const CreateCommentInputSchema = z.object({
|
|
55
|
+
content: z.string(),
|
|
56
|
+
parentCommentId: z.cuid2().optional(),
|
|
57
|
+
replyToId: z.cuid2().optional().nullable(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export type CreateCommentInput = z.infer<typeof CreateCommentInputSchema>;
|
|
57
61
|
|
|
58
62
|
export const DeleteCommentInputSchema = z.object({
|
|
59
63
|
commentId: z.cuid2(),
|
|
60
64
|
});
|
|
61
65
|
|
|
66
|
+
export type DeleteCommentInput = z.infer<typeof DeleteCommentInputSchema>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* --------------------------------
|
|
70
|
+
* OUTPUTS
|
|
71
|
+
* --------------------------------
|
|
72
|
+
*/
|
|
73
|
+
|
|
62
74
|
export const CommentOutputSchema = CommentEntitySchema;
|
|
75
|
+
|
|
76
|
+
export type CommentOutput = z.infer<typeof CommentOutputSchema>;
|
package/src/schemas/common.ts
CHANGED
|
@@ -74,12 +74,17 @@ export const WorkExperienceSchema = z.object({
|
|
|
74
74
|
description: z.string().default(""),
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
export const WebsiteUrlInputSchema = z
|
|
77
|
+
export const WebsiteUrlInputSchema = z
|
|
78
78
|
.string()
|
|
79
79
|
.transform((val) => {
|
|
80
80
|
if (!val) return val;
|
|
81
81
|
if (val.startsWith("http://") || val.startsWith("https://")) return val;
|
|
82
82
|
return `https://${val}`;
|
|
83
83
|
})
|
|
84
|
-
.pipe(z.url("Invalid URL").or(z.literal("")))
|
|
85
|
-
.optional();
|
|
84
|
+
.pipe(z.url("Invalid URL").or(z.literal("")))
|
|
85
|
+
.optional();
|
|
86
|
+
|
|
87
|
+
export type Cursor = {
|
|
88
|
+
id: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
};
|
|
@@ -1,88 +1,120 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* --------------------------------
|
|
5
|
+
* SHAPE
|
|
6
|
+
* --------------------------------
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const DisciplineShape = z.object({
|
|
10
|
+
slug: z.string(),
|
|
11
|
+
name: z.string(),
|
|
6
12
|
});
|
|
7
13
|
|
|
8
|
-
export
|
|
9
|
-
|
|
14
|
+
export type DisciplineShapeType = z.infer<typeof DisciplineShape>;
|
|
15
|
+
|
|
16
|
+
const TagShape = z.object({
|
|
10
17
|
name: z.string(),
|
|
11
18
|
disciplineSlug: z.string().optional(),
|
|
12
19
|
});
|
|
13
20
|
|
|
14
|
-
export
|
|
15
|
-
tags: z
|
|
16
|
-
.array(z.string().openapi({ example: "illustration" }))
|
|
17
|
-
.optional()
|
|
18
|
-
.openapi({ example: ["illustration", "concept-art"] }),
|
|
19
|
-
}).openapi({ title: "DisciplineEntity" });
|
|
21
|
+
export type TagShapeType = z.infer<typeof TagShape>;
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* --------------------------------
|
|
25
|
+
* BASE ENTITY
|
|
26
|
+
* --------------------------------
|
|
27
|
+
*/
|
|
26
28
|
|
|
27
|
-
export const
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
z.object({
|
|
32
|
-
name: z.string().max(128).openapi({ example: "Mathematics" }),
|
|
33
|
-
tags: z
|
|
34
|
-
.array(z.string().openapi({ example: "algebra" }))
|
|
35
|
-
.default([])
|
|
36
|
-
.openapi({ example: ["algebra", "geometry"] }),
|
|
37
|
-
})
|
|
38
|
-
)
|
|
39
|
-
.openapi({
|
|
40
|
-
description: "Array of disciplines to upsert.",
|
|
41
|
-
example: [
|
|
42
|
-
{ name: "Mathematics", tags: ["algebra", "geometry"] },
|
|
43
|
-
{ name: "Physics", tags: ["mechanics", "optics"] },
|
|
44
|
-
],
|
|
45
|
-
}),
|
|
46
|
-
})
|
|
47
|
-
.openapi({ title: "CreateDisciplinesInput" });
|
|
29
|
+
export const BaseDisciplineEntitySchema =
|
|
30
|
+
DisciplineShape.openapi("BaseDiscipline");
|
|
31
|
+
|
|
32
|
+
export type BaseDisciplineEntity = z.infer<typeof BaseDisciplineEntitySchema>;
|
|
48
33
|
|
|
49
|
-
export const
|
|
34
|
+
export const TagEntitySchema = z
|
|
50
35
|
.object({
|
|
51
|
-
|
|
36
|
+
id: z.int(),
|
|
37
|
+
...TagShape.shape,
|
|
52
38
|
})
|
|
53
|
-
.openapi(
|
|
39
|
+
.openapi("Tag");
|
|
54
40
|
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
41
|
+
export type TagEntity = z.infer<typeof TagEntitySchema>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* --------------------------------
|
|
45
|
+
* DERIVED ENTITIES
|
|
46
|
+
* --------------------------------
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
export const DisciplineEntitySchema = BaseDisciplineEntitySchema.extend({
|
|
50
|
+
tags: z.array(z.string()).optional(),
|
|
51
|
+
}).openapi("Discipline");
|
|
52
|
+
|
|
53
|
+
export type DisciplineEntity = z.infer<typeof DisciplineEntitySchema>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* --------------------------------
|
|
57
|
+
* INPUTS
|
|
58
|
+
* --------------------------------
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
export const CreateDisciplinesInputSchema = z.object({
|
|
62
|
+
disciplines: z.array(
|
|
63
|
+
z.object({
|
|
64
|
+
name: z.string().max(128),
|
|
65
|
+
tags: z.array(z.string()).default([]),
|
|
74
66
|
}),
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
),
|
|
68
|
+
});
|
|
77
69
|
|
|
78
|
-
export
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
82
|
-
.openapi({ title: "GetDisciplinesOutput" });
|
|
70
|
+
export type CreateDisciplinesInput = z.infer<
|
|
71
|
+
typeof CreateDisciplinesInputSchema
|
|
72
|
+
>;
|
|
83
73
|
|
|
84
|
-
export const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
export const GetDisciplinesInputSchema = z.object({
|
|
75
|
+
withTags: z
|
|
76
|
+
.enum(["true", "false"])
|
|
77
|
+
.optional()
|
|
78
|
+
.transform((value) => value === "true"),
|
|
79
|
+
getDefault: z
|
|
80
|
+
.enum(["true", "false"])
|
|
81
|
+
.optional()
|
|
82
|
+
.transform((value) => value === "true"),
|
|
83
|
+
slugs: z.string().optional(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export type GetDisciplinesInput = z.infer<typeof GetDisciplinesInputSchema>;
|
|
87
|
+
|
|
88
|
+
export const SlugInputSchema = z.object({
|
|
89
|
+
slug: z.string().max(128),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export type SlugInput = z.infer<typeof SlugInputSchema>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* --------------------------------
|
|
96
|
+
* OUTPUTS
|
|
97
|
+
* --------------------------------
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export const DisciplineUpdateOutputSchema = z.object({
|
|
101
|
+
slug: z.string(),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export type DisciplineUpdateOutput = z.infer<
|
|
105
|
+
typeof DisciplineUpdateOutputSchema
|
|
106
|
+
>;
|
|
107
|
+
|
|
108
|
+
export const CreateDisciplinesOutputSchema = z.object({
|
|
109
|
+
disciplines: z.array(z.string()),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export type CreateDisciplinesOutput = z.infer<
|
|
113
|
+
typeof CreateDisciplinesOutputSchema
|
|
114
|
+
>;
|
|
115
|
+
|
|
116
|
+
export const GetDisciplinesOutputSchema = z.object({
|
|
117
|
+
disciplines: z.array(DisciplineEntitySchema),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export type GetDisciplinesOutput = z.infer<typeof GetDisciplinesOutputSchema>;
|
|
@@ -1,43 +1,37 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
2
3
|
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* --------------------------------
|
|
7
|
+
* SHAPE
|
|
8
|
+
* --------------------------------
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const EntityStatsShape = z.object({
|
|
12
|
+
parentId: z.cuid2(),
|
|
13
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
14
|
+
|
|
15
|
+
likesCount: z.number(),
|
|
16
|
+
bookmarksCount: z.number(),
|
|
17
|
+
viewsCount: z.number(),
|
|
18
|
+
commentsCount: z.number(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type EntityStatsShapeType = z.infer<typeof EntityStatsShape>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* --------------------------------
|
|
25
|
+
* BASE ENTITY
|
|
26
|
+
* --------------------------------
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export const EntityStatsEntitySchema = z
|
|
5
30
|
.object({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
}),
|
|
31
|
+
...EntityStatsShape.shape,
|
|
32
|
+
createdAt: z.iso.datetime(),
|
|
33
|
+
updatedAt: z.iso.datetime(),
|
|
39
34
|
})
|
|
40
|
-
.openapi(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
35
|
+
.openapi("EntityStats");
|
|
36
|
+
|
|
37
|
+
export type EntityStatsEntity = z.infer<typeof EntityStatsEntitySchema>;
|