@zyacreatives/shared 2.1.65 → 2.1.67

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.
@@ -612,3 +612,6 @@ export declare const SearchPostOutputSchema: z.ZodObject<{
612
612
  }, z.core.$strip>>;
613
613
  nextCursor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
614
614
  }, z.core.$strip>;
615
+ export declare const ReportPostInputSchema: z.ZodObject<{
616
+ complaint: z.ZodString;
617
+ }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.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,7 +15,9 @@ 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.enum(constants_1.ACTIVITY_PARENT_TYPES).default(constants_1.ACTIVITY_PARENT_TYPES.POST),
18
+ parentType: zod_openapi_1.z
19
+ .enum(constants_1.ACTIVITY_PARENT_TYPES)
20
+ .default(constants_1.ACTIVITY_PARENT_TYPES.POST),
19
21
  tags: zod_openapi_1.z
20
22
  .array(zod_openapi_1.z.object({
21
23
  name: zod_openapi_1.z.string(),
@@ -64,7 +66,9 @@ exports.PostFileEntitySchema = zod_openapi_1.z
64
66
  postId: zod_openapi_1.z.string().openapi({
65
67
  description: "CUID2 of the post this file belongs to.",
66
68
  }),
67
- fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
69
+ fileId: zod_openapi_1.z
70
+ .string()
71
+ .openapi({ description: "CUID2 of the linked file." }),
68
72
  order: zod_openapi_1.z.number().int().openapi({
69
73
  description: "Order index of the file in the project.",
70
74
  example: 1,
@@ -88,7 +92,9 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
88
92
  .cuid2({ message: "Invalid parentId" })
89
93
  .optional()
90
94
  .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
91
- parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).default(constants_1.ACTIVITY_PARENT_TYPES.POST),
95
+ parentType: zod_openapi_1.z
96
+ .enum(constants_1.ACTIVITY_PARENT_TYPES)
97
+ .default(constants_1.ACTIVITY_PARENT_TYPES.POST),
92
98
  content: zod_openapi_1.z
93
99
  .string()
94
100
  .max(500, { message: "Post content cannot exceed 500 characters" })
@@ -125,7 +131,9 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
125
131
  .optional(),
126
132
  description: zod_openapi_1.z
127
133
  .string()
128
- .max(500, { message: "Description cannot exceed 500 characters" })
134
+ .max(500, {
135
+ message: "Description cannot exceed 500 characters",
136
+ })
129
137
  .optional(),
130
138
  image: zod_openapi_1.z.url({ message: "Invalid image URL" }).optional(),
131
139
  })
@@ -205,3 +213,8 @@ exports.SearchPostOutputSchema = zod_openapi_1.z.object({
205
213
  posts: zod_openapi_1.z.array(exports.FeedPostEntitySchema),
206
214
  nextCursor: zod_openapi_1.z.string().optional().nullable(),
207
215
  });
216
+ exports.ReportPostInputSchema = zod_openapi_1.z.object({
217
+ complaint: zod_openapi_1.z
218
+ .string()
219
+ .max(200, { error: "Complaint cannot be longer than 200 characters" }),
220
+ });
@@ -348,6 +348,42 @@ export declare const UserWithFollowersEntitySchema: z.ZodObject<{
348
348
  followsYou: z.ZodOptional<z.ZodBoolean>;
349
349
  }, z.core.$strip>>;
350
350
  }, z.core.$strip>;
351
+ export declare const GetUserFollowersOutputSchema: z.ZodObject<{
352
+ nextCursor: z.ZodString;
353
+ followers: z.ZodArray<z.ZodObject<{
354
+ email: z.ZodEmail;
355
+ username: z.ZodOptional<z.ZodString>;
356
+ id: z.ZodCUID2;
357
+ name: z.ZodOptional<z.ZodString>;
358
+ image: z.ZodOptional<z.ZodString>;
359
+ role: z.ZodEnum<{
360
+ CREATIVE: "CREATIVE";
361
+ BRAND: "BRAND";
362
+ INVESTOR: "INVESTOR";
363
+ ADMIN: "ADMIN";
364
+ }>;
365
+ isFollowing: z.ZodOptional<z.ZodBoolean>;
366
+ followsYou: z.ZodOptional<z.ZodBoolean>;
367
+ }, z.core.$strip>>;
368
+ }, z.core.$strip>;
369
+ export declare const GetUserFollowingOutputSchema: z.ZodObject<{
370
+ nextCursor: z.ZodString;
371
+ following: z.ZodArray<z.ZodObject<{
372
+ email: z.ZodEmail;
373
+ username: z.ZodOptional<z.ZodString>;
374
+ id: z.ZodCUID2;
375
+ name: z.ZodOptional<z.ZodString>;
376
+ image: z.ZodOptional<z.ZodString>;
377
+ role: z.ZodEnum<{
378
+ CREATIVE: "CREATIVE";
379
+ BRAND: "BRAND";
380
+ INVESTOR: "INVESTOR";
381
+ ADMIN: "ADMIN";
382
+ }>;
383
+ isFollowing: z.ZodOptional<z.ZodBoolean>;
384
+ followsYou: z.ZodOptional<z.ZodBoolean>;
385
+ }, z.core.$strip>>;
386
+ }, z.core.$strip>;
351
387
  export declare const UserWithPostsEntitySchema: z.ZodObject<{
352
388
  userId: z.ZodCUID2;
353
389
  posts: z.ZodArray<z.ZodObject<{
@@ -405,66 +441,6 @@ export declare const UserWithPostsEntitySchema: z.ZodObject<{
405
441
  }, z.core.$strip>>>;
406
442
  }, z.core.$strip>>;
407
443
  }, z.core.$strip>;
408
- export declare const GetUserFollowingOutputSchema: z.ZodObject<{
409
- results: z.ZodObject<{
410
- email: z.ZodEmail;
411
- username: z.ZodOptional<z.ZodString>;
412
- id: z.ZodCUID2;
413
- name: z.ZodOptional<z.ZodString>;
414
- image: z.ZodOptional<z.ZodString>;
415
- role: z.ZodEnum<{
416
- CREATIVE: "CREATIVE";
417
- BRAND: "BRAND";
418
- INVESTOR: "INVESTOR";
419
- ADMIN: "ADMIN";
420
- }>;
421
- following: z.ZodArray<z.ZodObject<{
422
- email: z.ZodEmail;
423
- username: z.ZodOptional<z.ZodString>;
424
- id: z.ZodCUID2;
425
- name: z.ZodOptional<z.ZodString>;
426
- image: z.ZodOptional<z.ZodString>;
427
- role: z.ZodEnum<{
428
- CREATIVE: "CREATIVE";
429
- BRAND: "BRAND";
430
- INVESTOR: "INVESTOR";
431
- ADMIN: "ADMIN";
432
- }>;
433
- isFollowing: z.ZodOptional<z.ZodBoolean>;
434
- followsYou: z.ZodOptional<z.ZodBoolean>;
435
- }, z.core.$strip>>;
436
- }, z.core.$strip>;
437
- }, z.core.$strip>;
438
- export declare const GetUserFollowersOutputSchema: z.ZodObject<{
439
- results: z.ZodObject<{
440
- email: z.ZodEmail;
441
- username: z.ZodOptional<z.ZodString>;
442
- id: z.ZodCUID2;
443
- name: z.ZodOptional<z.ZodString>;
444
- image: z.ZodOptional<z.ZodString>;
445
- role: z.ZodEnum<{
446
- CREATIVE: "CREATIVE";
447
- BRAND: "BRAND";
448
- INVESTOR: "INVESTOR";
449
- ADMIN: "ADMIN";
450
- }>;
451
- followers: z.ZodArray<z.ZodObject<{
452
- email: z.ZodEmail;
453
- username: z.ZodOptional<z.ZodString>;
454
- id: z.ZodCUID2;
455
- name: z.ZodOptional<z.ZodString>;
456
- image: z.ZodOptional<z.ZodString>;
457
- role: z.ZodEnum<{
458
- CREATIVE: "CREATIVE";
459
- BRAND: "BRAND";
460
- INVESTOR: "INVESTOR";
461
- ADMIN: "ADMIN";
462
- }>;
463
- isFollowing: z.ZodOptional<z.ZodBoolean>;
464
- followsYou: z.ZodOptional<z.ZodBoolean>;
465
- }, z.core.$strip>>;
466
- }, z.core.$strip>;
467
- }, z.core.$strip>;
468
444
  export declare const GetAuthenticatedUserOutputSchema: z.ZodObject<{
469
445
  id: z.ZodCUID2;
470
446
  email: z.ZodEmail;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetUserActivityOutputSchema = exports.GetUserActivityInputSchema = exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.GetAuthenticatedUserProfileOutputSchema = exports.GetAuthenticatedUserOutputSchema = exports.GetUserFollowersOutputSchema = exports.GetUserFollowingOutputSchema = exports.UserWithPostsEntitySchema = exports.UserWithFollowersEntitySchema = exports.UserWithFollowingEntitySchema = exports.GetUserFollowersInputSchema = exports.GetUserFollowingInputSchema = exports.UserWithProjectBookmarksEntitySchema = exports.UserWithProjectLikesEntitySchema = exports.UserWithProjectsEntitySchema = exports.UserProfileEntitySchema = exports.UserStatsEntitySchema = exports.MinimalUserSchema = exports.UserEntitySchema = void 0;
3
+ exports.GetUserActivityOutputSchema = exports.GetUserActivityInputSchema = exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.GetAuthenticatedUserProfileOutputSchema = exports.GetAuthenticatedUserOutputSchema = exports.UserWithPostsEntitySchema = exports.GetUserFollowingOutputSchema = exports.GetUserFollowersOutputSchema = exports.UserWithFollowersEntitySchema = exports.UserWithFollowingEntitySchema = exports.GetUserFollowersInputSchema = exports.GetUserFollowingInputSchema = exports.UserWithProjectBookmarksEntitySchema = exports.UserWithProjectLikesEntitySchema = exports.UserWithProjectsEntitySchema = exports.UserProfileEntitySchema = exports.UserStatsEntitySchema = exports.MinimalUserSchema = exports.UserEntitySchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  const project_1 = require("./project");
@@ -122,18 +122,26 @@ exports.UserWithFollowersEntitySchema = exports.MinimalUserSchema.extend({
122
122
  }))
123
123
  .openapi({ description: "List of users who follow this user." }),
124
124
  }).openapi("UserWithFollowersEntity");
