@zyacreatives/shared 2.1.80 → 2.1.82

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.
@@ -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
- totalNo: z.ZodNumber;
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>;
@@ -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
- totalNo: zod_openapi_1.z.number().int(),
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({
@@ -442,3 +442,61 @@ export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
442
442
  }>;
443
443
  }, z.core.$strip>>;
444
444
  }, z.core.$strip>;
445
+ export declare const GetProjectWithCommentsOutputSchema: z.ZodObject<{
446
+ id: z.ZodString;
447
+ description: z.ZodOptional<z.ZodString>;
448
+ title: z.ZodString;
449
+ imagePlaceholderUrl: z.ZodString;
450
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
451
+ startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
452
+ endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
453
+ comments: z.ZodArray<z.ZodObject<{
454
+ id: z.ZodCUID2;
455
+ userId: z.ZodCUID2;
456
+ parentId: z.ZodCUID2;
457
+ parentType: z.ZodEnum<{
458
+ readonly PROJECT: "PROJECT";
459
+ readonly USER: "USER";
460
+ readonly JOB: "JOB";
461
+ readonly POST: "POST";
462
+ readonly COMMENT: "COMMENT";
463
+ readonly JOB_APPLICATION: "JOB_APPLICATION";
464
+ }>;
465
+ content: z.ZodString;
466
+ commenterUsername: z.ZodOptional<z.ZodString>;
467
+ commenterName: z.ZodOptional<z.ZodString>;
468
+ commenterImageUrl: z.ZodOptional<z.ZodString>;
469
+ replyToId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
470
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
471
+ isLiked: z.ZodDefault<z.ZodBoolean>;
472
+ likesCount: z.ZodDefault<z.ZodInt>;
473
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
474
+ }, z.core.$strip>>;
475
+ nextCursor: z.ZodOptional<z.ZodString>;
476
+ }, z.core.$strip>;
477
+ export declare const GetProjectWithLikesOutputSchema: z.ZodObject<{
478
+ id: z.ZodString;
479
+ description: z.ZodOptional<z.ZodString>;
480
+ title: z.ZodString;
481
+ imagePlaceholderUrl: z.ZodString;
482
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
483
+ startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
484
+ endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
485
+ likes: z.ZodArray<z.ZodObject<{
486
+ id: z.ZodCUID2;
487
+ type: z.ZodEnum<{
488
+ readonly LIKE: "LIKE";
489
+ readonly UNLIKE: "UNLIKE";
490
+ readonly BOOKMARK: "BOOKMARK";
491
+ readonly UNBOOKMARK: "UNBOOKMARK";
492
+ readonly VIEW: "VIEW";
493
+ }>;
494
+ actorName: z.ZodString;
495
+ actorId: z.ZodString;
496
+ actorUsername: z.ZodString;
497
+ actorImageUrl: z.ZodOptional<z.ZodURL>;
498
+ followsYou: z.ZodOptional<z.ZodBoolean>;
499
+ isFollowing: z.ZodOptional<z.ZodBoolean>;
500
+ }, z.core.$strip>>;
501
+ nextCursor: z.ZodOptional<z.ZodString>;
502
+ }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.SearchProjectsOutputSchema = exports.SearchProjectsInputSchema = exports.MinimalProjectSchema = exports.ProjectIdSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.ProjectDetailsEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.ProjectEntitySchema = void 0;
3
+ exports.GetProjectWithLikesOutputSchema = exports.GetProjectWithCommentsOutputSchema = exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.SearchProjectsOutputSchema = exports.SearchProjectsInputSchema = exports.MinimalProjectSchema = exports.ProjectIdSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.ProjectDetailsEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.ProjectEntitySchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  const file_1 = require("./file");
@@ -265,3 +265,9 @@ exports.ProjectWithProjectBookmarksEntitySchema = exports.MinimalProjectSchema.e
265
265
  }).openapi({
266
266
  title: "ProjectWithProjectBookmarksEntity",
267
267
  });
