@zyacreatives/shared 1.7.2 → 1.7.4

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.
@@ -4,7 +4,10 @@ export declare const BookmarkEntitySchema: z.ZodObject<{
4
4
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
5
5
  userId: z.ZodCUID2;
6
6
  parentId: z.ZodCUID2;
7
- parentType: z.ZodString;
7
+ parentType: z.ZodEnum<{
8
+ readonly PROJECT: "PROJECT";
9
+ readonly POST: "POST";
10
+ }>;
8
11
  }, z.core.$strip>;
9
12
  export declare const BookmarkInputSchema: z.ZodObject<{
10
13
  parentId: z.ZodString;
@@ -19,5 +22,8 @@ export declare const BookmarkOutputSchema: z.ZodObject<{
19
22
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
20
23
  userId: z.ZodCUID2;
21
24
  parentId: z.ZodCUID2;
22
- parentType: z.ZodString;
25
+ parentType: z.ZodEnum<{
26
+ readonly PROJECT: "PROJECT";
27
+ readonly POST: "POST";
28
+ }>;
23
29
  }, z.core.$strip>;
@@ -21,8 +21,8 @@ exports.BookmarkEntitySchema = zod_openapi_1.z
21
21
  description: "Identifier of the parent entity that was bookmarked.",
22
22
  title: "Parent ID",
23
23
  }),
24
- parentType: zod_openapi_1.z.string().openapi({
25
- description: "Type of the parent entity (e.g., project, post, etc.).",
24
+ parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
25
+ description: "Type of the parent entity this statistic belongs to.",
26
26
  title: "Parent Type",
27
27
  }),
28
28
  })
@@ -7,3 +7,4 @@ export * from "./investor";
7
7
  export * from "./discipline";
8
8
  export * from "./file";
9
9
  export * from "./username";
10
+ export * from "./post";
@@ -23,3 +23,4 @@ __exportStar(require("./investor"), exports);
23
23
  __exportStar(require("./discipline"), exports);
24
24
  __exportStar(require("./file"), exports);
25
25
  __exportStar(require("./username"), exports);
26
+ __exportStar(require("./post"), exports);
@@ -4,7 +4,10 @@ export declare const LikeEntitySchema: z.ZodObject<{
4
4
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
5
5
  userId: z.ZodCUID2;
6
6
  parentId: z.ZodCUID2;
7
- parentType: z.ZodString;
7
+ parentType: z.ZodEnum<{
8
+ readonly PROJECT: "PROJECT";
9
+ readonly POST: "POST";
10
+ }>;
8
11
  }, z.core.$strip>;
9
12
  export declare const LikeInputSchema: z.ZodObject<{
10
13
  parentId: z.ZodString;
@@ -19,5 +22,8 @@ export declare const LikeOutputSchema: z.ZodObject<{
19
22
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
20
23
  userId: z.ZodCUID2;
21
24
  parentId: z.ZodCUID2;
22
- parentType: z.ZodString;
25
+ parentType: z.ZodEnum<{
26
+ readonly PROJECT: "PROJECT";
27
+ readonly POST: "POST";
28
+ }>;
23
29
  }, z.core.$strip>;
@@ -21,8 +21,8 @@ exports.LikeEntitySchema = zod_openapi_1.z
21
21
  description: "Identifier of the parent entity that was liked.",
22
22
  title: "Parent ID",
23
23
  }),
24
- parentType: zod_openapi_1.z.string().openapi({
25
- description: "Type of the parent entity (e.g., project, post, etc.).",
24
+ parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).openapi({
25
+ description: "Type of the parent entity this statistic belongs to.",
26
26
  title: "Parent Type",
27
27
  }),
28
28
  })