125
+ exports.GetUserFollowersOutputSchema = zod_openapi_1.z.object({
126
+ nextCursor: zod_openapi_1.z.string(),
127
+ followers: zod_openapi_1.z.array(exports.MinimalUserSchema.extend({
128
+ isFollowing: zod_openapi_1.z.boolean().optional(),
129
+ followsYou: zod_openapi_1.z.boolean().optional(),
130
+ })),
131
+ });
132
+ exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
133
+ nextCursor: zod_openapi_1.z.string(),
134
+ following: zod_openapi_1.z.array(exports.MinimalUserSchema.extend({
135
+ isFollowing: zod_openapi_1.z.boolean().optional(),
136
+ followsYou: zod_openapi_1.z.boolean().optional(),
137
+ })),
138
+ });
125
139
  exports.UserWithPostsEntitySchema = zod_openapi_1.z
126
140
  .object({
127
141
  userId: zod_openapi_1.z.cuid2(),
128
142
  posts: zod_openapi_1.z.array(post_1.PostWithFilesEntitySchema),
129
143
  })
130
144
  .openapi("UserWithPostsEntity");
131
- exports.GetUserFollowingOutputSchema = zod_openapi_1.z.object({
132
- results: exports.UserWithFollowingEntitySchema,
133
- });
134
- exports.GetUserFollowersOutputSchema = zod_openapi_1.z.object({
135
- results: exports.UserWithFollowersEntitySchema,
136
- });
137
145
  exports.GetAuthenticatedUserOutputSchema = exports.UserEntitySchema;
