@zyacreatives/shared 2.0.53 → 2.0.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/schemas/post.d.ts +137 -63
- package/dist/schemas/post.js +48 -11
- package/dist/types/post.d.ts +3 -1
- package/package.json +1 -1
- package/src/schemas/post.ts +55 -10
- package/src/types/post.ts +5 -0
package/dist/schemas/post.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ export declare const CreatePostInputSchema: z.ZodObject<{
|
|
|
105
105
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
106
|
key: z.ZodString;
|
|
107
107
|
mimeType: z.ZodString;
|
|
108
|
-
order: z.ZodDefault<z.
|
|
108
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
109
109
|
}, z.core.$strip>>>;
|
|
110
110
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
111
|
badge: z.ZodOptional<z.ZodEnum<{
|
|
@@ -119,10 +119,10 @@ export declare const CreatePostInputSchema: z.ZodObject<{
|
|
|
119
119
|
readonly MENTORSHIP: "Mentorship";
|
|
120
120
|
}>>;
|
|
121
121
|
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
122
|
-
url: z.
|
|
122
|
+
url: z.ZodString;
|
|
123
123
|
title: z.ZodOptional<z.ZodString>;
|
|
124
124
|
description: z.ZodOptional<z.ZodString>;
|
|
125
|
-
image: z.ZodOptional<z.
|
|
125
|
+
image: z.ZodOptional<z.ZodString>;
|
|
126
126
|
}, z.core.$strip>>;
|
|
127
127
|
}, z.core.$strip>;
|
|
128
128
|
export declare const CreatePostOutputSchema: z.ZodObject<{
|
|
@@ -345,66 +345,140 @@ export declare const GetFeedInputSchema: z.ZodObject<{
|
|
|
345
345
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
346
346
|
cursor: z.ZodOptional<z.ZodString>;
|
|
347
347
|
}, z.core.$strip>;
|
|
348
|
-
export declare const GetFeedOutputSchema: z.
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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>>;
|
|
348
|
+
export declare const GetFeedOutputSchema: z.ZodObject<{
|
|
349
|
+
feed: z.ZodArray<z.ZodObject<{
|
|
350
|
+
id: z.ZodCUID2;
|
|
351
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
352
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
353
|
+
name: z.ZodString;
|
|
354
|
+
id: z.ZodInt;
|
|
355
|
+
}, z.core.$strip>>>;
|
|
356
|
+
badge: z.ZodOptional<z.ZodEnum<{
|
|
357
|
+
readonly NETWORKING: "Networking";
|
|
358
|
+
readonly FUNDING: "Funding";
|
|
359
|
+
readonly COLLABORATION: "Collaboration";
|
|
360
|
+
readonly OPPORTUNITIES: "Opportunities";
|
|
361
|
+
readonly SHOWCASE: "Showcase";
|
|
362
|
+
readonly LEARNING: "Learning";
|
|
363
|
+
readonly DISCUSSION: "Discussion";
|
|
364
|
+
readonly MENTORSHIP: "Mentorship";
|
|
365
|
+
}>>;
|
|
366
|
+
userId: z.ZodCUID2;
|
|
367
|
+
creatorUsername: z.ZodOptional<z.ZodString>;
|
|
368
|
+
creatorFullName: z.ZodOptional<z.ZodString>;
|
|
369
|
+
creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
|
|
370
|
+
content: z.ZodOptional<z.ZodString>;
|
|
371
|
+
postType: z.ZodEnum<{
|
|
372
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
373
|
+
readonly PROJECT: "PROJECT";
|
|
374
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
375
|
+
readonly DEFAULT_POST: "DEFAULT_POST";
|
|
376
|
+
readonly POST_WITH_LINKS: "POST_WITH_LINKS";
|
|
377
|
+
readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
|
|
378
|
+
readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
|
|
379
|
+
}>;
|
|
395
380
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
396
|
-
|
|
397
|
-
|
|
381
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
382
|
+
url: z.ZodURL;
|
|
383
|
+
title: z.ZodOptional<z.ZodString>;
|
|
384
|
+
description: z.ZodOptional<z.ZodString>;
|
|
385
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
386
|
+
}, z.core.$strip>>;
|
|
387
|
+
postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
388
|
+
id: z.ZodString;
|
|
389
|
+
postId: z.ZodString;
|
|
390
|
+
fileId: z.ZodString;
|
|
391
|
+
order: z.ZodNumber;
|
|
392
|
+
url: z.ZodURL;
|
|
393
|
+
}, z.core.$strip>>>;
|
|
394
|
+
stats: z.ZodObject<{
|
|
395
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
396
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
397
|
+
parentId: z.ZodCUID2;
|
|
398
|
+
parentType: z.ZodEnum<{
|
|
399
|
+
readonly PROJECT: "PROJECT";
|
|
400
|
+
readonly POST: "POST";
|
|
401
|
+
}>;
|
|
402
|
+
likesCount: z.ZodNumber;
|
|
403
|
+
bookmarksCount: z.ZodNumber;
|
|
404
|
+
viewsCount: z.ZodNumber;
|
|
405
|
+
commentsCount: z.ZodNumber;
|
|
406
|
+
}, z.core.$strip>;
|
|
407
|
+
score: z.ZodNumber;
|
|
408
|
+
isLiked: z.ZodOptional<z.ZodBoolean>;
|
|
409
|
+
isFollowing: z.ZodOptional<z.ZodBoolean>;
|
|
410
|
+
isBookmarked: z.ZodOptional<z.ZodBoolean>;
|
|
411
|
+
}, z.core.$strip>>;
|
|
412
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
413
|
+
}, z.core.$strip>;
|
|
414
|
+
export declare const SearchPostInputSchema: z.ZodObject<{
|
|
415
|
+
string: z.ZodString;
|
|
416
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
417
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
418
|
+
}, z.core.$strip>;
|
|
419
|
+
export declare const SearchPostOutputSchema: z.ZodObject<{
|
|
420
|
+
posts: z.ZodArray<z.ZodObject<{
|
|
421
|
+
id: z.ZodCUID2;
|
|
422
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
423
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
424
|
+
name: z.ZodString;
|
|
425
|
+
id: z.ZodInt;
|
|
426
|
+
}, z.core.$strip>>>;
|
|
427
|
+
badge: z.ZodOptional<z.ZodEnum<{
|
|
428
|
+
readonly NETWORKING: "Networking";
|
|
429
|
+
readonly FUNDING: "Funding";
|
|
430
|
+
readonly COLLABORATION: "Collaboration";
|
|
431
|
+
readonly OPPORTUNITIES: "Opportunities";
|
|
432
|
+
readonly SHOWCASE: "Showcase";
|
|
433
|
+
readonly LEARNING: "Learning";
|
|
434
|
+
readonly DISCUSSION: "Discussion";
|
|
435
|
+
readonly MENTORSHIP: "Mentorship";
|
|
436
|
+
}>>;
|
|
437
|
+
userId: z.ZodCUID2;
|
|
438
|
+
creatorUsername: z.ZodOptional<z.ZodString>;
|
|
439
|
+
creatorFullName: z.ZodOptional<z.ZodString>;
|
|
440
|
+
creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
|
|
441
|
+
content: z.ZodOptional<z.ZodString>;
|
|
442
|
+
postType: z.ZodEnum<{
|
|
443
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
398
444
|
readonly PROJECT: "PROJECT";
|
|
399
|
-
readonly
|
|
445
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
446
|
+
readonly DEFAULT_POST: "DEFAULT_POST";
|
|
447
|
+
readonly POST_WITH_LINKS: "POST_WITH_LINKS";
|
|
448
|
+
readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
|
|
449
|
+
readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
|
|
400
450
|
}>;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
451
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
452
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
453
|
+
url: z.ZodURL;
|
|
454
|
+
title: z.ZodOptional<z.ZodString>;
|
|
455
|
+
description: z.ZodOptional<z.ZodString>;
|
|
456
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
457
|
+
}, z.core.$strip>>;
|
|
458
|
+
postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
459
|
+
id: z.ZodString;
|
|
460
|
+
postId: z.ZodString;
|
|
461
|
+
fileId: z.ZodString;
|
|
462
|
+
order: z.ZodNumber;
|
|
463
|
+
url: z.ZodURL;
|
|
464
|
+
}, z.core.$strip>>>;
|
|
465
|
+
stats: z.ZodObject<{
|
|
466
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
467
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
468
|
+
parentId: z.ZodCUID2;
|
|
469
|
+
parentType: z.ZodEnum<{
|
|
470
|
+
readonly PROJECT: "PROJECT";
|
|
471
|
+
readonly POST: "POST";
|
|
472
|
+
}>;
|
|
473
|
+
likesCount: z.ZodNumber;
|
|
474
|
+
bookmarksCount: z.ZodNumber;
|
|
475
|
+
viewsCount: z.ZodNumber;
|
|
476
|
+
commentsCount: z.ZodNumber;
|
|
477
|
+
}, z.core.$strip>;
|
|
478
|
+
score: z.ZodNumber;
|
|
479
|
+
isLiked: z.ZodOptional<z.ZodBoolean>;
|
|
480
|
+
isFollowing: z.ZodOptional<z.ZodBoolean>;
|
|
481
|
+
isBookmarked: z.ZodOptional<z.ZodBoolean>;
|
|
482
|
+
}, z.core.$strip>>;
|
|
483
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
484
|
+
}, z.core.$strip>;
|
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");
|
|
@@ -84,33 +84,50 @@ exports.PostWithFilesEntitySchema = exports.PostEntitySchema.extend({
|
|
|
84
84
|
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
85
85
|
exports.CreatePostInputSchema = zod_openapi_1.z.object({
|
|
86
86
|
parentId: zod_openapi_1.z
|
|
87
|
-
.cuid2()
|
|
87
|
+
.cuid2({ message: "Invalid parentId" })
|
|
88
88
|
.optional()
|
|
89
89
|
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
90
90
|
content: zod_openapi_1.z
|
|
91
91
|
.string()
|
|
92
|
+
.min(1, { message: "Post content cannot be empty" })
|
|
93
|
+
.max(1000, { message: "Post content cannot exceed 1000 characters" })
|
|
94
|
+
.optional()
|
|
92
95
|
.openapi({
|
|
93
96
|
description: "Post content",
|
|
94
97
|
example: "New project announcement",
|
|
95
|
-
})
|
|
96
|
-
.optional(),
|
|
98
|
+
}),
|
|
97
99
|
postType: zod_openapi_1.z
|
|
98
100
|
.enum(constants_1.POST_TYPES)
|
|
99
101
|
.default("DEFAULT_POST")
|
|
100
102
|
.openapi({ description: "Post type", example: "PROJECT" }),
|
|
101
103
|
files: zod_openapi_1.z
|
|
102
104
|
.array(file_1.CreateFileInputSchema.extend({
|
|
103
|
-
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),
|
|
104
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" })
|
|
105
117
|
.optional(),
|
|
106
|
-
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
|
|
107
118
|
badge: zod_openapi_1.z.enum(constants_1.POST_BADGE_TYPES).optional(),
|
|
108
119
|
linkMeta: zod_openapi_1.z
|
|
109
120
|
.object({
|
|
110
|
-
url: zod_openapi_1.z.url(),
|
|
111
|
-
title: zod_openapi_1.z
|
|
112
|
-
|
|
113
|
-
|
|
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(),
|
|
114
131
|
})
|
|
115
132
|
.optional()
|
|
116
133
|
.openapi({
|
|
@@ -167,4 +184,24 @@ exports.GetFeedInputSchema = zod_openapi_1.z.object({
|
|
|
167
184
|
limit: zod_openapi_1.z.number().optional(),
|
|
168
185
|
cursor: zod_openapi_1.z.string().optional(),
|
|
169
186
|
});
|
|
170
|
-
exports.GetFeedOutputSchema = zod_openapi_1.z.
|
|
187
|
+
exports.GetFeedOutputSchema = zod_openapi_1.z.object({
|
|
188
|
+
feed: zod_openapi_1.z.array(exports.FeedPostEntitySchema),
|
|
189
|
+
nextCursor: zod_openapi_1.z.string().optional(),
|
|
190
|
+
});
|
|
191
|
+
exports.SearchPostInputSchema = zod_openapi_1.z.object({
|
|
192
|
+
string: zod_openapi_1.z
|
|
193
|
+
.string()
|
|
194
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
195
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
196
|
+
limit: zod_openapi_1.z
|
|
197
|
+
.number()
|
|
198
|
+
.int({ message: "Limit must be an integer" })
|
|
199
|
+
.min(1, { message: "Limit must be at least 1" })
|
|
200
|
+
.max(100, { message: "Limit cannot exceed 100" })
|
|
201
|
+
.default(20),
|
|
202
|
+
cursor: zod_openapi_1.z.string().optional(),
|
|
203
|
+
});
|
|
204
|
+
exports.SearchPostOutputSchema = zod_openapi_1.z.object({
|
|
205
|
+
posts: zod_openapi_1.z.array(exports.FeedPostEntitySchema),
|
|
206
|
+
nextCursor: zod_openapi_1.z.string().optional(),
|
|
207
|
+
});
|
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
|
@@ -92,35 +92,58 @@ export const PostWithFilesEntitySchema = PostEntitySchema.extend({
|
|
|
92
92
|
|
|
93
93
|
export const CreatePostInputSchema = z.object({
|
|
94
94
|
parentId: z
|
|
95
|
-
.cuid2()
|
|
95
|
+
.cuid2({ message: "Invalid parentId" })
|
|
96
96
|
.optional()
|
|
97
97
|
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
98
|
+
|
|
98
99
|
content: z
|
|
99
100
|
.string()
|
|
101
|
+
.min(1, { message: "Post content cannot be empty" })
|
|
102
|
+
.max(1000, { message: "Post content cannot exceed 1000 characters" })
|
|
103
|
+
.optional()
|
|
100
104
|
.openapi({
|
|
101
105
|
description: "Post content",
|
|
102
106
|
example: "New project announcement",
|
|
103
|
-
})
|
|
104
|
-
|
|
107
|
+
}),
|
|
108
|
+
|
|
105
109
|
postType: z
|
|
106
110
|
.enum(POST_TYPES)
|
|
107
111
|
.default("DEFAULT_POST")
|
|
108
112
|
.openapi({ description: "Post type", example: "PROJECT" }),
|
|
113
|
+
|
|
109
114
|
files: z
|
|
110
115
|
.array(
|
|
111
116
|
CreateFileInputSchema.extend({
|
|
112
|
-
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),
|
|
113
123
|
})
|
|
114
124
|
)
|
|
125
|
+
.max(10, { message: "Cannot attach more than 10 files" })
|
|
126
|
+
.optional(),
|
|
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" })
|
|
115
131
|
.optional(),
|
|
116
|
-
|
|
132
|
+
|
|
117
133
|
badge: z.enum(POST_BADGE_TYPES).optional(),
|
|
134
|
+
|
|
118
135
|
linkMeta: z
|
|
119
136
|
.object({
|
|
120
|
-
url: z.url(),
|
|
121
|
-
title: z
|
|
122
|
-
|
|
123
|
-
|
|
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(),
|
|
124
147
|
})
|
|
125
148
|
.optional()
|
|
126
149
|
.openapi({
|
|
@@ -186,4 +209,26 @@ export const GetFeedInputSchema = z.object({
|
|
|
186
209
|
cursor: z.string().optional(),
|
|
187
210
|
});
|
|
188
211
|
|
|
189
|
-
export const GetFeedOutputSchema = z.
|
|
212
|
+
export const GetFeedOutputSchema = z.object({
|
|
213
|
+
feed: z.array(FeedPostEntitySchema),
|
|
214
|
+
nextCursor: z.string().optional(),
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export const SearchPostInputSchema = z.object({
|
|
218
|
+
string: z
|
|
219
|
+
.string()
|
|
220
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
221
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
222
|
+
limit: z
|
|
223
|
+
.number()
|
|
224
|
+
.int({ message: "Limit must be an integer" })
|
|
225
|
+
.min(1, { message: "Limit must be at least 1" })
|
|
226
|
+
.max(100, { message: "Limit cannot exceed 100" })
|
|
227
|
+
.default(20),
|
|
228
|
+
cursor: z.string().optional(),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
export const SearchPostOutputSchema = z.object({
|
|
232
|
+
posts: z.array(FeedPostEntitySchema),
|
|
233
|
+
nextCursor: z.string().optional(),
|
|
234
|
+
});
|
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>;
|