@@ -0,0 +1,52 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const PostEntitySchema: z.ZodObject<{
3
+ id: z.ZodCUID2;
4
+ parentId: z.ZodCUID2;
5
+ userId: z.ZodCUID2;
6
+ content: z.ZodString;
7
+ title: z.ZodNullable<z.ZodString>;
8
+ parentType: z.ZodEnum<{
9
+ readonly MARKETPLACE: "MARKETPLACE";
10
+ readonly PROJECT: "PROJECT";
11
+ readonly JOB_OPENING: "JOB_OPENING";
12
+ readonly DEFAULT_POST: "DEFAULT_POST";
13
+ readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
14
+ }>;
15
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
16
+ }, z.core.$strip>;
17
+ export declare const PostFileEntitySchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ postId: z.ZodString;
20
+ fileId: z.ZodString;
21
+ order: z.ZodNumber;
22
+ }, z.core.$strip>;
23
+ export declare const PostWithFilesEntitySchema: z.ZodObject<{
24
+ id: z.ZodCUID2;
25
+ parentId: z.ZodCUID2;
26
+ userId: z.ZodCUID2;
27
+ content: z.ZodString;
28
+ title: z.ZodNullable<z.ZodString>;
29
+ parentType: z.ZodEnum<{
30
+ readonly MARKETPLACE: "MARKETPLACE";
31
+ readonly PROJECT: "PROJECT";
32
+ readonly JOB_OPENING: "JOB_OPENING";
33
+ readonly DEFAULT_POST: "DEFAULT_POST";
34
+ readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
35
+ }>;
36
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
37
+ projectFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
+ id: z.ZodString;
39
+ postId: z.ZodString;
40
+ fileId: z.ZodString;
41
+ order: z.ZodNumber;
42
+ file: z.ZodObject<{
43
+ id: z.ZodCUID2;
44
+ key: z.ZodString;
45
+ mimeType: z.ZodString;
46
+ url: z.ZodOptional<z.ZodURL>;
47
+ userId: z.ZodCUID2;
48
+ createdAt: z.ZodCoercedDate<unknown>;
49
+ updatedAt: z.ZodCoercedDate<unknown>;
50
+ }, z.core.$strip>;
51
+ }, z.core.$strip>>>;
52
+ }, z.core.$strip>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = exports.PostEntitySchema = void 0;
4
+ const zod_openapi_1 = require("@hono/zod-openapi");
5
+ const constants_1 = require("../constants");
6
+ const file_1 = require("./file");
7
+ exports.PostEntitySchema = zod_openapi_1.z.object({
8
+ id: zod_openapi_1.z
9
+ .cuid2()
10
+ .openapi({ description: "Post id", example: "ckj1a2b3c0000xyz" }),
11
+ parentId: zod_openapi_1.z
12
+ .cuid2()
13
+ .openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
14
+ userId: zod_openapi_1.z
15
+ .cuid2()
16
+ .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
17
+ content: zod_openapi_1.z
18
+ .string()
19
+ .openapi({ description: "Post content", example: "Hello world" }),
20
+ title: zod_openapi_1.z
21
+ .string()
22
+ .nullable()
23
+ .openapi({ description: "Optional title", example: "My first post" }),
24
+ parentType: zod_openapi_1.z.enum(constants_1.POST_TYPES).openapi({
25
+ description: "Type of the post entity this statistic belongs to.",
26
+ title: "Post Type",
27
+ }),
28
+ createdAt: zod_openapi_1.z.coerce.date().optional(),
29
+ });
30
+ exports.PostFileEntitySchema = zod_openapi_1.z
31
+ .object({
32
+ id: zod_openapi_1.z
33
+ .string()
34
+ .openapi({ description: "CUID2 of the project file record." }),
35
+ postId: zod_openapi_1.z.string().openapi({
36
+ description: "CUID2 of the post this file belongs to.",
37
+ }),
38
+ fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
39
+ order: zod_openapi_1.z.number().int().openapi({
40
+ description: "Order index of the file in the project.",
41
+ example: 1,
42
+ }),
43
+ })
44
+ .openapi({
45
+ title: "Post File Entity",
46
+ description: "Schema representing a file associated with a project.",
47
+ });
48
+ exports.PostWithFilesEntitySchema = exports.PostEntitySchema.extend({
49
+ projectFiles: zod_openapi_1.z
50
+ .array(exports.PostFileEntitySchema.extend({
51
+ file: file_1.FileEntitySchema,
52
+ }))
53
+ .optional()
54
+ .openapi({ description: "Files associated with the project." }),
55
+ }).openapi({ title: "ProjectWithFilesEntity" });
@@ -368,7 +368,10 @@ export declare const ProjectWithProjectLikesEntitySchema: z.ZodObject<{
368
368
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
369
369
  userId: z.ZodCUID2;
370
370
  parentId: z.ZodCUID2;
371
- parentType: z.ZodString;
371
+ parentType: z.ZodEnum<{
372
+ readonly PROJECT: "PROJECT";
373
+ readonly POST: "POST";
374
+ }>;
372
375
  }, z.core.$strip>>;