138
146
  exports.GetAuthenticatedUserProfileOutputSchema = exports.UserProfileEntitySchema;
139
147
  exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.UserWithProjectsEntitySchema;
@@ -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, SearchPostInputSchema, SearchPostOutputSchema } from "../schemas/post";
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";
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>;
@@ -19,3 +19,4 @@ 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
21
  export type GetPostWithBookmarksOutput = z.infer<typeof GetPostWithBookmarksOutputSchema>;
22
+ export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.65",
3
+ "version": "2.1.67",
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, FileEntitySchema } from "./file";
8
8
  import { BookmarkEntitySchema } from "./bookmark";
@@ -12,231 +12,243 @@ import { EntityStatsSchema } from "./entity-stats";
12
12
  import { ActivitySchema } from "./activity";
13
13
 
14
14
  export const PostEntitySchema = z.object({
15
- id: z
16
- .cuid2()
17
- .openapi({ description: "Post id", example: "ckj1a2b3c0000xyz" }),
18
- parentId: z
19
- .cuid2()
20
- .optional()
21
- .openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
22
- parentType: z.enum(ACTIVITY_PARENT_TYPES).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",
45
- }),
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
- },
15
+ id: z
16
+ .cuid2()
17
+ .openapi({ description: "Post id", example: "ckj1a2b3c0000xyz" }),
18
+ parentId: z
19
+ .cuid2()
20
+ .optional()
21
+ .openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
22
+ parentType: z
23
+ .enum(ACTIVITY_PARENT_TYPES)
24
+ .default(ACTIVITY_PARENT_TYPES.POST),
25
+ tags: z
26
+ .array(
27
+ z.object({
28
+ name: z.string(),
29
+ id: z.int(),
30
+ }),
31
+ )
32
+ .optional(),
33
+ badge: z.enum(POST_BADGE_TYPES).optional(),
34
+ userId: z
35
+ .cuid2()
36
+ .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
37
+ creatorUsername: z.string().optional().openapi({ description: "Username" }),
38
+ creatorFullName: z.string().optional(),
39
+ creatorImageUrl: z.cuid2().optional().openapi({ description: "Username" }),
40
+ content: z
41
+ .string()
42
+ .optional()
43
+ .openapi({ description: "Post content", example: "Hello world" }),
44
+ postType: z.enum(POST_TYPES).openapi({
45
+ description: "Type of the post entity this statistic belongs to.",
46
+ title: "Post Type",
65
47
  }),