268
+ exports.GetProjectWithCommentsOutputSchema = exports.ProjectWithProjectCommentsEntitySchema.extend({
269
+ nextCursor: zod_openapi_1.z.string().optional(),
270
+ });
271
+ exports.GetProjectWithLikesOutputSchema = exports.ProjectWithLikesEntitySchema.extend({
272
+ nextCursor: zod_openapi_1.z.string().optional(),
273
+ });
@@ -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>;
@@ -1,5 +1,5 @@
1
1
  import type { z } from "@hono/zod-openapi";
2
- import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema, ProjectDetailsEntitySchema, ProjectWithProjectViewsEntitySchema, ProjectWithProjectCommentsEntitySchema, ProjectWithLikesEntitySchema, ProjectWithProjectBookmarksEntitySchema, CreateProjectInputSchema, CreateProjectOutputSchema, UpdateProjectInputSchema, UpdateProjectOutputSchema, DeleteProjectOutputSchema, GetProjectOutputSchema, SearchProjectsInputSchema, SearchProjectsOutputSchema } from "../schemas/project";
2
+ import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema, ProjectDetailsEntitySchema, ProjectWithProjectViewsEntitySchema, ProjectWithProjectCommentsEntitySchema, ProjectWithLikesEntitySchema, ProjectWithProjectBookmarksEntitySchema, CreateProjectInputSchema, CreateProjectOutputSchema, UpdateProjectInputSchema, UpdateProjectOutputSchema, DeleteProjectOutputSchema, GetProjectOutputSchema, SearchProjectsInputSchema, SearchProjectsOutputSchema, GetProjectWithLikesOutputSchema, GetProjectWithCommentsOutputSchema } from "../schemas/project";
3
3
  import { ViewEntitySchema } from "../schemas/view";
4
4
  import { LikeEntitySchema } from "../schemas/like";
5
5
  import { CommentEntitySchema } from "../schemas/comment";
@@ -23,3 +23,5 @@ export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
23
23
  export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
24
24
  export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
25
25
  export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;