373
376
  }, z.core.$strip>;
374
377
  export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
@@ -384,6 +387,9 @@ export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
384
387
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
385
388
  userId: z.ZodCUID2;
386
389
  parentId: z.ZodCUID2;
387
- parentType: z.ZodString;
390
+ parentType: z.ZodEnum<{
391
+ readonly PROJECT: "PROJECT";
392
+ readonly POST: "POST";
393
+ }>;
388
394
  }, z.core.$strip>>;
389
395
  }, z.core.$strip>;
@@ -184,7 +184,10 @@ export declare const UserWithProjectLikesEntitySchema: z.ZodObject<{
184
184
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
185
185
  userId: z.ZodCUID2;
186
186
  parentId: z.ZodCUID2;
187
- parentType: z.ZodString;
187
+ parentType: z.ZodEnum<{
188
+ readonly PROJECT: "PROJECT";
189
+ readonly POST: "POST";
190
+ }>;
188
191
  project: z.ZodObject<{
189
192
  id: z.ZodString;
190
193
  description: z.ZodOptional<z.ZodString>;
@@ -203,7 +206,10 @@ export declare const UserWithProjectBookmarksEntitySchema: z.ZodObject<{
203
206
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
204
207
  userId: z.ZodCUID2;
205
208
  parentId: z.ZodCUID2;
206
- parentType: z.ZodString;
209
+ parentType: z.ZodEnum<{
210
+ readonly PROJECT: "PROJECT";
211
+ readonly POST: "POST";
212
+ }>;
207
213
  project: z.ZodObject<{
208
214
  id: z.ZodString;
209
215
  description: z.ZodOptional<z.ZodString>;
@@ -462,7 +468,10 @@ export declare const GetAuthenticatedUserWithProjectBookmarksOutputSchema: z.Zod
462
468
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
463
469
  userId: z.ZodCUID2;
464
470
  parentId: z.ZodCUID2;
465
- parentType: z.ZodString;
471
+ parentType: z.ZodEnum<{
472
+ readonly PROJECT: "PROJECT";
473
+ readonly POST: "POST";
474
+ }>;
466
475
  project: z.ZodObject<{
467
476
  id: z.ZodString;
468
477
  description: z.ZodOptional<z.ZodString>;
@@ -533,7 +542,10 @@ export declare const GetAuthenticatedUserWithProjectLikesOutputSchema: z.ZodObje
533
542
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
534
543
  userId: z.ZodCUID2;
535
544
  parentId: z.ZodCUID2;
536
- parentType: z.ZodString;
545
+ parentType: z.ZodEnum<{
546
+ readonly PROJECT: "PROJECT";
547
+ readonly POST: "POST";
548
+ }>;
537
549
  project: z.ZodObject<{
538
550
  id: z.ZodString;
539
551
  description: z.ZodOptional<z.ZodString>;
@@ -7,3 +7,4 @@ export * from "./investor";
7
7
  export * from "./project";
8
8
  export * from "./user";
9
9
  export * from "./username";
10
+ export * from "./post";
@@ -23,3 +23,4 @@ __exportStar(require("./investor"), exports);
23
23
  __exportStar(require("./project"), exports);
24
24
  __exportStar(require("./user"), exports);
25
25
  __exportStar(require("./username"), exports);
26
+ __exportStar(require("./post"), exports);
@@ -0,0 +1,5 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { PostEntitySchema, PostFileEntitySchema, PostWithFilesEntitySchema } from "../schemas/post";
3
+ export type PostEntity = z.infer<typeof PostEntitySchema>;
4
+ export type PostFileEntity = z.infer<typeof PostFileEntitySchema>;
5
+ export type PostWithFilesEntity = z.infer<typeof PostWithFilesEntitySchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@ export const BookmarkEntitySchema = z
19
19
  description: "Identifier of the parent entity that was bookmarked.",
20
20
  title: "Parent ID",
21
21
  }),
22
- parentType: z.string().openapi({
23
- description: "Type of the parent entity (e.g., project, post, etc.).",
22
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
23
+ description: "Type of the parent entity this statistic belongs to.",
24
24
  title: "Parent Type",
25
25
  }),
26
26
  })
@@ -7,3 +7,4 @@ export * from "./investor";
7
7
  export * from "./discipline";
8
8
  export * from "./file";
9
9
  export * from "./username";
10
+ export * from "./post";
@@ -19,8 +19,8 @@ export const LikeEntitySchema = z
19
19
  description: "Identifier of the parent entity that was liked.",
20
20
  title: "Parent ID",
21
21
  }),