48
+
49
+ createdAt: z.coerce.date().optional(),
50
+
51
+ linkMeta: z
52
+ .object({
53
+ url: z.url(),
54
+ title: z.string().optional(),
55
+ description: z.string().optional(),
56
+ image: z.url().optional(),
57
+ })
58
+ .optional()
59
+ .openapi({
60
+ description: "Optional metadata for a single link in the post",
61
+ example: {
62
+ url: "https://example.com",
63
+ title: "Example Website",
64
+ description: "This is an example link",
65
+ image: "https://example.com/preview.jpg",
66
+ },
67
+ }),
66
68
  });
67
69
 
68
70
  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.string().openapi({ description: "CUID2 of the linked file." }),
77
- order: z.number().int().openapi({
78
- description: "Order index of the file in the project.",
79
- example: 1,
80
- }),
81
- })
82
- .openapi({
83
- title: "Post File Entity",
84
- description: "Schema representing a file associated with a project.",
85
- });
71
+ .object({
72
+ id: z
73
+ .string()
74
+ .openapi({ description: "CUID2 of the project file record." }),
75
+ postId: z.string().openapi({
76
+ description: "CUID2 of the post this file belongs to.",
77
+ }),
78
+ fileId: z
79
+ .string()
80
+ .openapi({ description: "CUID2 of the linked file." }),
81
+ order: z.number().int().openapi({
82
+ description: "Order index of the file in the project.",
83
+ example: 1,
84
+ }),
85
+ })
86
+ .openapi({
87
+ title: "Post File Entity",
88
+ description: "Schema representing a file associated with a project.",
89
+ });
86
90
 
87
91
  export const PostWithFilesEntitySchema = PostEntitySchema.extend({
88
- postFiles: z
89
- .array(
90
- PostFileEntitySchema.extend({
91
- url: z.url(),
92
- })
93
- )
94
- .optional()
95
- .openapi({ description: "Files associated with the project." }),
92
+ postFiles: z
93
+ .array(
94
+ PostFileEntitySchema.extend({
95
+ url: z.url(),
96
+ }),
97
+ )
98
+ .optional()
99
+ .openapi({ description: "Files associated with the project." }),
96
100
  });
97
101
 
