@zyacreatives/shared 2.0.52 → 2.0.54
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/post.d.ts +95 -9
- package/dist/schemas/post.js +48 -12
- package/dist/types/post.d.ts +3 -1
- package/package.json +1 -1
- package/src/schemas/post.ts +58 -12
- package/src/types/post.ts +5 -0
package/dist/schemas/post.d.ts
CHANGED
|
@@ -2,7 +2,10 @@ import { z } from "@hono/zod-openapi";
|
|
|
2
2
|
export declare const PostEntitySchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodCUID2;
|
|
4
4
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
5
|
-
tags: z.ZodOptional<z.ZodArray<z.
|
|
5
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
id: z.ZodInt;
|
|
8
|
+
}, z.core.$strip>>>;
|
|
6
9
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
7
10
|
readonly NETWORKING: "Networking";
|
|
8
11
|
readonly FUNDING: "Funding";
|
|
@@ -44,7 +47,10 @@ export declare const PostFileEntitySchema: z.ZodObject<{
|
|
|
44
47
|
export declare const PostWithFilesEntitySchema: z.ZodObject<{
|
|
45
48
|
id: z.ZodCUID2;
|
|
46
49
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
47
|
-
tags: z.ZodOptional<z.ZodArray<z.
|
|
50
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
id: z.ZodInt;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
48
54
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
49
55
|
readonly NETWORKING: "Networking";
|
|
50
56
|
readonly FUNDING: "Funding";
|
|
@@ -99,7 +105,7 @@ export declare const CreatePostInputSchema: z.ZodObject<{
|
|
|
99
105
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
100
106
|
key: z.ZodString;
|
|
101
107
|
mimeType: z.ZodString;
|
|
102
|
-
order: z.ZodDefault<z.
|
|
108
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
103
109
|
}, z.core.$strip>>>;
|
|
104
110
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
111
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
@@ -113,16 +119,19 @@ export declare const CreatePostInputSchema: z.ZodObject<{
|
|
|
113
119
|
readonly MENTORSHIP: "Mentorship";
|
|
114
120
|
}>>;
|
|
115
121
|
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
116
|
-
url: z.
|
|
122
|
+
url: z.ZodString;
|
|
117
123
|
title: z.ZodOptional<z.ZodString>;
|
|
118
124
|
description: z.ZodOptional<z.ZodString>;
|
|
119
|
-
image: z.ZodOptional<z.
|
|
125
|
+
image: z.ZodOptional<z.ZodString>;
|
|
120
126
|
}, z.core.$strip>>;
|
|
121
127
|
}, z.core.$strip>;
|
|
122
128
|
export declare const CreatePostOutputSchema: z.ZodObject<{
|
|
123
129
|
id: z.ZodCUID2;
|
|
124
130
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
125
|
-
tags: z.ZodOptional<z.ZodArray<z.
|
|
131
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
132
|
+
name: z.ZodString;
|
|
133
|
+
id: z.ZodInt;
|
|
134
|
+
}, z.core.$strip>>>;
|
|
126
135
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
127
136
|
readonly NETWORKING: "Networking";
|
|
128
137
|
readonly FUNDING: "Funding";
|
|
@@ -158,7 +167,10 @@ export declare const CreatePostOutputSchema: z.ZodObject<{
|
|
|
158
167
|
export declare const GetPostOutputSchema: z.ZodObject<{
|
|
159
168
|
id: z.ZodCUID2;
|
|
160
169
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
161
|
-
tags: z.ZodOptional<z.ZodArray<z.
|
|
170
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
171
|
+
name: z.ZodString;
|
|
172
|
+
id: z.ZodInt;
|
|
173
|
+
}, z.core.$strip>>>;
|
|
162
174
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
163
175
|
readonly NETWORKING: "Networking";
|
|
164
176
|
readonly FUNDING: "Funding";
|
|
@@ -269,7 +281,10 @@ export declare const LinkPreviewOutputSchema: z.ZodObject<{
|
|
|
269
281
|
export declare const FeedPostEntitySchema: z.ZodObject<{
|
|
270
282
|
id: z.ZodCUID2;
|
|
271
283
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
272
|
-
tags: z.ZodOptional<z.ZodArray<z.
|
|
284
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
285
|
+
name: z.ZodString;
|
|
286
|
+
id: z.ZodInt;
|
|
287
|
+
}, z.core.$strip>>>;
|
|
273
288
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
274
289
|
readonly NETWORKING: "Networking";
|
|
275
290
|
readonly FUNDING: "Funding";
|
|
@@ -333,7 +348,78 @@ export declare const GetFeedInputSchema: z.ZodObject<{
|
|
|
333
348
|
export declare const GetFeedOutputSchema: z.ZodArray<z.ZodObject<{
|
|
334
349
|
id: z.ZodCUID2;
|
|
335
350
|
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
336
|
-
tags: z.ZodOptional<z.ZodArray<z.
|
|
351
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
352
|
+
name: z.ZodString;
|
|
353
|
+
id: z.ZodInt;
|
|
354
|
+
}, z.core.$strip>>>;
|
|
355
|
+
badge: z.ZodOptional<z.ZodEnum<{
|
|
356
|
+
readonly NETWORKING: "Networking";
|
|
357
|
+
readonly FUNDING: "Funding";
|
|
358
|
+
readonly COLLABORATION: "Collaboration";
|
|
359
|
+
readonly OPPORTUNITIES: "Opportunities";
|
|
360
|
+
readonly SHOWCASE: "Showcase";
|
|
361
|
+
readonly LEARNING: "Learning";
|
|
362
|
+
readonly DISCUSSION: "Discussion";
|
|
363
|
+
readonly MENTORSHIP: "Mentorship";
|
|
364
|
+
}>>;
|
|
365
|
+
userId: z.ZodCUID2;
|
|
366
|
+
creatorUsername: z.ZodOptional<z.ZodString>;
|
|
367
|
+
creatorFullName: z.ZodOptional<z.ZodString>;
|
|
368
|
+
creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
|
|
369
|
+
content: z.ZodOptional<z.ZodString>;
|
|
370
|
+
postType: z.ZodEnum<{
|
|
371
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
372
|
+
readonly PROJECT: "PROJECT";
|
|
373
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
374
|
+
readonly DEFAULT_POST: "DEFAULT_POST";
|
|
375
|
+
readonly POST_WITH_LINKS: "POST_WITH_LINKS";
|
|
376
|
+
readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
|
|
377
|
+
readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
|
|
378
|
+
}>;
|
|
379
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
380
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
381
|
+
url: z.ZodURL;
|
|
382
|
+
title: z.ZodOptional<z.ZodString>;
|
|
383
|
+
description: z.ZodOptional<z.ZodString>;
|
|
384
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
385
|
+
}, z.core.$strip>>;
|
|
386
|
+
postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
387
|
+
id: z.ZodString;
|
|
388
|
+
postId: z.ZodString;
|
|
389
|
+
fileId: z.ZodString;
|
|
390
|
+
order: z.ZodNumber;
|
|
391
|
+
url: z.ZodURL;
|
|
392
|
+
}, z.core.$strip>>>;
|
|
393
|
+
stats: z.ZodObject<{
|
|
394
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
395
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
396
|
+
parentId: z.ZodCUID2;
|
|
397
|
+
parentType: z.ZodEnum<{
|
|
398
|
+
readonly PROJECT: "PROJECT";
|
|
399
|
+
readonly POST: "POST";
|
|
400
|
+
}>;
|
|
401
|
+
likesCount: z.ZodNumber;
|
|
402
|
+
bookmarksCount: z.ZodNumber;
|
|
403
|
+
viewsCount: z.ZodNumber;
|
|
404
|
+
commentsCount: z.ZodNumber;
|
|
405
|
+
}, z.core.$strip>;
|
|
406
|
+
score: z.ZodNumber;
|
|
407
|
+
isLiked: z.ZodOptional<z.ZodBoolean>;
|
|
408
|
+
isFollowing: z.ZodOptional<z.ZodBoolean>;
|
|
409
|
+
isBookmarked: z.ZodOptional<z.ZodBoolean>;
|
|
410
|
+
}, z.core.$strip>>;
|
|
411
|
+
export declare const SearchPostInputSchema: z.ZodObject<{
|
|
412
|
+
string: z.ZodString;
|
|
413
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
414
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
415
|
+
}, z.core.$strip>;
|
|
416
|
+
export declare const SearchPostOutputSchema: z.ZodArray<z.ZodObject<{
|
|
417
|
+
id: z.ZodCUID2;
|
|
418
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
419
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
420
|
+
name: z.ZodString;
|
|
421
|
+
id: z.ZodInt;
|
|
422
|
+
}, z.core.$strip>>>;
|
|
337
423
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
338
424
|
readonly NETWORKING: "Networking";
|
|
339
425
|
readonly FUNDING: "Funding";
|
package/dist/schemas/post.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetFeedOutputSchema = exports.GetFeedInputSchema = exports.FeedPostEntitySchema = exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.PostWithBookmarksEntitySchema = exports.PostWithCommentsEntitySchema = exports.PostWithLikesEntitySchema = exports.MinimalPostSchema = exports.PostIdSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.CreatePostInputSchema = exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = exports.PostEntitySchema = void 0;
|
|
3
|
+
exports.SearchPostOutputSchema = exports.SearchPostInputSchema = exports.GetFeedOutputSchema = exports.GetFeedInputSchema = exports.FeedPostEntitySchema = exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.PostWithBookmarksEntitySchema = exports.PostWithCommentsEntitySchema = 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");
|
|
@@ -16,7 +16,12 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
|
|
|
16
16
|
.cuid2()
|
|
17
17
|
.optional()
|
|
18
18
|
.openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
|
|
19
|
-
tags: zod_openapi_1.z
|
|
19
|
+
tags: zod_openapi_1.z
|
|
20
|
+
.array(zod_openapi_1.z.object({
|
|
21
|
+
name: zod_openapi_1.z.string(),
|
|
22
|
+
id: zod_openapi_1.z.int(),
|
|
23
|
+
}))
|
|
24
|
+
.optional(),
|
|
20
25
|
badge: zod_openapi_1.z.enum(constants_1.POST_BADGE_TYPES).optional(),
|
|
21
26
|
userId: zod_openapi_1.z
|
|
22
27
|
.cuid2()
|
|
@@ -79,33 +84,50 @@ exports.PostWithFilesEntitySchema = exports.PostEntitySchema.extend({
|
|
|
79
84
|
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
80
85
|
exports.CreatePostInputSchema = zod_openapi_1.z.object({
|
|
81
86
|
parentId: zod_openapi_1.z
|
|
82
|
-
.cuid2()
|
|
87
|
+
.cuid2({ message: "Invalid parentId" })
|
|
83
88
|
.optional()
|
|
84
89
|
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
85
90
|
content: zod_openapi_1.z
|
|
86
91
|
.string()
|
|
92
|
+
.min(1, { message: "Post content cannot be empty" })
|
|
93
|
+
.max(1000, { message: "Post content cannot exceed 1000 characters" })
|
|
94
|
+
.optional()
|
|
87
95
|
.openapi({
|
|
88
96
|
description: "Post content",
|
|
89
97
|
example: "New project announcement",
|
|
90
|
-
})
|
|
91
|
-
.optional(),
|
|
98
|
+
}),
|
|
92
99
|
postType: zod_openapi_1.z
|
|
93
100
|
.enum(constants_1.POST_TYPES)
|
|
94
101
|
.default("DEFAULT_POST")
|
|
95
102
|
.openapi({ description: "Post type", example: "PROJECT" }),
|
|
96
103
|
files: zod_openapi_1.z
|
|
97
104
|
.array(file_1.CreateFileInputSchema.extend({
|
|
98
|
-
order: zod_openapi_1.z
|
|
105
|
+
order: zod_openapi_1.z
|
|
106
|
+
.number()
|
|
107
|
+
.int({ message: "File order must be an integer" })
|
|
108
|
+
.min(1, { message: "File order must be at least 1" })
|
|
109
|
+
.max(20, { message: "File order cannot exceed 20" })
|
|
110
|
+
.default(1),
|
|
99
111
|
}))
|
|
112
|
+
.max(10, { message: "Cannot attach more than 10 files" })
|
|
113
|
+
.optional(),
|
|
114
|
+
tags: zod_openapi_1.z
|
|
115
|
+
.array(zod_openapi_1.z.string().min(1, { message: "Tag cannot be empty" }))
|
|
116
|
+
.max(10, { message: "Cannot add more than 10 tags" })
|
|
100
117
|
.optional(),
|
|
101
|
-
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
|
|
102
118
|
badge: zod_openapi_1.z.enum(constants_1.POST_BADGE_TYPES).optional(),
|
|
103
119
|
linkMeta: zod_openapi_1.z
|
|
104
120
|
.object({
|
|
105
|
-
url: zod_openapi_1.z.url(),
|
|
106
|
-
title: zod_openapi_1.z
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
url: zod_openapi_1.z.string().url({ message: "Invalid URL format" }),
|
|
122
|
+
title: zod_openapi_1.z
|
|
123
|
+
.string()
|
|
124
|
+
.max(200, { message: "Title cannot exceed 200 characters" })
|
|
125
|
+
.optional(),
|
|
126
|
+
description: zod_openapi_1.z
|
|
127
|
+
.string()
|
|
128
|
+
.max(500, { message: "Description cannot exceed 500 characters" })
|
|
129
|
+
.optional(),
|
|
130
|
+
image: zod_openapi_1.z.string().url({ message: "Invalid image URL" }).optional(),
|
|
109
131
|
})
|
|
110
132
|
.optional()
|
|
111
133
|
.openapi({
|
|
@@ -156,10 +178,24 @@ exports.FeedPostEntitySchema = exports.PostWithFilesEntitySchema.extend({
|
|
|
156
178
|
score: zod_openapi_1.z.number(),
|
|
157
179
|
isLiked: zod_openapi_1.z.boolean().optional(),
|
|
158
180
|
isFollowing: zod_openapi_1.z.boolean().optional(),
|
|
159
|
-
isBookmarked: zod_openapi_1.z.boolean().optional()
|
|
181
|
+
isBookmarked: zod_openapi_1.z.boolean().optional(),
|
|
160
182
|
});
|
|
161
183
|
exports.GetFeedInputSchema = zod_openapi_1.z.object({
|
|
162
184
|
limit: zod_openapi_1.z.number().optional(),
|
|
163
185
|
cursor: zod_openapi_1.z.string().optional(),
|
|
164
186
|
});
|
|
165
187
|
exports.GetFeedOutputSchema = zod_openapi_1.z.array(exports.FeedPostEntitySchema);
|
|
188
|
+
exports.SearchPostInputSchema = zod_openapi_1.z.object({
|
|
189
|
+
string: zod_openapi_1.z
|
|
190
|
+
.string()
|
|
191
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
192
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
193
|
+
limit: zod_openapi_1.z
|
|
194
|
+
.number()
|
|
195
|
+
.int({ message: "Limit must be an integer" })
|
|
196
|
+
.min(1, { message: "Limit must be at least 1" })
|
|
197
|
+
.max(100, { message: "Limit cannot exceed 100" })
|
|
198
|
+
.default(20),
|
|
199
|
+
cursor: zod_openapi_1.z.string().optional(),
|
|
200
|
+
});
|
|
201
|
+
exports.SearchPostOutputSchema = zod_openapi_1.z.array(exports.FeedPostEntitySchema);
|
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, LinkPreviewInputSchema, LinkPreviewOutputSchema, PostEntitySchema, PostFileEntitySchema, PostIdSchema, PostWithBookmarksEntitySchema, PostWithCommentsEntitySchema, PostWithFilesEntitySchema, PostWithLikesEntitySchema } from "../schemas/post";
|
|
2
|
+
import { CreatePostInputSchema, CreatePostOutputSchema, FeedPostEntitySchema, GetFeedInputSchema, GetFeedOutputSchema, GetPostOutputSchema, LinkPreviewInputSchema, LinkPreviewOutputSchema, PostEntitySchema, PostFileEntitySchema, PostIdSchema, PostWithBookmarksEntitySchema, PostWithCommentsEntitySchema, PostWithFilesEntitySchema, PostWithLikesEntitySchema, 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>;
|
|
@@ -15,3 +15,5 @@ export type LinkPreviewOutput = z.infer<typeof LinkPreviewOutputSchema>;
|
|
|
15
15
|
export type FeedPostEntity = z.infer<typeof FeedPostEntitySchema>;
|
|
16
16
|
export type GetFeedInput = z.infer<typeof GetFeedInputSchema>;
|
|
17
17
|
export type GetFeedOutput = z.infer<typeof GetFeedOutputSchema>;
|
|
18
|
+
export type SearchPostInput = z.infer<typeof SearchPostInputSchema>;
|
|
19
|
+
export type SearchPostOutput = z.infer<typeof SearchPostOutputSchema>;
|
package/package.json
CHANGED
package/src/schemas/post.ts
CHANGED
|
@@ -15,7 +15,14 @@ export const PostEntitySchema = z.object({
|
|
|
15
15
|
.optional()
|
|
16
16
|
.openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
|
|
17
17
|
|
|
18
|
-
tags: z
|
|
18
|
+
tags: z
|
|
19
|
+
.array(
|
|
20
|
+
z.object({
|
|
21
|
+
name: z.string(),
|
|
22
|
+
id: z.int(),
|
|
23
|
+
})
|
|
24
|
+
)
|
|
25
|
+
.optional(),
|
|
19
26
|
badge: z.enum(POST_BADGE_TYPES).optional(),
|
|
20
27
|
userId: z
|
|
21
28
|
.cuid2()
|
|
@@ -85,35 +92,58 @@ export const PostWithFilesEntitySchema = PostEntitySchema.extend({
|
|
|
85
92
|
|
|
86
93
|
export const CreatePostInputSchema = z.object({
|
|
87
94
|
parentId: z
|
|
88
|
-
.cuid2()
|
|
95
|
+
.cuid2({ message: "Invalid parentId" })
|
|
89
96
|
.optional()
|
|
90
97
|
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
98
|
+
|
|
91
99
|
content: z
|
|
92
100
|
.string()
|
|
101
|
+
.min(1, { message: "Post content cannot be empty" })
|
|
102
|
+
.max(1000, { message: "Post content cannot exceed 1000 characters" })
|
|
103
|
+
.optional()
|
|
93
104
|
.openapi({
|
|
94
105
|
description: "Post content",
|
|
95
106
|
example: "New project announcement",
|
|
96
|
-
})
|
|
97
|
-
|
|
107
|
+
}),
|
|
108
|
+
|
|
98
109
|
postType: z
|
|
99
110
|
.enum(POST_TYPES)
|
|
100
111
|
.default("DEFAULT_POST")
|
|
101
112
|
.openapi({ description: "Post type", example: "PROJECT" }),
|
|
113
|
+
|
|
102
114
|
files: z
|
|
103
115
|
.array(
|
|
104
116
|
CreateFileInputSchema.extend({
|
|
105
|
-
order: z
|
|
117
|
+
order: z
|
|
118
|
+
.number()
|
|
119
|
+
.int({ message: "File order must be an integer" })
|
|
120
|
+
.min(1, { message: "File order must be at least 1" })
|
|
121
|
+
.max(20, { message: "File order cannot exceed 20" })
|
|
122
|
+
.default(1),
|
|
106
123
|
})
|
|
107
124
|
)
|
|
125
|
+
.max(10, { message: "Cannot attach more than 10 files" })
|
|
108
126
|
.optional(),
|
|
109
|
-
|
|
127
|
+
|
|
128
|
+
tags: z
|
|
129
|
+
.array(z.string().min(1, { message: "Tag cannot be empty" }))
|
|
130
|
+
.max(10, { message: "Cannot add more than 10 tags" })
|
|
131
|
+
.optional(),
|
|
132
|
+
|
|
110
133
|
badge: z.enum(POST_BADGE_TYPES).optional(),
|
|
134
|
+
|
|
111
135
|
linkMeta: z
|
|
112
136
|
.object({
|
|
113
|
-
url: z.url(),
|
|
114
|
-
title: z
|
|
115
|
-
|
|
116
|
-
|
|
137
|
+
url: z.string().url({ message: "Invalid URL format" }),
|
|
138
|
+
title: z
|
|
139
|
+
.string()
|
|
140
|
+
.max(200, { message: "Title cannot exceed 200 characters" })
|
|
141
|
+
.optional(),
|
|
142
|
+
description: z
|
|
143
|
+
.string()
|
|
144
|
+
.max(500, { message: "Description cannot exceed 500 characters" })
|
|
145
|
+
.optional(),
|
|
146
|
+
image: z.string().url({ message: "Invalid image URL" }).optional(),
|
|
117
147
|
})
|
|
118
148
|
.optional()
|
|
119
149
|
.openapi({
|
|
@@ -171,7 +201,7 @@ export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
|
|
|
171
201
|
score: z.number(),
|
|
172
202
|
isLiked: z.boolean().optional(),
|
|
173
203
|
isFollowing: z.boolean().optional(),
|
|
174
|
-
isBookmarked: z.boolean().optional()
|
|
204
|
+
isBookmarked: z.boolean().optional(),
|
|
175
205
|
});
|
|
176
206
|
|
|
177
207
|
export const GetFeedInputSchema = z.object({
|
|
@@ -179,4 +209,20 @@ export const GetFeedInputSchema = z.object({
|
|
|
179
209
|
cursor: z.string().optional(),
|
|
180
210
|
});
|
|
181
211
|
|
|
182
|
-
export const GetFeedOutputSchema = z.array(FeedPostEntitySchema)
|
|
212
|
+
export const GetFeedOutputSchema = z.array(FeedPostEntitySchema);
|
|
213
|
+
|
|
214
|
+
export const SearchPostInputSchema = z.object({
|
|
215
|
+
string: z
|
|
216
|
+
.string()
|
|
217
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
218
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
219
|
+
limit: z
|
|
220
|
+
.number()
|
|
221
|
+
.int({ message: "Limit must be an integer" })
|
|
222
|
+
.min(1, { message: "Limit must be at least 1" })
|
|
223
|
+
.max(100, { message: "Limit cannot exceed 100" })
|
|
224
|
+
.default(20),
|
|
225
|
+
cursor: z.string().optional(),
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export const SearchPostOutputSchema = z.array(FeedPostEntitySchema)
|
package/src/types/post.ts
CHANGED
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
PostWithCommentsEntitySchema,
|
|
16
16
|
PostWithFilesEntitySchema,
|
|
17
17
|
PostWithLikesEntitySchema,
|
|
18
|
+
SearchPostInputSchema,
|
|
19
|
+
SearchPostOutputSchema,
|
|
18
20
|
} from "../schemas/post";
|
|
19
21
|
|
|
20
22
|
export type PostEntity = z.infer<typeof PostEntitySchema>;
|
|
@@ -36,3 +38,6 @@ export type LinkPreviewOutput = z.infer<typeof LinkPreviewOutputSchema>;
|
|
|
36
38
|
export type FeedPostEntity = z.infer<typeof FeedPostEntitySchema>;
|
|
37
39
|
export type GetFeedInput = z.infer<typeof GetFeedInputSchema>;
|
|
38
40
|
export type GetFeedOutput = z.infer<typeof GetFeedOutputSchema>;
|
|
41
|
+
|
|
42
|
+
export type SearchPostInput = z.infer<typeof SearchPostInputSchema>;
|
|
43
|
+
export type SearchPostOutput = z.infer<typeof SearchPostOutputSchema>;
|