@zyacreatives/shared 2.1.79 → 2.1.81
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/investor.d.ts +5 -0
- package/dist/schemas/investor.js +2 -0
- package/dist/schemas/post.d.ts +29 -1
- package/dist/schemas/post.js +8 -11
- package/dist/schemas/user.d.ts +2 -0
- package/dist/types/post.d.ts +2 -1
- package/package.json +1 -1
- package/src/schemas/investor.ts +23 -15
- package/src/schemas/post.ts +186 -187
- package/src/types/post.ts +30 -24
|
@@ -47,6 +47,7 @@ export declare const InvestorEntitySchema: z.ZodObject<{
|
|
|
47
47
|
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
48
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
49
49
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
50
|
+
version: z.ZodInt;
|
|
50
51
|
}, z.core.$strip>;
|
|
51
52
|
export declare const CreateInvestorProfileInputSchema: z.ZodObject<{
|
|
52
53
|
bio: z.ZodOptional<z.ZodString>;
|
|
@@ -103,6 +104,7 @@ export declare const UpdateInvestorProfileInputSchema: z.ZodObject<{
|
|
|
103
104
|
Other: "Other";
|
|
104
105
|
}>>;
|
|
105
106
|
location: z.ZodOptional<z.ZodString>;
|
|
107
|
+
version: z.ZodInt;
|
|
106
108
|
}, z.core.$strip>;
|
|
107
109
|
export declare const ListInvestorsInputSchema: z.ZodObject<{
|
|
108
110
|
query: z.ZodOptional<z.ZodString>;
|
|
@@ -175,6 +177,7 @@ export declare const CreateInvestorOutputSchema: z.ZodObject<{
|
|
|
175
177
|
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
176
178
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
177
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
|
+
version: z.ZodInt;
|
|
178
181
|
}, z.core.$strip>;
|
|
179
182
|
export declare const GetInvestorOutputSchema: z.ZodObject<{
|
|
180
183
|
id: z.ZodCUID2;
|
|
@@ -224,6 +227,7 @@ export declare const GetInvestorOutputSchema: z.ZodObject<{
|
|
|
224
227
|
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
225
228
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
226
229
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
230
|
+
version: z.ZodInt;
|
|
227
231
|
}, z.core.$strip>;
|
|
228
232
|
export declare const UpdateInvestorOutputSchema: z.ZodObject<{
|
|
229
233
|
id: z.ZodCUID2;
|
|
@@ -273,4 +277,5 @@ export declare const UpdateInvestorOutputSchema: z.ZodObject<{
|
|
|
273
277
|
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
274
278
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
275
279
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
280
|
+
version: z.ZodInt;
|
|
276
281
|
}, z.core.$strip>;
|
package/dist/schemas/investor.js
CHANGED
|
@@ -45,6 +45,7 @@ exports.InvestorEntitySchema = zod_openapi_1.z
|
|
|
45
45
|
.date()
|
|
46
46
|
.optional()
|
|
47
47
|
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
48
|
+
version: zod_openapi_1.z.int(),
|
|
48
49
|
})
|
|
49
50
|
.openapi("InvestorEntity");
|
|
50
51
|
exports.CreateInvestorProfileInputSchema = zod_openapi_1.z
|
|
@@ -110,6 +111,7 @@ exports.UpdateInvestorProfileInputSchema = zod_openapi_1.z
|
|
|
110
111
|
location: zod_openapi_1.z.string().optional().openapi({
|
|
111
112
|
example: "UK",
|
|
112
113
|
}),
|
|
114
|
+
version: zod_openapi_1.z.int(),
|
|
113
115
|
})
|
|
114
116
|
.openapi({
|
|
115
117
|
title: "Update Investor Profile",
|
package/dist/schemas/post.d.ts
CHANGED
|
@@ -300,7 +300,7 @@ export declare const GetPostWithLikesOutputSchema: z.ZodObject<{
|
|
|
300
300
|
followsYou: z.ZodOptional<z.ZodBoolean>;
|
|
301
301
|
isFollowing: z.ZodOptional<z.ZodBoolean>;
|
|
302
302
|
}, z.core.$strip>>;
|
|
303
|
-
|
|
303
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
304
304
|
}, z.core.$strip>;
|
|
305
305
|
export declare const PostWithCommentsEntitySchema: z.ZodObject<{
|
|
306
306
|
id: z.ZodCUID2;
|
|
@@ -329,6 +329,34 @@ export declare const PostWithCommentsEntitySchema: z.ZodObject<{
|
|
|
329
329
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
330
330
|
}, z.core.$strip>>;
|
|
331
331
|
}, z.core.$strip>;
|
|
332
|
+
export declare const GetPostWithCommentsOutputSchema: z.ZodObject<{
|
|
333
|
+
id: z.ZodCUID2;
|
|
334
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
335
|
+
content: z.ZodOptional<z.ZodString>;
|
|
336
|
+
comments: z.ZodArray<z.ZodObject<{
|
|
337
|
+
id: z.ZodCUID2;
|
|
338
|
+
userId: z.ZodCUID2;
|
|
339
|
+
parentId: z.ZodCUID2;
|
|
340
|
+
parentType: z.ZodEnum<{
|
|
341
|
+
readonly PROJECT: "PROJECT";
|
|
342
|
+
readonly USER: "USER";
|
|
343
|
+
readonly JOB: "JOB";
|
|
344
|
+
readonly POST: "POST";
|
|
345
|
+
readonly COMMENT: "COMMENT";
|
|
346
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
347
|
+
}>;
|
|
348
|
+
content: z.ZodString;
|
|
349
|
+
commenterUsername: z.ZodOptional<z.ZodString>;
|
|
350
|
+
commenterName: z.ZodOptional<z.ZodString>;
|
|
351
|
+
commenterImageUrl: z.ZodOptional<z.ZodString>;
|
|
352
|
+
replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
|
|
353
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
354
|
+
isLiked: z.ZodDefault<z.ZodBoolean>;
|
|
355
|
+
likesCount: z.ZodDefault<z.ZodInt>;
|
|
356
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
357
|
+
}, z.core.$strip>>;
|
|
358
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
359
|
+
}, z.core.$strip>;
|
|
332
360
|
export declare const PostWithBookmarksEntitySchema: z.ZodObject<{
|
|
333
361
|
id: z.ZodCUID2;
|
|
334
362
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
package/dist/schemas/post.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReportPostInputSchema = exports.SearchPostOutputSchema = exports.SearchPostInputSchema = exports.GetFeedOutputSchema = exports.GetFeedInputSchema = exports.FeedPostEntitySchema = exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.GetPostWithBookmarksOutputSchema = exports.PostWithBookmarksEntitySchema = exports.PostWithCommentsEntitySchema = exports.GetPostWithLikesOutputSchema = exports.PostWithLikesEntitySchema = exports.MinimalPostSchema = exports.PostIdSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.CreatePostInputSchema = exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = exports.PostEntitySchema = void 0;
|
|
3
|
+
exports.ReportPostInputSchema = exports.SearchPostOutputSchema = exports.SearchPostInputSchema = exports.GetFeedOutputSchema = exports.GetFeedInputSchema = exports.FeedPostEntitySchema = exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.GetPostWithBookmarksOutputSchema = exports.PostWithBookmarksEntitySchema = exports.GetPostWithCommentsOutputSchema = exports.PostWithCommentsEntitySchema = exports.GetPostWithLikesOutputSchema = exports.PostWithLikesEntitySchema = exports.MinimalPostSchema = exports.PostIdSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.CreatePostInputSchema = exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = exports.PostEntitySchema = 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");
|
|
@@ -15,9 +15,7 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
|
|
|
15
15
|
.cuid2()
|
|
16
16
|
.optional()
|
|
17
17
|
.openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
|
|
18
|
-
parentType: zod_openapi_1.z
|
|
19
|
-
.enum(constants_1.ACTIVITY_PARENT_TYPES)
|
|
20
|
-
.default(constants_1.ACTIVITY_PARENT_TYPES.POST),
|
|
18
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).default(constants_1.ACTIVITY_PARENT_TYPES.POST),
|
|
21
19
|
tags: zod_openapi_1.z
|
|
22
20
|
.array(zod_openapi_1.z.object({
|
|
23
21
|
name: zod_openapi_1.z.string(),
|
|
@@ -66,9 +64,7 @@ exports.PostFileEntitySchema = zod_openapi_1.z
|
|
|
66
64
|
postId: zod_openapi_1.z.string().openapi({
|
|
67
65
|
description: "CUID2 of the post this file belongs to.",
|
|
68
66
|
}),
|
|
69
|
-
fileId: zod_openapi_1.z
|
|
70
|
-
.string()
|
|
71
|
-
.openapi({ description: "CUID2 of the linked file." }),
|
|
67
|
+
fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
72
68
|
order: zod_openapi_1.z.number().int().openapi({
|
|
73
69
|
description: "Order index of the file in the project.",
|
|
74
70
|
example: 1,
|
|
@@ -92,9 +88,7 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
|
|
|
92
88
|
.cuid2({ message: "Invalid parentId" })
|
|
93
89
|
.optional()
|
|
94
90
|
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
95
|
-
parentType: zod_openapi_1.z
|
|
96
|
-
.enum(constants_1.ACTIVITY_PARENT_TYPES)
|
|
97
|
-
.default(constants_1.ACTIVITY_PARENT_TYPES.POST),
|
|
91
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).default(constants_1.ACTIVITY_PARENT_TYPES.POST),
|
|
98
92
|
content: zod_openapi_1.z
|
|
99
93
|
.string()
|
|
100
94
|
.max(500, { message: "Post content cannot exceed 500 characters" })
|
|
@@ -165,13 +159,16 @@ exports.PostWithLikesEntitySchema = exports.MinimalPostSchema.extend({
|
|
|
165
159
|
title: "PostWithPostLikesEntity",
|
|
166
160
|
});
|
|
167
161
|
exports.GetPostWithLikesOutputSchema = exports.PostWithLikesEntitySchema.extend({
|
|
168
|
-
|
|
162
|
+
nextCursor: zod_openapi_1.z.string().optional(),
|
|
169
163
|
});
|
|
170
164
|
exports.PostWithCommentsEntitySchema = exports.MinimalPostSchema.extend({
|
|
171
165
|
comments: zod_openapi_1.z.array(comment_1.CommentEntitySchema),
|
|
172
166
|
}).openapi({
|
|
173
167
|
title: "PostWithPostCommentsEntity",
|
|
174
168
|
});
|
|
169
|
+
exports.GetPostWithCommentsOutputSchema = exports.PostWithCommentsEntitySchema.extend({
|
|
170
|
+
nextCursor: zod_openapi_1.z.string().optional(),
|
|
171
|
+
});
|
|
175
172
|
exports.PostWithBookmarksEntitySchema = exports.MinimalPostSchema.extend({
|
|
176
173
|
bookmarks: zod_openapi_1.z.array(activity_1.ActivitySchema),
|
|
177
174
|
}).openapi({
|
package/dist/schemas/user.d.ts
CHANGED
|
@@ -204,6 +204,7 @@ export declare const UserProfileEntitySchema: z.ZodObject<{
|
|
|
204
204
|
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
205
205
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
206
206
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
207
|
+
version: z.ZodInt;
|
|
207
208
|
}, z.core.$strip>;
|
|
208
209
|
}, z.core.$strip>;
|
|
209
210
|
export declare const UserWithProjectsEntitySchema: z.ZodObject<{
|
|
@@ -687,6 +688,7 @@ export declare const GetAuthenticatedUserProfileOutputSchema: z.ZodObject<{
|
|
|
687
688
|
disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
688
689
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
689
690
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
691
|
+
version: z.ZodInt;
|
|
690
692
|
}, z.core.$strip>;
|
|
691
693
|
}, z.core.$strip>;
|
|
692
694
|
export declare const GetAuthenticatedUserWithProjectsOutputSchema: z.ZodObject<{
|
package/dist/types/post.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { CreatePostInputSchema, CreatePostOutputSchema, FeedPostEntitySchema, GetFeedInputSchema, GetFeedOutputSchema, GetPostOutputSchema, GetPostWithBookmarksOutputSchema, GetPostWithLikesOutputSchema, LinkPreviewInputSchema, LinkPreviewOutputSchema, PostEntitySchema, PostFileEntitySchema, PostIdSchema, PostWithBookmarksEntitySchema, PostWithCommentsEntitySchema, PostWithFilesEntitySchema, PostWithLikesEntitySchema, ReportPostInputSchema, SearchPostInputSchema, SearchPostOutputSchema } from "../schemas/post";
|
|
2
|
+
import { CreatePostInputSchema, CreatePostOutputSchema, FeedPostEntitySchema, GetFeedInputSchema, GetFeedOutputSchema, GetPostOutputSchema, GetPostWithBookmarksOutputSchema, GetPostWithCommentsOutputSchema, GetPostWithLikesOutputSchema, LinkPreviewInputSchema, LinkPreviewOutputSchema, PostEntitySchema, PostFileEntitySchema, PostIdSchema, PostWithBookmarksEntitySchema, PostWithCommentsEntitySchema, PostWithFilesEntitySchema, PostWithLikesEntitySchema, ReportPostInputSchema, SearchPostInputSchema, SearchPostOutputSchema } from "../schemas/post";
|
|
3
3
|
export type PostEntity = z.infer<typeof PostEntitySchema>;
|
|
4
4
|
export type PostFileEntity = z.infer<typeof PostFileEntitySchema>;
|
|
5
5
|
export type PostWithFilesEntity = z.infer<typeof PostWithFilesEntitySchema>;
|
|
@@ -18,5 +18,6 @@ export type GetFeedOutput = z.infer<typeof GetFeedOutputSchema>;
|
|
|
18
18
|
export type SearchPostInput = z.infer<typeof SearchPostInputSchema>;
|
|
19
19
|
export type SearchPostOutput = z.infer<typeof SearchPostOutputSchema>;
|
|
20
20
|
export type GetPostWithLikesOutput = z.infer<typeof GetPostWithLikesOutputSchema>;
|
|
21
|
+
export type GetPostWithCommentsOutput = z.infer<typeof GetPostWithCommentsOutputSchema>;
|
|
21
22
|
export type GetPostWithBookmarksOutput = z.infer<typeof GetPostWithBookmarksOutputSchema>;
|
|
22
23
|
export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
|
package/package.json
CHANGED
package/src/schemas/investor.ts
CHANGED
|
@@ -24,8 +24,8 @@ export const InvestorEntitySchema = z
|
|
|
24
24
|
.enum(
|
|
25
25
|
Object.values(EXPERIENCE_LEVELS) as [
|
|
26
26
|
ExperienceLevel,
|
|
27
|
-
...ExperienceLevel[]
|
|
28
|
-
]
|
|
27
|
+
...ExperienceLevel[],
|
|
28
|
+
],
|
|
29
29
|
)
|
|
30
30
|
.optional()
|
|
31
31
|
.openapi({ example: "EXPERT" }),
|
|
@@ -33,14 +33,17 @@ export const InvestorEntitySchema = z
|
|
|
33
33
|
.enum(
|
|
34
34
|
Object.values(GEOGRAPHIC_FOCUS) as [
|
|
35
35
|
GeographicFocus,
|
|
36
|
-
...GeographicFocus[]
|
|
37
|
-
]
|
|
36
|
+
...GeographicFocus[],
|
|
37
|
+
],
|
|
38
38
|
)
|
|
39
39
|
.optional()
|
|
40
40
|
.openapi({ example: "NORTH_AMERICA" }),
|
|
41
41
|
investmentSize: z
|
|
42
42
|
.enum(
|
|
43
|
-
Object.values(INVESTMENT_SIZES) as [
|
|
43
|
+
Object.values(INVESTMENT_SIZES) as [
|
|
44
|
+
InvestmentSize,
|
|
45
|
+
...InvestmentSize[],
|
|
46
|
+
],
|
|
44
47
|
)
|
|
45
48
|
.optional()
|
|
46
49
|
.openapi({ example: "SEED" }),
|
|
@@ -64,6 +67,7 @@ export const InvestorEntitySchema = z
|
|
|
64
67
|
.date()
|
|
65
68
|
.optional()
|
|
66
69
|
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
70
|
+
version: z.int(),
|
|
67
71
|
})
|
|
68
72
|
.openapi("InvestorEntity");
|
|
69
73
|
|
|
@@ -79,8 +83,8 @@ export const CreateInvestorProfileInputSchema = z
|
|
|
79
83
|
.enum(
|
|
80
84
|
Object.values(EXPERIENCE_LEVELS) as [
|
|
81
85
|
ExperienceLevel,
|
|
82
|
-
...ExperienceLevel[]
|
|
83
|
-
]
|
|
86
|
+
...ExperienceLevel[],
|
|
87
|
+
],
|
|
84
88
|
)
|
|
85
89
|
.default(EXPERIENCE_LEVELS.YEAR_0_1)
|
|
86
90
|
.openapi({
|
|
@@ -106,8 +110,8 @@ export const UpdateInvestorProfileInputSchema = z
|
|
|
106
110
|
.enum(
|
|
107
111
|
Object.values(EXPERIENCE_LEVELS) as [
|
|
108
112
|
ExperienceLevel,
|
|
109
|
-
...ExperienceLevel[]
|
|
110
|
-
]
|
|
113
|
+
...ExperienceLevel[],
|
|
114
|
+
],
|
|
111
115
|
)
|
|
112
116
|
.optional()
|
|
113
117
|
.openapi({
|
|
@@ -128,7 +132,10 @@ export const UpdateInvestorProfileInputSchema = z
|
|
|
128
132
|
}),
|
|
129
133
|
investmentSize: z
|
|
130
134
|
.enum(
|
|
131
|
-
Object.values(INVESTMENT_SIZES) as [
|
|
135
|
+
Object.values(INVESTMENT_SIZES) as [
|
|
136
|
+
InvestmentSize,
|
|
137
|
+
...InvestmentSize[],
|
|
138
|
+
],
|
|
132
139
|
)
|
|
133
140
|
.optional()
|
|
134
141
|
.openapi({
|
|
@@ -138,8 +145,8 @@ export const UpdateInvestorProfileInputSchema = z
|
|
|
138
145
|
.enum(
|
|
139
146
|
Object.values(GEOGRAPHIC_FOCUS) as [
|
|
140
147
|
GeographicFocus,
|
|
141
|
-
...GeographicFocus[]
|
|
142
|
-
]
|
|
148
|
+
...GeographicFocus[],
|
|
149
|
+
],
|
|
143
150
|
)
|
|
144
151
|
.optional()
|
|
145
152
|
.openapi({
|
|
@@ -148,6 +155,7 @@ export const UpdateInvestorProfileInputSchema = z
|
|
|
148
155
|
location: z.string().optional().openapi({
|
|
149
156
|
example: "UK",
|
|
150
157
|
}),
|
|
158
|
+
version: z.int(),
|
|
151
159
|
})
|
|
152
160
|
.openapi({
|
|
153
161
|
title: "Update Investor Profile",
|
|
@@ -165,9 +173,9 @@ export const ListInvestorsInputSchema = z
|
|
|
165
173
|
z.enum(
|
|
166
174
|
Object.values(EXPERIENCE_LEVELS) as [
|
|
167
175
|
ExperienceLevel,
|
|
168
|
-
...ExperienceLevel[]
|
|
169
|
-
]
|
|
170
|
-
)
|
|
176
|
+
...ExperienceLevel[],
|
|
177
|
+
],
|
|
178
|
+
),
|
|
171
179
|
)
|
|
172
180
|
.optional()
|
|
173
181
|
.openapi({
|
package/src/schemas/post.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
ACTIVITY_PARENT_TYPES,
|
|
4
|
+
POST_BADGE_TYPES,
|
|
5
|
+
POST_TYPES,
|
|
6
6
|
} from "../constants";
|
|
7
7
|
import { CreateFileInputSchema } from "./file";
|
|
8
8
|
import { CommentEntitySchema } from "./comment";
|
|
@@ -10,247 +10,246 @@ import { EntityStatsSchema } from "./entity-stats";
|
|
|
10
10
|
import { ActivitySchema } from "./activity";
|
|
11
11
|
|
|
12
12
|
export const PostEntitySchema = z.object({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
13
|
+
id: z
|
|
14
|
+
.cuid2()
|
|
15
|
+
.openapi({ description: "Post id", example: "ckj1a2b3c0000xyz" }),
|
|
16
|
+
parentId: z
|
|
17
|
+
.cuid2()
|
|
18
|
+
.optional()
|
|
19
|
+
.openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
|
|
20
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).default(ACTIVITY_PARENT_TYPES.POST),
|
|
21
|
+
tags: z
|
|
22
|
+
.array(
|
|
23
|
+
z.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
id: z.int(),
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
28
|
+
.optional(),
|
|
29
|
+
badge: z.enum(POST_BADGE_TYPES).optional(),
|
|
30
|
+
userId: z
|
|
31
|
+
.cuid2()
|
|
32
|
+
.openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
|
|
33
|
+
creatorUsername: z.string().optional().openapi({ description: "Username" }),
|
|
34
|
+
creatorFullName: z.string().optional(),
|
|
35
|
+
creatorImageUrl: z.cuid2().optional().openapi({ description: "Username" }),
|
|
36
|
+
content: z
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.openapi({ description: "Post content", example: "Hello world" }),
|
|
40
|
+
postType: z.enum(POST_TYPES).openapi({
|
|
41
|
+
description: "Type of the post entity this statistic belongs to.",
|
|
42
|
+
title: "Post Type",
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
createdAt: z.coerce.date().optional(),
|
|
46
|
+
|
|
47
|
+
linkMeta: z
|
|
48
|
+
.object({
|
|
49
|
+
url: z.url(),
|
|
50
|
+
title: z.string().optional(),
|
|
51
|
+
description: z.string().optional(),
|
|
52
|
+
image: z.url().optional(),
|
|
53
|
+
})
|
|
54
|
+
.optional()
|
|
55
|
+
.openapi({
|
|
56
|
+
description: "Optional metadata for a single link in the post",
|
|
57
|
+
example: {
|
|
58
|
+
url: "https://example.com",
|
|
59
|
+
title: "Example Website",
|
|
60
|
+
description: "This is an example link",
|
|
61
|
+
image: "https://example.com/preview.jpg",
|
|
62
|
+
},
|
|
45
63
|
}),
|
|
46
|
-
|
|
47
|
-
createdAt: z.coerce.date().optional(),
|
|
48
|
-
|
|
49
|
-
linkMeta: z
|
|
50
|
-
.object({
|
|
51
|
-
url: z.url(),
|
|
52
|
-
title: z.string().optional(),
|
|
53
|
-
description: z.string().optional(),
|
|
54
|
-
image: z.url().optional(),
|
|
55
|
-
})
|
|
56
|
-
.optional()
|
|
57
|
-
.openapi({
|
|
58
|
-
description: "Optional metadata for a single link in the post",
|
|
59
|
-
example: {
|
|
60
|
-
url: "https://example.com",
|
|
61
|
-
title: "Example Website",
|
|
62
|
-
description: "This is an example link",
|
|
63
|
-
image: "https://example.com/preview.jpg",
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
64
|
});
|
|
67
65
|
|
|
68
66
|
export const PostFileEntitySchema = z
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
description: "Schema representing a file associated with a project.",
|
|
87
|
-
});
|
|
67
|
+
.object({
|
|
68
|
+
id: z
|
|
69
|
+
.string()
|
|
70
|
+
.openapi({ description: "CUID2 of the project file record." }),
|
|
71
|
+
postId: z.string().openapi({
|
|
72
|
+
description: "CUID2 of the post this file belongs to.",
|
|
73
|
+
}),
|
|
74
|
+
fileId: z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
75
|
+
order: z.number().int().openapi({
|
|
76
|
+
description: "Order index of the file in the project.",
|
|
77
|
+
example: 1,
|
|
78
|
+
}),
|
|
79
|
+
})
|
|
80
|
+
.openapi({
|
|
81
|
+
title: "Post File Entity",
|
|
82
|
+
description: "Schema representing a file associated with a project.",
|
|
83
|
+
});
|
|
88
84
|
|
|
89
85
|
export const PostWithFilesEntitySchema = PostEntitySchema.extend({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
postFiles: z
|
|
87
|
+
.array(
|
|
88
|
+
PostFileEntitySchema.extend({
|
|
89
|
+
url: z.url(),
|
|
90
|
+
}),
|
|
91
|
+
)
|
|
92
|
+
.optional()
|
|
93
|
+
.openapi({ description: "Files associated with the project." }),
|
|
98
94
|
});
|
|
99
95
|
|
|
100
96
|
export const CreatePostInputSchema = z.object({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
example: "New project announcement",
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
postType: z
|
|
119
|
-
.enum(POST_TYPES)
|
|
120
|
-
.default("DEFAULT_POST")
|
|
121
|
-
.openapi({ description: "Post type", example: "PROJECT" }),
|
|
122
|
-
|
|
123
|
-
files: z
|
|
124
|
-
.array(
|
|
125
|
-
CreateFileInputSchema.extend({
|
|
126
|
-
order: z
|
|
127
|
-
.number()
|
|
128
|
-
.int({ message: "File order must be an integer" })
|
|
129
|
-
|
|
130
|
-
.max(5, { message: "File order cannot exceed 5" })
|
|
131
|
-
.default(1),
|
|
132
|
-
}),
|
|
133
|
-
)
|
|
134
|
-
.max(5, { message: "Cannot attach more than 5 files" })
|
|
135
|
-
.optional(),
|
|
97
|
+
id: z.cuid2(),
|
|
98
|
+
parentId: z
|
|
99
|
+
.cuid2({ message: "Invalid parentId" })
|
|
100
|
+
.optional()
|
|
101
|
+
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
102
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).default(ACTIVITY_PARENT_TYPES.POST),
|
|
103
|
+
content: z
|
|
104
|
+
.string()
|
|
105
|
+
.max(500, { message: "Post content cannot exceed 500 characters" })
|
|
106
|
+
.optional()
|
|
107
|
+
.openapi({
|
|
108
|
+
description: "Post content",
|
|
109
|
+
example: "New project announcement",
|
|
110
|
+
}),
|
|
136
111
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
112
|
+
postType: z
|
|
113
|
+
.enum(POST_TYPES)
|
|
114
|
+
.default("DEFAULT_POST")
|
|
115
|
+
.openapi({ description: "Post type", example: "PROJECT" }),
|
|
116
|
+
|
|
117
|
+
files: z
|
|
118
|
+
.array(
|
|
119
|
+
CreateFileInputSchema.extend({
|
|
120
|
+
order: z
|
|
121
|
+
.number()
|
|
122
|
+
.int({ message: "File order must be an integer" })
|
|
123
|
+
|
|
124
|
+
.max(5, { message: "File order cannot exceed 5" })
|
|
125
|
+
.default(1),
|
|
126
|
+
}),
|
|
127
|
+
)
|
|
128
|
+
.max(5, { message: "Cannot attach more than 5 files" })
|
|
129
|
+
.optional(),
|
|
130
|
+
|
|
131
|
+
tags: z
|
|
132
|
+
.array(z.string().min(1, { message: "Tag cannot be empty" }))
|
|
133
|
+
.max(3, { message: "Cannot add more than 3 tags" })
|
|
134
|
+
.optional(),
|
|
135
|
+
badge: z.enum(POST_BADGE_TYPES).optional(),
|
|
136
|
+
linkMeta: z
|
|
137
|
+
.object({
|
|
138
|
+
url: z.url({ message: "Invalid URL format" }),
|
|
139
|
+
title: z
|
|
140
|
+
.string()
|
|
141
|
+
.max(200, { message: "Title cannot exceed 200 characters" })
|
|
140
142
|
.optional(),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
title: z
|
|
146
|
-
.string()
|
|
147
|
-
.max(200, { message: "Title cannot exceed 200 characters" })
|
|
148
|
-
.optional(),
|
|
149
|
-
description: z
|
|
150
|
-
.string()
|
|
151
|
-
.max(500, {
|
|
152
|
-
message: "Description cannot exceed 500 characters",
|
|
153
|
-
})
|
|
154
|
-
.optional(),
|
|
155
|
-
image: z.url({ message: "Invalid image URL" }).optional(),
|
|
143
|
+
description: z
|
|
144
|
+
.string()
|
|
145
|
+
.max(500, {
|
|
146
|
+
message: "Description cannot exceed 500 characters",
|
|
156
147
|
})
|
|
157
|
-
.optional()
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
148
|
+
.optional(),
|
|
149
|
+
image: z.url({ message: "Invalid image URL" }).optional(),
|
|
150
|
+
})
|
|
151
|
+
.optional()
|
|
152
|
+
.openapi({
|
|
153
|
+
description: "Optional metadata for a single link in the post",
|
|
154
|
+
example: {
|
|
155
|
+
url: "https://example.com",
|
|
156
|
+
title: "Example Website",
|
|
157
|
+
description: "This is an example link",
|
|
158
|
+
image: "https://example.com/preview.jpg",
|
|
159
|
+
},
|
|
160
|
+
}),
|
|
167
161
|
});
|
|
168
162
|
|
|
169
163
|
export const CreatePostOutputSchema = PostEntitySchema;
|
|
170
164
|
export const GetPostOutputSchema = PostWithFilesEntitySchema;
|
|
171
165
|
export const PostIdSchema = z.object({ postId: z.cuid2() });
|
|
172
166
|
export const MinimalPostSchema = PostEntitySchema.pick({
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
id: true,
|
|
168
|
+
parentId: true,
|
|
169
|
+
content: true,
|
|
176
170
|
});
|
|
177
171
|
|
|
178
172
|
export const PostWithLikesEntitySchema = MinimalPostSchema.extend({
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
173
|
+
likes: z.array(
|
|
174
|
+
ActivitySchema.extend({
|
|
175
|
+
followsYou: z.boolean().optional(),
|
|
176
|
+
isFollowing: z.boolean().optional(),
|
|
177
|
+
}),
|
|
178
|
+
),
|
|
185
179
|
}).openapi({
|
|
186
|
-
|
|
180
|
+
title: "PostWithPostLikesEntity",
|
|
187
181
|
});
|
|
188
182
|
|
|
189
183
|
export const GetPostWithLikesOutputSchema = PostWithLikesEntitySchema.extend({
|
|
190
|
-
|
|
184
|
+
nextCursor: z.string().optional(),
|
|
191
185
|
});
|
|
192
186
|
|
|
193
187
|
export const PostWithCommentsEntitySchema = MinimalPostSchema.extend({
|
|
194
|
-
|
|
188
|
+
comments: z.array(CommentEntitySchema),
|
|
195
189
|
}).openapi({
|
|
196
|
-
|
|
190
|
+
title: "PostWithPostCommentsEntity",
|
|
197
191
|
});
|
|
198
192
|
|
|
193
|
+
export const GetPostWithCommentsOutputSchema =
|
|
194
|
+
PostWithCommentsEntitySchema.extend({
|
|
195
|
+
nextCursor: z.string().optional(),
|
|
196
|
+
});
|
|
197
|
+
|
|
199
198
|
export const PostWithBookmarksEntitySchema = MinimalPostSchema.extend({
|
|
200
|
-
|
|
199
|
+
bookmarks: z.array(ActivitySchema),
|
|
201
200
|
}).openapi({
|
|
202
|
-
|
|
201
|
+
title: "PostWithPostBookmarksEntity",
|
|
203
202
|
});
|
|
204
203
|
|
|
205
204
|
export const GetPostWithBookmarksOutputSchema =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
PostWithBookmarksEntitySchema.extend({
|
|
206
|
+
totalNo: z.number().int(),
|
|
207
|
+
});
|
|
209
208
|
|
|
210
209
|
export const LinkPreviewInputSchema = z.object({
|
|
211
|
-
|
|
210
|
+
url: z.string(),
|
|
212
211
|
});
|
|
213
212
|
|
|
214
213
|
export const LinkPreviewOutputSchema = z.object({
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
title: z.string(),
|
|
215
|
+
description: z.string().optional(),
|
|
216
|
+
image: z.string().optional(),
|
|
217
|
+
url: z.string().optional(),
|
|
219
218
|
});
|
|
220
219
|
|
|
221
220
|
export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
stats: EntityStatsSchema,
|
|
222
|
+
score: z.number(),
|
|
223
|
+
isLiked: z.boolean().optional(),
|
|
224
|
+
isFollowing: z.boolean().optional(),
|
|
225
|
+
isBookmarked: z.boolean().optional(),
|
|
227
226
|
});
|
|
228
227
|
|
|
229
228
|
export const GetFeedInputSchema = z.object({
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
limit: z.number().optional(),
|
|
230
|
+
cursor: z.string().optional(),
|
|
232
231
|
});
|
|
233
232
|
|
|
234
233
|
export const GetFeedOutputSchema = z.object({
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
feed: z.array(FeedPostEntitySchema),
|
|
235
|
+
nextCursor: z.string().optional().nullable(),
|
|
237
236
|
});
|
|
238
237
|
|
|
239
238
|
export const SearchPostInputSchema = z.object({
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
queryString: z
|
|
240
|
+
.string()
|
|
241
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
242
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
243
|
+
cursor: z.string().optional(),
|
|
245
244
|
});
|
|
246
245
|
|
|
247
246
|
export const SearchPostOutputSchema = z.object({
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
posts: z.array(FeedPostEntitySchema),
|
|
248
|
+
nextCursor: z.string().optional().nullable(),
|
|
250
249
|
});
|
|
251
250
|
|
|
252
251
|
export const ReportPostInputSchema = z.object({
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
complaint: z
|
|
253
|
+
.string()
|
|
254
|
+
.max(200, { error: "Complaint cannot be longer than 200 characters" }),
|
|
256
255
|
});
|
package/src/types/post.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
CreatePostInputSchema,
|
|
4
|
+
CreatePostOutputSchema,
|
|
5
|
+
FeedPostEntitySchema,
|
|
6
|
+
GetFeedInputSchema,
|
|
7
|
+
GetFeedOutputSchema,
|
|
8
|
+
GetPostOutputSchema,
|
|
9
|
+
GetPostWithBookmarksOutputSchema,
|
|
10
|
+
GetPostWithCommentsOutputSchema,
|
|
11
|
+
GetPostWithLikesOutputSchema,
|
|
12
|
+
LinkPreviewInputSchema,
|
|
13
|
+
LinkPreviewOutputSchema,
|
|
14
|
+
PostEntitySchema,
|
|
15
|
+
PostFileEntitySchema,
|
|
16
|
+
PostIdSchema,
|
|
17
|
+
PostWithBookmarksEntitySchema,
|
|
18
|
+
PostWithCommentsEntitySchema,
|
|
19
|
+
PostWithFilesEntitySchema,
|
|
20
|
+
PostWithLikesEntitySchema,
|
|
21
|
+
ReportPostInputSchema,
|
|
22
|
+
SearchPostInputSchema,
|
|
23
|
+
SearchPostOutputSchema,
|
|
23
24
|
} from "../schemas/post";
|
|
24
25
|
|
|
25
26
|
export type PostEntity = z.infer<typeof PostEntitySchema>;
|
|
@@ -29,11 +30,11 @@ export type CreatePostInput = z.infer<typeof CreatePostInputSchema>;
|
|
|
29
30
|
export type CreatePostOutput = z.infer<typeof CreatePostOutputSchema>;
|
|
30
31
|
export type PostWithPostLikesEntity = z.infer<typeof PostWithLikesEntitySchema>;
|
|
31
32
|
export type PostWithPostBookmarksEntity = z.infer<
|
|
32
|
-
|
|
33
|
+
typeof PostWithBookmarksEntitySchema
|
|
33
34
|
>;
|
|
34
35
|
export type PostIdInput = z.infer<typeof PostIdSchema>;
|
|
35
36
|
export type PostWithPostCommentsEntity = z.infer<
|
|
36
|
-
|
|
37
|
+
typeof PostWithCommentsEntitySchema
|
|
37
38
|
>;
|
|
38
39
|
export type GetPostOutput = z.infer<typeof GetPostOutputSchema>;
|
|
39
40
|
export type LinkPreviewInput = z.infer<typeof LinkPreviewInputSchema>;
|
|
@@ -46,9 +47,14 @@ export type SearchPostInput = z.infer<typeof SearchPostInputSchema>;
|
|
|
46
47
|
export type SearchPostOutput = z.infer<typeof SearchPostOutputSchema>;
|
|
47
48
|
|
|
48
49
|
export type GetPostWithLikesOutput = z.infer<
|
|
49
|
-
|
|
50
|
+
typeof GetPostWithLikesOutputSchema
|
|
50
51
|
>;
|
|
52
|
+
|
|
53
|
+
export type GetPostWithCommentsOutput = z.infer<
|
|
54
|
+
typeof GetPostWithCommentsOutputSchema
|
|
55
|
+
>;
|
|
56
|
+
|
|
51
57
|
export type GetPostWithBookmarksOutput = z.infer<
|
|
52
|
-
|
|
58
|
+
typeof GetPostWithBookmarksOutputSchema
|
|
53
59
|
>;
|
|
54
60
|
export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
|