98
102
  export const CreatePostInputSchema = z.object({
99
- id: z.cuid2(),
100
- parentId: z
101
- .cuid2({ message: "Invalid parentId" })
102
- .optional()
103
- .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
104
- parentType: z.enum(ACTIVITY_PARENT_TYPES).default(ACTIVITY_PARENT_TYPES.POST),
105
- content: z
106
- .string()
107
- .max(500, { message: "Post content cannot exceed 500 characters" })
108
- .optional()
109
- .openapi({
110
- description: "Post content",
111
- example: "New project announcement",
112
- }),
113
-
114
- postType: z
115
- .enum(POST_TYPES)
116
- .default("DEFAULT_POST")
117
- .openapi({ description: "Post type", example: "PROJECT" }),
118
-
119
- files: z
120
- .array(
121
- CreateFileInputSchema.extend({
122
- order: z
123
- .number()
124
- .int({ message: "File order must be an integer" })
125
-
126
- .max(5, { message: "File order cannot exceed 5" })
127
- .default(1),
128
- })
129
- )
130
- .max(5, { message: "Cannot attach more than 5 files" })
131
- .optional(),
132
-
133
- tags: z
134
- .array(z.string().min(1, { message: "Tag cannot be empty" }))
135
- .max(3, { message: "Cannot add more than 3 tags" })
136
- .optional(),
137
- badge: z.enum(POST_BADGE_TYPES).optional(),
138
- linkMeta: z
139
- .object({
140
- url: z.url({ message: "Invalid URL format" }),
141
- title: z
103
+ id: z.cuid2(),
104
+ parentId: z
105
+ .cuid2({ message: "Invalid parentId" })
106
+ .optional()
107
+ .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
108
+ parentType: z
109
+ .enum(ACTIVITY_PARENT_TYPES)
110
+ .default(ACTIVITY_PARENT_TYPES.POST),
111
+ content: z
142
112
  .string()
143
- .max(200, { message: "Title cannot exceed 200 characters" })
113
+ .max(500, { message: "Post content cannot exceed 500 characters" })
114
+ .optional()
115
+ .openapi({
116
+ description: "Post content",
117
+ example: "New project announcement",
118
+ }),
119
+
120
+ postType: z
121
+ .enum(POST_TYPES)
122
+ .default("DEFAULT_POST")
123
+ .openapi({ description: "Post type", example: "PROJECT" }),
124
+
125
+ files: z
126
+ .array(
127
+ CreateFileInputSchema.extend({
128
+ order: z
129
+ .number()
130
+ .int({ message: "File order must be an integer" })
131
+
132
+ .max(5, { message: "File order cannot exceed 5" })
133
+ .default(1),
134
+ }),
135
+ )
136
+ .max(5, { message: "Cannot attach more than 5 files" })
144
137
  .optional(),
145
- description: z
146
- .string()
147
- .max(500, { message: "Description cannot exceed 500 characters" })
138
+
139
+ tags: z
140
+ .array(z.string().min(1, { message: "Tag cannot be empty" }))
141
+ .max(3, { message: "Cannot add more than 3 tags" })
148
142
  .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
- }),
143
+ badge: z.enum(POST_BADGE_TYPES).optional(),
144
+ linkMeta: z
145
+ .object({
146
+ url: z.url({ message: "Invalid URL format" }),
147
+ title: z
148
+ .string()
149
+ .max(200, { message: "Title cannot exceed 200 characters" })
150
+ .optional(),
151
+ description: z
152
+ .string()
153
+ .max(500, {
154
+ message: "Description cannot exceed 500 characters",
155
+ })
156
+ .optional(),
157
+ image: z.url({ message: "Invalid image URL" }).optional(),
158
+ })
159
+ .optional()
160
+ .openapi({
161
+ description: "Optional metadata for a single link in the post",
162
+ example: {
163
+ url: "https://example.com",
164
+ title: "Example Website",
165
+ description: "This is an example link",
166
+ image: "https://example.com/preview.jpg",
167
+ },
168
+ }),
161
169
  });
162
170
 
163
171
  export const CreatePostOutputSchema = PostEntitySchema;
164
172
  export const GetPostOutputSchema = PostWithFilesEntitySchema;
165
173
  export const PostIdSchema = z.object({ postId: z.cuid2() });
166
174
  export const MinimalPostSchema = PostEntitySchema.pick({
167
- title: true,
168
- id: true,
169
- parentId: true,
170
- content: true,
175
+ title: true,
176
+ id: true,
177
+ parentId: true,
178
+ content: true,
171
179
  });
172
180
 
173
181
  export const PostWithLikesEntitySchema = MinimalPostSchema.extend({
174
- likes: z.array(ActivitySchema),
182
+ likes: z.array(ActivitySchema),
175
183
  }).openapi({
176
- title: "PostWithPostLikesEntity",
184
+ title: "PostWithPostLikesEntity",
177
185
  });
178
186
 
179
187
  export const GetPostWithLikesOutputSchema = PostWithLikesEntitySchema.extend({
180
- totalNo: z.number().int(),
188
+ totalNo: z.number().int(),
181
189
  });
182
190
 
183
191
  export const PostWithCommentsEntitySchema = MinimalPostSchema.extend({
184
- comments: z.array(
185
- CommentEntitySchema
186
- ),
192
+ comments: z.array(CommentEntitySchema),
187
193
  }).openapi({
188
- title: "PostWithPostCommentsEntity",
194
+ title: "PostWithPostCommentsEntity",
189
195
  });
190
196
 