26
+ export type GetProjectWithCommentsOutput = z.infer<typeof GetProjectWithCommentsOutputSchema>;
27
+ export type GetProjectWithLikesOutput = z.infer<typeof GetProjectWithLikesOutputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.80",
3
+ "version": "2.1.82",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,8 +1,8 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  import {
3
- ACTIVITY_PARENT_TYPES,
4
- POST_BADGE_TYPES,
5
- POST_TYPES,
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
- 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
21
- .enum(ACTIVITY_PARENT_TYPES)
22
- .default(ACTIVITY_PARENT_TYPES.POST),
23
- tags: z
24
- .array(
25
- z.object({
26
- name: z.string(),
27
- id: z.int(),
28
- }),
29
- )
30
- .optional(),
31
- badge: z.enum(POST_BADGE_TYPES).optional(),
32
- userId: z
33
- .cuid2()
34
- .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
35
- creatorUsername: z.string().optional().openapi({ description: "Username" }),
36
- creatorFullName: z.string().optional(),
37
- creatorImageUrl: z.cuid2().optional().openapi({ description: "Username" }),
38
- content: z
39
- .string()
40
- .optional()
41
- .openapi({ description: "Post content", example: "Hello world" }),
42
- postType: z.enum(POST_TYPES).openapi({
43
- description: "Type of the post entity this statistic belongs to.",
44
- title: "Post Type",
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
- .object({
70
- id: z
71
- .string()
72
- .openapi({ description: "CUID2 of the project file record." }),
73
- postId: z.string().openapi({
74
- description: "CUID2 of the post this file belongs to.",
75
- }),
76
- fileId: z
77
- .string()
78
- .openapi({ description: "CUID2 of the linked file." }),
79
- order: z.number().int().openapi({
80
- description: "Order index of the file in the project.",
81
- example: 1,
82
- }),
83
- })
84
- .openapi({
85
- title: "Post File Entity",
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
- postFiles: z
91
- .array(
92
- PostFileEntitySchema.extend({
93
- url: z.url(),
94
- }),
95
- )
96
- .optional()
97
- .openapi({ description: "Files associated with the project." }),
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
- id: z.cuid2(),
102
- parentId: z
103
- .cuid2({ message: "Invalid parentId" })
104
- .optional()
105
- .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
106
- parentType: z
107
- .enum(ACTIVITY_PARENT_TYPES)
108
- .default(ACTIVITY_PARENT_TYPES.POST),
109
- content: z
110
- .string()
111
- .max(500, { message: "Post content cannot exceed 500 characters" })
112
- .optional()
113
- .openapi({
114
- description: "Post content",
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
- tags: z
138
- .array(z.string().min(1, { message: "Tag cannot be empty" }))
139
- .max(3, { message: "Cannot add more than 3 tags" })
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
- badge: z.enum(POST_BADGE_TYPES).optional(),
142
- linkMeta: z
143
- .object({
144
- url: z.url({ message: "Invalid URL format" }),
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
- .openapi({
159
- description: "Optional metadata for a single link in the post",
160
- example: {
161
- url: "https://example.com",
162
- title: "Example Website",
163
- description: "This is an example link",
164
- image: "https://example.com/preview.jpg",
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
- id: true,
174
- parentId: true,
175
- content: true,
167
+ id: true,
168
+ parentId: true,
169
+ content: true,
176
170
  });
177
171
 
178
172
  export const PostWithLikesEntitySchema = MinimalPostSchema.extend({
179
- likes: z.array(
180
- ActivitySchema.extend({
181
- followsYou: z.boolean().optional(),
182
- isFollowing: z.boolean().optional(),
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
- title: "PostWithPostLikesEntity",
180
+ title: "PostWithPostLikesEntity",
187
181
  });
188
182
 
189
183
  export const GetPostWithLikesOutputSchema = PostWithLikesEntitySchema.extend({
190
- totalNo: z.number().int(),
184
+ nextCursor: z.string().optional(),
191
185
  });
192
186
 
193
187
  export const PostWithCommentsEntitySchema = MinimalPostSchema.extend({
194
- comments: z.array(CommentEntitySchema),
188
+ comments: z.array(CommentEntitySchema),
195
189
  }).openapi({
196
- title: "PostWithPostCommentsEntity",
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
- bookmarks: z.array(ActivitySchema),
199
+ bookmarks: z.array(ActivitySchema),
201
200
  }).openapi({
202
- title: "PostWithPostBookmarksEntity",
201
+ title: "PostWithPostBookmarksEntity",
203
202
  });
204
203
 
205
204
  export const GetPostWithBookmarksOutputSchema =
206
- PostWithBookmarksEntitySchema.extend({
207
- totalNo: z.number().int(),
208
- });
205
+ PostWithBookmarksEntitySchema.extend({
206
+ totalNo: z.number().int(),
207
+ });
209
208
 
210
209
  export const LinkPreviewInputSchema = z.object({
211
- url: z.string(),
210
+ url: z.string(),
212
211
  });
213
212
 
214
213
  export const LinkPreviewOutputSchema = z.object({
215
- title: z.string(),
216
- description: z.string().optional(),
217
- image: z.string().optional(),
218
- url: z.string().optional(),
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
- stats: EntityStatsSchema,
223
- score: z.number(),
224
- isLiked: z.boolean().optional(),
225
- isFollowing: z.boolean().optional(),
226
- isBookmarked: z.boolean().optional(),
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
- limit: z.number().optional(),
231
- cursor: z.string().optional(),
229
+ limit: z.number().optional(),
230
+ cursor: z.string().optional(),
232
231
  });
233
232
 
234
233
  export const GetFeedOutputSchema = z.object({
235
- feed: z.array(FeedPostEntitySchema),
236
- nextCursor: z.string().optional().nullable(),
234
+ feed: z.array(FeedPostEntitySchema),
235
+ nextCursor: z.string().optional().nullable(),
237
236
  });
238
237
 
239
238
  export const SearchPostInputSchema = z.object({
240
- queryString: z
241
- .string()
242
- .min(1, { message: "Search string cannot be empty" })
243
- .max(200, { message: "Search string cannot exceed 200 characters" }),
244
- cursor: z.string().optional(),
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
- posts: z.array(FeedPostEntitySchema),
249
- nextCursor: z.string().optional().nullable(),
247
+ posts: z.array(FeedPostEntitySchema),
248
+ nextCursor: z.string().optional().nullable(),
250
249
  });
251
250
 
252
251
  export const ReportPostInputSchema = z.object({
253
- complaint: z
254
- .string()
255
- .max(200, { error: "Complaint cannot be longer than 200 characters" }),
252
+ complaint: z
253
+ .string()
254
+ .max(200, { error: "Complaint cannot be longer than 200 characters" }),
256
255
  });
@@ -286,3 +286,13 @@ export const ProjectWithProjectBookmarksEntitySchema =
286
286
  }).openapi({
287
287
  title: "ProjectWithProjectBookmarksEntity",
288
288
  });
289
+
290
+ export const GetProjectWithCommentsOutputSchema =
291
+ ProjectWithProjectCommentsEntitySchema.extend({
292
+ nextCursor: z.string().optional(),
293
+ });
294
+
295
+ export const GetProjectWithLikesOutputSchema =
296
+ ProjectWithLikesEntitySchema.extend({
297
+ nextCursor: z.string().optional(),
298
+ });
package/src/types/post.ts CHANGED
@@ -1,25 +1,26 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  import {
3
- CreatePostInputSchema,
4
- CreatePostOutputSchema,
5
- FeedPostEntitySchema,
6
- GetFeedInputSchema,
7
- GetFeedOutputSchema,
8
- GetPostOutputSchema,
9
- GetPostWithBookmarksOutputSchema,
10
- GetPostWithLikesOutputSchema,
11
- LinkPreviewInputSchema,
12
- LinkPreviewOutputSchema,
13
- PostEntitySchema,
14
- PostFileEntitySchema,
15
- PostIdSchema,
16
- PostWithBookmarksEntitySchema,
17
- PostWithCommentsEntitySchema,
18
- PostWithFilesEntitySchema,
19
- PostWithLikesEntitySchema,
20
- ReportPostInputSchema,
21
- SearchPostInputSchema,
22
- SearchPostOutputSchema,
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
- typeof PostWithBookmarksEntitySchema
33
+ typeof PostWithBookmarksEntitySchema
33
34
  >;
34
35
  export type PostIdInput = z.infer<typeof PostIdSchema>;
35
36
  export type PostWithPostCommentsEntity = z.infer<
36
- typeof PostWithCommentsEntitySchema
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
- typeof GetPostWithLikesOutputSchema
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
- typeof GetPostWithBookmarksOutputSchema
58
+ typeof GetPostWithBookmarksOutputSchema
53
59
  >;
54
60
  export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
@@ -17,6 +17,8 @@ import type {
17
17
  GetProjectOutputSchema,
18
18
  SearchProjectsInputSchema,
19
19
  SearchProjectsOutputSchema,
20
+ GetProjectWithLikesOutputSchema,
21
+ GetProjectWithCommentsOutputSchema,
20
22
  } from "../schemas/project";
21
23
  import { ViewEntitySchema } from "../schemas/view";
22
24
  import { LikeEntitySchema } from "../schemas/like";
@@ -54,3 +56,11 @@ export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
54
56
  export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
55
57
  export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
56
58
  export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;
59
+
60
+ export type GetProjectWithCommentsOutput = z.infer<
61
+ typeof GetProjectWithCommentsOutputSchema
62
+ >;
63
+
64
+ export type GetProjectWithLikesOutput = z.infer<
65
+ typeof GetProjectWithLikesOutputSchema
66
+ >;