22
- parentType: z.string().openapi({
23
- description: "Type of the parent entity (e.g., project, post, etc.).",
22
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
23
+ description: "Type of the parent entity this statistic belongs to.",
24
24
  title: "Parent Type",
25
25
  }),
26
26
  })
@@ -0,0 +1,58 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { POST_TYPES } from "../constants";
3
+ import { FileEntitySchema } from "./file";
4
+
5
+ export const PostEntitySchema = z.object({
6
+ id: z
7
+ .cuid2()
8
+ .openapi({ description: "Post id", example: "ckj1a2b3c0000xyz" }),
9
+ parentId: z
10
+ .cuid2()
11
+ .openapi({ description: "Parent id", example: "ckj1a2b3c0000abc" }),
12
+ userId: z
13
+ .cuid2()
14
+ .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
15
+ content: z
16
+ .string()
17
+ .openapi({ description: "Post content", example: "Hello world" }),
18
+ title: z
19
+ .string()
20
+ .nullable()
21
+ .openapi({ description: "Optional title", example: "My first post" }),
22
+ parentType: z.enum(POST_TYPES).openapi({
23
+ description: "Type of the post entity this statistic belongs to.",
24
+ title: "Post Type",
25
+ }),
26
+ createdAt: z.coerce.date().optional(),
27
+ });
28
+
29
+ export const PostFileEntitySchema = z
30
+ .object({
31
+ id: z
32
+ .string()
33
+ .openapi({ description: "CUID2 of the project file record." }),
34
+ postId: z.string().openapi({
35
+ description: "CUID2 of the post this file belongs to.",
36
+ }),
37
+ fileId: z.string().openapi({ description: "CUID2 of the linked file." }),
38
+ order: z.number().int().openapi({
39
+ description: "Order index of the file in the project.",
40
+ example: 1,
41
+ }),
42
+ })
43
+ .openapi({
44
+ title: "Post File Entity",
45
+ description: "Schema representing a file associated with a project.",
46
+ });
47
+
48
+ export const PostWithFilesEntitySchema = PostEntitySchema.extend({
49
+ projectFiles: z
50
+ .array(
51
+ PostFileEntitySchema.extend({
52
+ file: FileEntitySchema,
53
+ })
54
+ )
55
+ .optional()
56
+ .openapi({ description: "Files associated with the project." }),
57
+ }).openapi({ title: "ProjectWithFilesEntity" });
58
+
@@ -7,3 +7,4 @@ export * from "./investor";
7
7
  export * from "./project";
8
8
  export * from "./user";
9
9
  export * from "./username";
10
+ export * from "./post";
@@ -0,0 +1,10 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import {
3
+ PostEntitySchema,
4
+ PostFileEntitySchema,
5
+ PostWithFilesEntitySchema,
6
+ } from "../schemas/post";
7
+
8
+ export type PostEntity = z.infer<typeof PostEntitySchema>;
9
+ export type PostFileEntity = z.infer<typeof PostFileEntitySchema>;
10
+ export type PostWithFilesEntity = z.infer<typeof PostWithFilesEntitySchema>;