191
197
  export const PostWithBookmarksEntitySchema = MinimalPostSchema.extend({
192
- bookmarks: z.array(ActivitySchema),
198
+ bookmarks: z.array(ActivitySchema),
193
199
  }).openapi({
194
- title: "PostWithPostBookmarksEntity",
200
+ title: "PostWithPostBookmarksEntity",
195
201
  });
196
202
 
197
203
  export const GetPostWithBookmarksOutputSchema =
198
- PostWithBookmarksEntitySchema.extend({
199
- totalNo: z.number().int(),
200
- });
204
+ PostWithBookmarksEntitySchema.extend({
205
+ totalNo: z.number().int(),
206
+ });
201
207
 
202
208
  export const LinkPreviewInputSchema = z.object({
203
- url: z.string(),
209
+ url: z.string(),
204
210
  });
205
211
 
206
212
  export const LinkPreviewOutputSchema = z.object({
207
- title: z.string(),
208
- description: z.string().optional(),
209
- image: z.string().optional(),
210
- url: z.string().optional(),
213
+ title: z.string(),
214
+ description: z.string().optional(),
215
+ image: z.string().optional(),
216
+ url: z.string().optional(),
211
217
  });
212
218
 
213
219
  export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
214
- stats: EntityStatsSchema,
215
- score: z.number(),
216
- isLiked: z.boolean().optional(),
217
- isFollowing: z.boolean().optional(),
218
- isBookmarked: z.boolean().optional(),
220
+ stats: EntityStatsSchema,
221
+ score: z.number(),
222
+ isLiked: z.boolean().optional(),
223
+ isFollowing: z.boolean().optional(),
224
+ isBookmarked: z.boolean().optional(),
219
225
  });
220
226
 
221
227
  export const GetFeedInputSchema = z.object({
222
- limit: z.number().optional(),
223
- cursor: z.string().optional(),
228
+ limit: z.number().optional(),
229
+ cursor: z.string().optional(),
224
230
  });
225
231
 
226
232
  export const GetFeedOutputSchema = z.object({
227
- feed: z.array(FeedPostEntitySchema),
228
- nextCursor: z.string().optional().nullable(),
233
+ feed: z.array(FeedPostEntitySchema),
234
+ nextCursor: z.string().optional().nullable(),
229
235
  });
230
236
 
231
237
  export const SearchPostInputSchema = z.object({
232
- queryString: z
233
- .string()
234
- .min(1, { message: "Search string cannot be empty" })
235
- .max(200, { message: "Search string cannot exceed 200 characters" }),
236
- cursor: z.string().optional(),
238
+ queryString: z
239
+ .string()
240
+ .min(1, { message: "Search string cannot be empty" })
241
+ .max(200, { message: "Search string cannot exceed 200 characters" }),
242
+ cursor: z.string().optional(),
237
243
  });
238
244
 
239
245
  export const SearchPostOutputSchema = z.object({
240
- posts: z.array(FeedPostEntitySchema),
241
- nextCursor: z.string().optional().nullable(),
246
+ posts: z.array(FeedPostEntitySchema),
247
+ nextCursor: z.string().optional().nullable(),
248
+ });
249
+
250
+ export const ReportPostInputSchema = z.object({
251
+ complaint: z
252
+ .string()
253
+ .max(200, { error: "Complaint cannot be longer than 200 characters" }),
242
254
  });
@@ -157,6 +157,26 @@ export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
157
157
  .openapi({ description: "List of users who follow this user." }),
158
158
  }).openapi("UserWithFollowersEntity");
159
159
 
160
+ export const GetUserFollowersOutputSchema = z.object({
161
+ nextCursor: z.string(),
162
+ followers: z.array(
163
+ MinimalUserSchema.extend({
164
+ isFollowing: z.boolean().optional(),
165
+ followsYou: z.boolean().optional(),
166
+ }),
167
+ ),
168
+ });
169
+
170
+ export const GetUserFollowingOutputSchema = z.object({
171
+ nextCursor: z.string(),
172
+ following: z.array(
173
+ MinimalUserSchema.extend({
174
+ isFollowing: z.boolean().optional(),
175
+ followsYou: z.boolean().optional(),
176
+ }),
177
+ ),
178
+ });
179
+
160
180
  export const UserWithPostsEntitySchema = z
161
181
  .object({
162
182
  userId: z.cuid2(),
@@ -164,14 +184,6 @@ export const UserWithPostsEntitySchema = z
164
184
  })
165
185
  .openapi("UserWithPostsEntity");
166
186
 
167
- export const GetUserFollowingOutputSchema = z.object({
168
- results: UserWithFollowingEntitySchema,
169
- });
170
-
171
- export const GetUserFollowersOutputSchema = z.object({
172
- results: UserWithFollowersEntitySchema,
173
- });
174
-
175
187
  export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
176
188
 
177
189
  export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
package/src/types/post.ts CHANGED
@@ -1,24 +1,25 @@
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
- SearchPostInputSchema,
21
- SearchPostOutputSchema,
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,
22
23
  } from "../schemas/post";
23
24
 
24
25
  export type PostEntity = z.infer<typeof PostEntitySchema>;
@@ -28,11 +29,11 @@ export type CreatePostInput = z.infer<typeof CreatePostInputSchema>;
28
29
  export type CreatePostOutput = z.infer<typeof CreatePostOutputSchema>;
29
30
  export type PostWithPostLikesEntity = z.infer<typeof PostWithLikesEntitySchema>;
30
31
  export type PostWithPostBookmarksEntity = z.infer<
31
- typeof PostWithBookmarksEntitySchema
32
+ typeof PostWithBookmarksEntitySchema
32
33
  >;
33
34
  export type PostIdInput = z.infer<typeof PostIdSchema>;
34
35
  export type PostWithPostCommentsEntity = z.infer<
35
- typeof PostWithCommentsEntitySchema
36
+ typeof PostWithCommentsEntitySchema
36
37
  >;
37
38
  export type GetPostOutput = z.infer<typeof GetPostOutputSchema>;
38
39
  export type LinkPreviewInput = z.infer<typeof LinkPreviewInputSchema>;
@@ -45,8 +46,9 @@ export type SearchPostInput = z.infer<typeof SearchPostInputSchema>;
45
46
  export type SearchPostOutput = z.infer<typeof SearchPostOutputSchema>;
46
47
 
47
48
  export type GetPostWithLikesOutput = z.infer<
48
- typeof GetPostWithLikesOutputSchema
49
+ typeof GetPostWithLikesOutputSchema
49
50
  >;
50
51
  export type GetPostWithBookmarksOutput = z.infer<
51
- typeof GetPostWithBookmarksOutputSchema
52
+ typeof GetPostWithBookmarksOutputSchema
52
53
  >;
54
+ export type ReportPostInput = z.infer<typeof ReportPostInputSchema>;
package/src/types/user.ts CHANGED
@@ -1,27 +1,27 @@
1
1
  import {
2
- MinimalUserSchema,
3
- UserEntitySchema,
4
- UserProfileEntitySchema,
5
- UserWithProjectsEntitySchema,
6
- UserWithProjectBookmarksEntitySchema,
7
- GetUserFollowingInputSchema,
8
- GetUserFollowersInputSchema,
9
- UserWithFollowingEntitySchema,
10
- UserWithFollowersEntitySchema,
11
- GetUserFollowingOutputSchema,
12
- GetUserFollowersOutputSchema,
13
- GetAuthenticatedUserOutputSchema,
14
- GetAuthenticatedUserProfileOutputSchema,
15
- GetAuthenticatedUserWithProjectsOutputSchema,
16
- GetAuthenticatedUserWithProjectBookmarksOutputSchema,
17
- GetAuthenticatedUserWithUserFollowingOutputSchema,
18
- GetAuthenticatedUserWithUserFollowersOutputSchema,
19
- UserWithProjectLikesEntitySchema,
20
- GetAuthenticatedUserWithProjectLikesOutputSchema,
21
- GetUserActivityInputSchema,
22
- GetUserActivityOutputSchema,
23
- UserStatsEntitySchema,
24
- UserWithPostsEntitySchema,
2
+ MinimalUserSchema,
3
+ UserEntitySchema,
4
+ UserProfileEntitySchema,
5
+ UserWithProjectsEntitySchema,
6
+ UserWithProjectBookmarksEntitySchema,
7
+ GetUserFollowingInputSchema,
8
+ GetUserFollowersInputSchema,
9
+ UserWithFollowingEntitySchema,
10
+ UserWithFollowersEntitySchema,
11
+ GetUserFollowingOutputSchema,
12
+ GetUserFollowersOutputSchema,
13
+ GetAuthenticatedUserOutputSchema,
14
+ GetAuthenticatedUserProfileOutputSchema,
15
+ GetAuthenticatedUserWithProjectsOutputSchema,
16
+ GetAuthenticatedUserWithProjectBookmarksOutputSchema,
17
+ GetAuthenticatedUserWithUserFollowingOutputSchema,
18
+ GetAuthenticatedUserWithUserFollowersOutputSchema,
19
+ UserWithProjectLikesEntitySchema,
20
+ GetAuthenticatedUserWithProjectLikesOutputSchema,
21
+ GetUserActivityInputSchema,
22
+ GetUserActivityOutputSchema,
23
+ UserStatsEntitySchema,
24
+ UserWithPostsEntitySchema,
25
25
  } from "../schemas/user";
26
26
 
27
27
  import { z } from "@hono/zod-openapi";
@@ -31,49 +31,49 @@ export type MinimalUser = z.infer<typeof MinimalUserSchema>;
31
31
  export type UserEntity = z.infer<typeof UserEntitySchema>;
32
32
  export type UserProfileEntity = z.infer<typeof UserProfileEntitySchema>;
33
33
  export type UserWithProjectsEntity = z.infer<
34
- typeof UserWithProjectsEntitySchema
34
+ typeof UserWithProjectsEntitySchema
35
35
  >;
36
36
  export type UserWithProjectBookmarksEntity = z.infer<
37
- typeof UserWithProjectBookmarksEntitySchema
37
+ typeof UserWithProjectBookmarksEntitySchema
38
38
  >;
39
39
  export type UserWithProjectLikesEntity = z.infer<
40
- typeof UserWithProjectLikesEntitySchema
40
+ typeof UserWithProjectLikesEntitySchema
41
41
  >;
42
42
  export type UserWithUserPostsEntity = z.infer<typeof UserWithPostsEntitySchema>;
43
43
  export type GetUserFollowingInput = z.infer<typeof GetUserFollowingInputSchema>;
44
44
  export type GetUserFollowersInput = z.infer<typeof GetUserFollowersInputSchema>;
45
45
  export type UserWithFollowingEntity = z.infer<
46
- typeof UserWithFollowingEntitySchema
46
+ typeof UserWithFollowingEntitySchema
47
47
  >;
48
48
  export type UserWithFollowersEntity = z.infer<
49
- typeof UserWithFollowersEntitySchema
49
+ typeof UserWithFollowersEntitySchema
50
50
  >;
51
51
  export type GetUserFollowingOutput = z.infer<
52
- typeof GetUserFollowingOutputSchema
52
+ typeof GetUserFollowingOutputSchema
53
53
  >;
54
54
  export type GetUserFollowersOutput = z.infer<
55
- typeof GetUserFollowersOutputSchema
55
+ typeof GetUserFollowersOutputSchema
56
56
  >;
57
57
  export type GetAuthenticatedUserOutput = z.infer<
58
- typeof GetAuthenticatedUserOutputSchema
58
+ typeof GetAuthenticatedUserOutputSchema
59
59
  >;
60
60
  export type GetAuthenticatedUserProfileOutput = z.infer<
61
- typeof GetAuthenticatedUserProfileOutputSchema
61
+ typeof GetAuthenticatedUserProfileOutputSchema
62
62
  >;
63
63
  export type GetAuthenticatedUserWithProjectsOutput = z.infer<
64
- typeof GetAuthenticatedUserWithProjectsOutputSchema
64
+ typeof GetAuthenticatedUserWithProjectsOutputSchema
65
65
  >;
66
66
  export type GetAuthenticatedUserWithProjectBookmarksOutput = z.infer<
67
- typeof GetAuthenticatedUserWithProjectBookmarksOutputSchema
67
+ typeof GetAuthenticatedUserWithProjectBookmarksOutputSchema
68
68
  >;
69
69
  export type GetAuthenticatedUserWithProjectLikesOutput = z.infer<
70
- typeof GetAuthenticatedUserWithProjectLikesOutputSchema
70
+ typeof GetAuthenticatedUserWithProjectLikesOutputSchema
71
71
  >;
72
72
  export type GetAuthenticatedUserWithUserFollowingOutput = z.infer<
73
- typeof GetAuthenticatedUserWithUserFollowingOutputSchema
73
+ typeof GetAuthenticatedUserWithUserFollowingOutputSchema
74
74
  >;
75
75
  export type GetAuthenticatedUserWithUserFollowersOutput = z.infer<
76
- typeof GetAuthenticatedUserWithUserFollowersOutputSchema
76
+ typeof GetAuthenticatedUserWithUserFollowersOutputSchema
77
77
  >;
78
78
 
79
79
  export type GetUserActivityInput = z.infer<typeof GetUserActivityInputSchema>;