@zyacreatives/shared 1.3.5 → 1.3.7

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.
@@ -1,38 +1,74 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  export declare const ProjectEntitySchema: z.ZodObject<{
3
- id: z.ZodCUID2;
4
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
5
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
6
- userId: z.ZodCUID2;
7
- title: z.ZodString;
8
3
  description: z.ZodOptional<z.ZodString>;
9
- overview: z.ZodOptional<z.ZodString>;
4
+ title: z.ZodString;
10
5
  url: z.ZodOptional<z.ZodString>;
6
+ imagePlaceholderUrl: z.ZodString;
7
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
9
+ endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
10
+ overview: z.ZodOptional<z.ZodString>;
11
+ projectCreatorType: z.ZodEnum<{
12
+ readonly CREATIVE: "CREATIVE";
13
+ readonly BRAND: "BRAND";
14
+ readonly INVESTOR: "INVESTOR";
15
+ readonly ADMIN: "ADMIN";
16
+ }>;
11
17
  clientId: z.ZodOptional<z.ZodString>;
12
18
  clientType: z.ZodOptional<z.ZodEnum<{
13
- CREATIVE: "CREATIVE";
14
- BRAND: "BRAND";
15
- NONE: "NONE";
19
+ readonly CREATIVE: "CREATIVE";
20
+ readonly BRAND: "BRAND";
21
+ readonly NONE: "NONE";
16
22
  }>>;
17
23
  clientName: z.ZodOptional<z.ZodString>;
18
- projectCreatorType: z.ZodEnum<{
19
- CREATIVE: "CREATIVE";
20
- BRAND: "BRAND";
21
- INVESTOR: "INVESTOR";
22
- ADMIN: "ADMIN";
23
- }>;
24
+ id: z.ZodString;
25
+ isFeatured: z.ZodOptional<z.ZodBoolean>;
26
+ createdAt: z.ZodCoercedDate<unknown>;
27
+ updatedAt: z.ZodCoercedDate<unknown>;
28
+ userId: z.ZodString;
29
+ searchVector: z.ZodString;
30
+ }, z.core.$strip>;
31
+ export declare const CreateProjectSchema: z.ZodObject<{
32
+ userId: z.ZodString;
33
+ title: z.ZodString;
34
+ projectCreatorType: z.ZodDefault<z.ZodEnum<{
35
+ readonly CREATIVE: "CREATIVE";
36
+ readonly BRAND: "BRAND";
37
+ readonly INVESTOR: "INVESTOR";
38
+ readonly ADMIN: "ADMIN";
39
+ }>>;
40
+ imagePlaceholderUrl: z.ZodURL;
41
+ id: z.ZodOptional<z.ZodString>;
42
+ description: z.ZodOptional<z.ZodString>;
43
+ overview: z.ZodOptional<z.ZodString>;
44
+ url: z.ZodOptional<z.ZodString>;
45
+ clientId: z.ZodOptional<z.ZodString>;
46
+ clientType: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
47
+ readonly CREATIVE: "CREATIVE";
48
+ readonly BRAND: "BRAND";
49
+ readonly NONE: "NONE";
50
+ }>>>;
51
+ clientName: z.ZodOptional<z.ZodString>;
24
52
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
53
+ searchVector: z.ZodOptional<z.ZodString>;
25
54
  isFeatured: z.ZodOptional<z.ZodBoolean>;
26
55
  startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
27
56
  endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
28
- imagePlaceholderUrl: z.ZodOptional<z.ZodString>;
57
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
58
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
59
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
60
+ key: z.ZodString;
61
+ mimeType: z.ZodString;
62
+ isPlaceholder: z.ZodDefault<z.ZodBoolean>;
63
+ order: z.ZodDefault<z.ZodNumber>;
64
+ }, z.core.$strip>>>;
29
65
  }, z.core.$strip>;
30
66
  export declare const ProjectFileEntitySchema: z.ZodObject<{
31
- id: z.ZodCUID2;
32
- projectId: z.ZodCUID2;
33
- url: z.ZodString;
34
- mimeType: z.ZodString;
35
- fileSize: z.ZodNumber;
67
+ isPlaceholder: z.ZodBoolean;
68
+ order: z.ZodNumber;
69
+ projectId: z.ZodString;
70
+ id: z.ZodString;
71
+ fileId: z.ZodString;
36
72
  }, z.core.$strip>;
37
73
  export declare const ProjectSocialGraphEntitySchema: z.ZodObject<{
38
74
  noOfLikes: z.ZodOptional<z.ZodNumber>;
@@ -41,42 +77,43 @@ export declare const ProjectSocialGraphEntitySchema: z.ZodObject<{
41
77
  noOfViews: z.ZodOptional<z.ZodNumber>;
42
78
  }, z.core.$strip>;
43
79
  export declare const ProjectWithFilesEntitySchema: z.ZodObject<{
44
- id: z.ZodCUID2;
45
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
46
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
47
- userId: z.ZodCUID2;
48
- title: z.ZodString;
49
80
  description: z.ZodOptional<z.ZodString>;
50
- overview: z.ZodOptional<z.ZodString>;
81
+ title: z.ZodString;
51
82
  url: z.ZodOptional<z.ZodString>;
83
+ imagePlaceholderUrl: z.ZodString;
84
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
+ startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
86
+ endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
87
+ overview: z.ZodOptional<z.ZodString>;
88
+ projectCreatorType: z.ZodEnum<{
89
+ readonly CREATIVE: "CREATIVE";
90
+ readonly BRAND: "BRAND";
91
+ readonly INVESTOR: "INVESTOR";
92
+ readonly ADMIN: "ADMIN";
93
+ }>;
52
94
  clientId: z.ZodOptional<z.ZodString>;
53
95
  clientType: z.ZodOptional<z.ZodEnum<{
54
- CREATIVE: "CREATIVE";
55
- BRAND: "BRAND";
56
- NONE: "NONE";
96
+ readonly CREATIVE: "CREATIVE";
97
+ readonly BRAND: "BRAND";
98
+ readonly NONE: "NONE";
57
99
  }>>;
58
100
  clientName: z.ZodOptional<z.ZodString>;
59
- projectCreatorType: z.ZodEnum<{
60
- CREATIVE: "CREATIVE";
61
- BRAND: "BRAND";
62
- INVESTOR: "INVESTOR";
63
- ADMIN: "ADMIN";
64
- }>;
65
- tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
+ id: z.ZodString;
66
102
  isFeatured: z.ZodOptional<z.ZodBoolean>;
67
- startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
68
- endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
69
- imagePlaceholderUrl: z.ZodOptional<z.ZodString>;
103
+ createdAt: z.ZodCoercedDate<unknown>;
104
+ updatedAt: z.ZodCoercedDate<unknown>;
105
+ userId: z.ZodString;
106
+ searchVector: z.ZodString;
70
107
  noOfLikes: z.ZodOptional<z.ZodNumber>;
71
108
  noOfComments: z.ZodOptional<z.ZodNumber>;
72
109
  noOfBookmarks: z.ZodOptional<z.ZodNumber>;
73
110
  noOfViews: z.ZodOptional<z.ZodNumber>;
74
111
  projectFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
- id: z.ZodCUID2;
76
- projectId: z.ZodCUID2;
77
- url: z.ZodString;
78
- mimeType: z.ZodString;
79
- fileSize: z.ZodNumber;
112
+ isPlaceholder: z.ZodBoolean;
113
+ order: z.ZodNumber;
114
+ projectId: z.ZodString;
115
+ id: z.ZodString;
116
+ fileId: z.ZodString;
80
117
  }, z.core.$strip>>>;
81
118
  }, z.core.$strip>;
82
119
  export declare const ProjectViewEntitySchema: z.ZodObject<{
@@ -1,75 +1,232 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectUpdateOutputEntitySchema = exports.ProjectBookmarkEntitySchema = exports.ProjectCommentEntitySchema = exports.ProjectLikeEntitySchema = exports.ProjectViewEntitySchema = exports.ProjectWithFilesEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.ProjectEntitySchema = void 0;
3
+ exports.ProjectUpdateOutputEntitySchema = exports.ProjectBookmarkEntitySchema = exports.ProjectCommentEntitySchema = exports.ProjectLikeEntitySchema = exports.ProjectViewEntitySchema = exports.ProjectWithFilesEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.CreateProjectSchema = exports.ProjectEntitySchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
+ const file_1 = require("./file");
6
7
  exports.ProjectEntitySchema = zod_openapi_1.z
7
8
  .object({
8
- id: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
9
- createdAt: zod_openapi_1.z.coerce
10
- .date()
9
+ description: zod_openapi_1.z.string().optional().openapi({
10
+ description: "Detailed description of the project, max 1000 characters.",
11
+ example: "A modern e-commerce mobile application built with React Native.",
12
+ }),
13
+ title: zod_openapi_1.z.string().openapi({
14
+ description: "Title of the project.",
15
+ example: "E-commerce Mobile App",
16
+ }),
17
+ url: zod_openapi_1.z.string().optional().openapi({
18
+ description: "URL to the project or live demo.",
19
+ example: "https://example.com/project",
20
+ }),
21
+ imagePlaceholderUrl: zod_openapi_1.z.string().url().openapi({
22
+ description: "URL for the placeholder image of the project.",
23
+ example: "https://img.com",
24
+ }),
25
+ tags: zod_openapi_1.z
26
+ .array(zod_openapi_1.z.string())
11
27
  .optional()
12
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
13
- updatedAt: zod_openapi_1.z.coerce
28
+ .openapi({
29
+ description: "Array of tags associated with the project.",
30
+ example: ["react-native", "e-commerce", "mobile"],
31
+ }),
32
+ startDate: zod_openapi_1.z.coerce
14
33
  .date()
15
34
  .optional()
16
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
17
- userId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
18
- title: zod_openapi_1.z.string().openapi({ example: "Brand Identity Design" }),
19
- description: zod_openapi_1.z
20
- .string()
21
- .optional()
22
- .openapi({ example: "A full rebrand for a fashion label." }),
23
- overview: zod_openapi_1.z
24
- .string()
25
- .optional()
26
- .openapi({ example: "Detailed project story and outcomes." }),
27
- url: zod_openapi_1.z
28
- .string()
29
- .url()
35
+ .openapi({
36
+ description: "Start date of the project.",
37
+ example: new Date("2024-01-01"),
38
+ }),
39
+ endDate: zod_openapi_1.z.coerce
40
+ .date()
30
41
  .optional()
31
- .openapi({ example: "https://example.com/project" }),
32
- clientId: zod_openapi_1.z.string().optional().openapi({ example: "client_abc123" }),
42
+ .openapi({
43
+ description: "End date of the project.",
44
+ example: new Date("2024-06-30"),
45
+ }),
46
+ overview: zod_openapi_1.z.string().optional().openapi({
47
+ description: "Brief overview of the project.",
48
+ example: "A comprehensive e-commerce solution for mobile devices.",
49
+ }),
50
+ projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).openapi({
51
+ description: "Type of creator who made this project.",
52
+ example: "CREATIVE",
53
+ }),
54
+ clientId: zod_openapi_1.z.string().optional().openapi({
55
+ description: "CUID2 of the client if this is a client project.",
56
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
57
+ }),
58
+ clientType: zod_openapi_1.z.enum(constants_1.CLIENT_TYPES).optional().openapi({
59
+ description: "Type of client for this project.",
60
+ example: "BRAND",
61
+ }),
62
+ clientName: zod_openapi_1.z.string().optional().openapi({
63
+ description: "Name of the client.",
64
+ example: "Acme Corp",
65
+ }),
66
+ id: zod_openapi_1.z.string().openapi({
67
+ description: "CUID2 of the project.",
68
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
69
+ }),
70
+ isFeatured: zod_openapi_1.z.boolean().optional().openapi({
71
+ description: "Whether the project is featured.",
72
+ example: true,
73
+ }),
74
+ createdAt: zod_openapi_1.z.coerce.date().openapi({
75
+ description: "Timestamp when the project was created.",
76
+ example: new Date("2024-01-01T00:00:00.000Z"),
77
+ }),
78
+ updatedAt: zod_openapi_1.z.coerce.date().openapi({
79
+ description: "Timestamp when the project was last updated.",
80
+ example: new Date("2024-06-30T00:00:00.000Z"),
81
+ }),
82
+ userId: zod_openapi_1.z.string().openapi({
83
+ description: "CUID2 of the user who created the project.",
84
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
85
+ }),
86
+ searchVector: zod_openapi_1.z.string().openapi({
87
+ description: "Search vector for full-text search indexing.",
88
+ example: "ecommerce mobile app react native",
89
+ }),
90
+ })
91
+ .openapi({
92
+ title: "Project DB Entity",
93
+ description: "Schema representing a project stored in the database.",
94
+ });
95
+ exports.CreateProjectSchema = zod_openapi_1.z
96
+ .object({
97
+ userId: zod_openapi_1.z.string().openapi({
98
+ description: "CUID2 of the user creating the project.",
99
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
100
+ }),
101
+ title: zod_openapi_1.z.string().min(1).max(100).openapi({
102
+ description: "Title of the project, 1–100 characters.",
103
+ example: "E-commerce Mobile App",
104
+ }),
105
+ projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).default(constants_1.ROLES.CREATIVE).openapi({
106
+ description: "Type of creator who made this project.",
107
+ example: "CREATIVE",
108
+ }),
109
+ imagePlaceholderUrl: zod_openapi_1.z.url().openapi({
110
+ description: "URL for the placeholder image of the project.",
111
+ example: "https://img.com",
112
+ }),
113
+ id: zod_openapi_1.z.string().optional().openapi({
114
+ description: "CUID2 of the project.",
115
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
116
+ }),
117
+ description: zod_openapi_1.z.string().optional().openapi({
118
+ description: "Detailed description of the project, max 1000 characters.",
119
+ example: "A modern e-commerce mobile application built with React Native.",
120
+ }),
121
+ overview: zod_openapi_1.z.string().optional().openapi({
122
+ description: "Brief overview of the project.",
123
+ example: "A comprehensive e-commerce solution for mobile devices.",
124
+ }),
125
+ url: zod_openapi_1.z.string().optional().openapi({
126
+ description: "URL to the project or live demo.",
127
+ example: "https://example.com/project",
128
+ }),
129
+ clientId: zod_openapi_1.z.string().optional().openapi({
130
+ description: "CUID2 of the client if this is a client project.",
131
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
132
+ }),
33
133
  clientType: zod_openapi_1.z
34
- .enum(Object.values(constants_1.CLIENT_TYPES))
134
+ .enum(constants_1.CLIENT_TYPES)
35
135
  .optional()
36
- .openapi({ example: "BRAND" }),
37
- clientName: zod_openapi_1.z.string().optional().openapi({ example: "Nike" }),
38
- projectCreatorType: zod_openapi_1.z
39
- .enum(Object.values(constants_1.ROLES))
40
- .openapi({ example: "CREATIVE" }),
136
+ .default(constants_1.CLIENT_TYPES.NONE)
137
+ .openapi({
138
+ description: "Type of client for this project.",
139
+ example: "BRAND",
140
+ }),
141
+ clientName: zod_openapi_1.z.string().optional().openapi({
142
+ description: "Name of the client.",
143
+ example: "Acme Corp",
144
+ }),
41
145
  tags: zod_openapi_1.z
42
146
  .array(zod_openapi_1.z.string())
43
147
  .optional()
44
- .openapi({ example: ["branding", "logo"] }),
45
- isFeatured: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
148
+ .openapi({
149
+ description: "Array of tags associated with the project.",
150
+ example: ["react-native", "e-commerce", "mobile"],
151
+ }),
152
+ searchVector: zod_openapi_1.z.string().optional().openapi({
153
+ description: "Search vector for full-text search indexing.",
154
+ example: "ecommerce mobile app react native",
155
+ }),
156
+ isFeatured: zod_openapi_1.z.boolean().optional().openapi({
157
+ description: "Whether the project is featured.",
158
+ example: true,
159
+ }),
46
160
  startDate: zod_openapi_1.z.coerce
47
161
  .date()
48
162
  .optional()
49
- .openapi({ example: "2025-06-01T00:00:00.000Z" }),
163
+ .openapi({
164
+ description: "Start date of the project.",
165
+ example: new Date("2024-01-01"),
166
+ }),
50
167
  endDate: zod_openapi_1.z.coerce
51
168
  .date()
52
169
  .optional()
53
- .openapi({ example: "2025-07-15T00:00:00.000Z" }),
54
- imagePlaceholderUrl: zod_openapi_1.z
55
- .string()
56
- .url()
170
+ .openapi({
171
+ description: "End date of the project.",
172
+ example: new Date("2024-06-30"),
173
+ }),
174
+ createdAt: zod_openapi_1.z.coerce
175
+ .date()
176
+ .optional()
177
+ .openapi({
178
+ description: "Timestamp when the project was created.",
179
+ example: new Date("2024-01-01T00:00:00.000Z"),
180
+ }),
181
+ updatedAt: zod_openapi_1.z.coerce
182
+ .date()
183
+ .optional()
184
+ .openapi({
185
+ description: "Timestamp when the project was last updated.",
186
+ example: new Date("2024-06-30T00:00:00.000Z"),
187
+ }),
188
+ files: zod_openapi_1.z
189
+ .array(file_1.CreateFileInputSchema.extend({
190
+ isPlaceholder: zod_openapi_1.z.boolean().default(false),
191
+ order: zod_openapi_1.z.number().int().default(1),
192
+ }))
57
193
  .optional()
58
- .openapi({ example: "https://example.com/project-image.png" }),
194
+ .openapi({
195
+ description: "Array of files/images for the project.",
196
+ example: [],
197
+ }),
59
198
  })
60
- .openapi("ProjectEntity");
199
+ .openapi({
200
+ title: "Create Project",
201
+ description: "Schema for creating a new project.",
202
+ });
61
203
  exports.ProjectFileEntitySchema = zod_openapi_1.z
62
204
  .object({
63
- id: zod_openapi_1.z.cuid2().openapi({ example: "pfe_cksd0v6q0000s9a5y8z7p3x9" }),
64
- projectId: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
65
- url: zod_openapi_1.z
66
- .string()
67
- .url()
68
- .openapi({ example: "https://cdn.example.com/project/image.jpg" }),
69
- mimeType: zod_openapi_1.z.string().openapi({ example: "image/jpeg" }),
70
- fileSize: zod_openapi_1.z.number().int().positive().openapi({ example: 1500000 }), // size in bytes
205
+ isPlaceholder: zod_openapi_1.z.boolean().openapi({
206
+ description: "Indicates whether the file is a placeholder.",
207
+ example: false,
208
+ }),
209
+ order: zod_openapi_1.z.number().int().openapi({
210
+ description: "Order index of the file in the project.",
211
+ example: 1,
212
+ }),
213
+ projectId: zod_openapi_1.z.string().openapi({
214
+ description: "CUID2 of the project this file belongs to.",
215
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
216
+ }),
217
+ id: zod_openapi_1.z.string().openapi({
218
+ description: "CUID2 of the project file record.",
219
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
220
+ }),
221
+ fileId: zod_openapi_1.z.string().openapi({
222
+ description: "CUID2 of the linked file.",
223
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
224
+ }),
71
225
  })
72
- .openapi("ProjectFileEntity");
226
+ .openapi({
227
+ title: "Project File Entity",
228
+ description: "Schema representing a file associated with a project.",
229
+ });
73
230
  exports.ProjectSocialGraphEntitySchema = zod_openapi_1.z
74
231
  .object({
75
232
  noOfLikes: zod_openapi_1.z.number().int().optional().openapi({ example: 150 }),
@@ -149,31 +149,32 @@ export declare const UserProfileEntitySchema: z.ZodObject<{
149
149
  export declare const UserWithProjectsEntitySchema: z.ZodObject<{
150
150
  userId: z.ZodCUID2;
151
151
  projects: z.ZodArray<z.ZodObject<{
152
- id: z.ZodCUID2;
153
- userId: z.ZodCUID2;
152
+ id: z.ZodString;
153
+ userId: z.ZodString;
154
154
  description: z.ZodOptional<z.ZodString>;
155
155
  title: z.ZodString;
156
156
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
158
- updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
157
+ createdAt: z.ZodCoercedDate<unknown>;
158
+ updatedAt: z.ZodCoercedDate<unknown>;
159
159
  url: z.ZodOptional<z.ZodString>;
160
+ imagePlaceholderUrl: z.ZodString;
161
+ startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
162
+ endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
163
+ projectCreatorType: z.ZodEnum<{
164
+ readonly CREATIVE: "CREATIVE";
165
+ readonly BRAND: "BRAND";
166
+ readonly INVESTOR: "INVESTOR";
167
+ readonly ADMIN: "ADMIN";
168
+ }>;
160
169
  clientId: z.ZodOptional<z.ZodString>;
161
170
  clientType: z.ZodOptional<z.ZodEnum<{
162
- CREATIVE: "CREATIVE";
163
- BRAND: "BRAND";
164
- NONE: "NONE";
171
+ readonly CREATIVE: "CREATIVE";
172
+ readonly BRAND: "BRAND";
173
+ readonly NONE: "NONE";
165
174
  }>>;
166
175
  clientName: z.ZodOptional<z.ZodString>;
167
- projectCreatorType: z.ZodEnum<{
168
- CREATIVE: "CREATIVE";
169
- BRAND: "BRAND";
170
- INVESTOR: "INVESTOR";
171
- ADMIN: "ADMIN";
172
- }>;
173
176
  isFeatured: z.ZodOptional<z.ZodBoolean>;
174
- startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
175
- endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
176
- imagePlaceholderUrl: z.ZodOptional<z.ZodString>;
177
+ searchVector: z.ZodString;
177
178
  }, z.core.$strip>>;
178
179
  }, z.core.$strip>;
179
180
  export declare const UserWithProjectBookmarksEntitySchema: z.ZodObject<{
@@ -183,13 +184,13 @@ export declare const UserWithProjectBookmarksEntitySchema: z.ZodObject<{
183
184
  userId: z.ZodCUID2;
184
185
  projectId: z.ZodCUID2;
185
186
  project: z.ZodObject<{
186
- id: z.ZodCUID2;
187
+ id: z.ZodString;
187
188
  description: z.ZodOptional<z.ZodString>;
188
189
  title: z.ZodString;
189
190
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
+ imagePlaceholderUrl: z.ZodString;
190
192
  startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
191
193
  endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
192
- imagePlaceholderUrl: z.ZodOptional<z.ZodString>;
193
194
  }, z.core.$strip>;
194
195
  }, z.core.$strip>>;
195
196
  }, z.core.$strip>;
@@ -3,6 +3,9 @@ import { CreateFileInputSchema, CreateFileOutputSchema, DeleteFileInputParams, D
3
3
  export type FileEntity = z.infer<typeof FileEntitySchema>;
4
4
  export type FileUpdateEntity = z.infer<typeof FileUpdateEntitySchema>;
5
5
  export type GetPresignedUploadUrlInput = z.infer<typeof GetFilePresignedUploadUrlInputSchema>;
6
+ export type FileKeyInput = {
7
+ key: string;
8
+ };
6
9
  export type GetPresignedUploadUrlOutput = z.infer<typeof GetFilePresignedUploadUrlOutputSchema>;
7
10
  export type GetPresignedDownloadUrlInput = z.infer<typeof GetFilePresignedDownloadUrlParams>;
8
11
  export type GetPresignedDownloadUrlOutput = GetPresignedUploadUrlOutput;
@@ -1,6 +1,5 @@
1
1
  import type { ClientType, Role } from "../constants";
2
- import type { ProjectSocialGraphEntity } from "./common";
3
- import type { BaseUserEntity, MinimalUser } from "./user";
2
+ import type { MinimalUser } from "./user";
4
3
  export type ProjectFileEntity = {
5
4
  id: string;
6
5
  projectId: string;
@@ -27,9 +26,6 @@ export type ProjectEntity = {
27
26
  imagePlaceholderUrl?: string;
28
27
  endDate?: Date;
29
28
  };
30
- export type ProjectWithFilesEntity = ProjectEntity & ProjectSocialGraphEntity & {
31
- projectFiles?: ProjectFileEntity[];
32
- };
33
29
  export type ProjectViewEntity = {
34
30
  id: string;
35
31
  userId?: string;
@@ -65,12 +61,11 @@ export type MinimalProject = Pick<ProjectEntity, "id" | "title" | "description"
65
61
  export type ProjectWithClientEntity = MinimalProject & {
66
62
  client: MinimalUser;
67
63
  };
68
- export type ProjectWithUserEntity = MinimalProject & {
69
- user: Pick<BaseUserEntity, "id" | "name" | "email" | "image" | "username" | "role">;
64
+ export type ProjectWithProjectFilesEntity = MinimalProject & {
70
65
  projectFiles: (ProjectFileEntity & {
71
66
  fileUrl: string;
72
67
  })[];
73
- } & Partial<ProjectSocialGraphEntity>;
68
+ };
74
69
  export type ListProjectsInput = {
75
70
  query?: string;
76
71
  tags?: string[];
@@ -81,13 +76,13 @@ export type ListProjectsInput = {
81
76
  };
82
77
  export type ProjectWithProjectViewsEntity = MinimalProject & {
83
78
  views: ProjectViewEntity[];
84
- } & Partial<ProjectSocialGraphEntity>;
79
+ };
85
80
  export type ProjectWithProjectCommentsEntity = MinimalProject & {
86
81
  comments: ProjectCommentEntity[];
87
- } & Partial<ProjectSocialGraphEntity>;
82
+ };
88
83
  export type ProjectWithProjectLikesEntity = MinimalProject & {
89
84
  likes: ProjectLikeEntity[];
90
- } & Partial<ProjectSocialGraphEntity>;
85
+ };
91
86
  export type ProjectWithProjectBookmarksEntity = MinimalProject & {
92
87
  bookmarks: ProjectBookmarkEntity[];
93
- } & Partial<ProjectSocialGraphEntity>;
88
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,74 +1,235 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- import { CLIENT_TYPES, ClientType, Role, ROLES } from "../constants";
3
-
2
+ import { CLIENT_TYPES, ROLES } from "../constants";
3
+ import { CreateFileInputSchema } from "./file";
4
4
  export const ProjectEntitySchema = z
5
5
  .object({
6
- id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
7
- createdAt: z.coerce
8
- .date()
6
+ description: z.string().optional().openapi({
7
+ description: "Detailed description of the project, max 1000 characters.",
8
+ example:
9
+ "A modern e-commerce mobile application built with React Native.",
10
+ }),
11
+ title: z.string().openapi({
12
+ description: "Title of the project.",
13
+ example: "E-commerce Mobile App",
14
+ }),
15
+ url: z.string().optional().openapi({
16
+ description: "URL to the project or live demo.",
17
+ example: "https://example.com/project",
18
+ }),
19
+ imagePlaceholderUrl: z.string().url().openapi({
20
+ description: "URL for the placeholder image of the project.",
21
+ example: "https://img.com",
22
+ }),
23
+ tags: z
24
+ .array(z.string())
9
25
  .optional()
10
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
11
- updatedAt: z.coerce
26
+ .openapi({
27
+ description: "Array of tags associated with the project.",
28
+ example: ["react-native", "e-commerce", "mobile"],
29
+ }),
30
+ startDate: z.coerce
12
31
  .date()
13
32
  .optional()
14
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
15
- userId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
16
- title: z.string().openapi({ example: "Brand Identity Design" }),
17
- description: z
18
- .string()
19
- .optional()
20
- .openapi({ example: "A full rebrand for a fashion label." }),
21
- overview: z
22
- .string()
23
- .optional()
24
- .openapi({ example: "Detailed project story and outcomes." }),
25
- url: z
26
- .string()
27
- .url()
33
+ .openapi({
34
+ description: "Start date of the project.",
35
+ example: new Date("2024-01-01"),
36
+ }),
37
+ endDate: z.coerce
38
+ .date()
28
39
  .optional()
29
- .openapi({ example: "https://example.com/project" }),
30
- clientId: z.string().optional().openapi({ example: "client_abc123" }),
40
+ .openapi({
41
+ description: "End date of the project.",
42
+ example: new Date("2024-06-30"),
43
+ }),
44
+ overview: z.string().optional().openapi({
45
+ description: "Brief overview of the project.",
46
+ example: "A comprehensive e-commerce solution for mobile devices.",
47
+ }),
48
+ projectCreatorType: z.enum(ROLES).openapi({
49
+ description: "Type of creator who made this project.",
50
+ example: "CREATIVE",
51
+ }),
52
+ clientId: z.string().optional().openapi({
53
+ description: "CUID2 of the client if this is a client project.",
54
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
55
+ }),
56
+ clientType: z.enum(CLIENT_TYPES).optional().openapi({
57
+ description: "Type of client for this project.",
58
+ example: "BRAND",
59
+ }),
60
+ clientName: z.string().optional().openapi({
61
+ description: "Name of the client.",
62
+ example: "Acme Corp",
63
+ }),
64
+ id: z.string().openapi({
65
+ description: "CUID2 of the project.",
66
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
67
+ }),
68
+ isFeatured: z.boolean().optional().openapi({
69
+ description: "Whether the project is featured.",
70
+ example: true,
71
+ }),
72
+ createdAt: z.coerce.date().openapi({
73
+ description: "Timestamp when the project was created.",
74
+ example: new Date("2024-01-01T00:00:00.000Z"),
75
+ }),
76
+ updatedAt: z.coerce.date().openapi({
77
+ description: "Timestamp when the project was last updated.",
78
+ example: new Date("2024-06-30T00:00:00.000Z"),
79
+ }),
80
+ userId: z.string().openapi({
81
+ description: "CUID2 of the user who created the project.",
82
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
83
+ }),
84
+ searchVector: z.string().openapi({
85
+ description: "Search vector for full-text search indexing.",
86
+ example: "ecommerce mobile app react native",
87
+ }),
88
+ })
89
+ .openapi({
90
+ title: "Project DB Entity",
91
+ description: "Schema representing a project stored in the database.",
92
+ });
93
+
94
+ export const CreateProjectSchema = z
95
+ .object({
96
+ userId: z.string().openapi({
97
+ description: "CUID2 of the user creating the project.",
98
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
99
+ }),
100
+ title: z.string().min(1).max(100).openapi({
101
+ description: "Title of the project, 1–100 characters.",
102
+ example: "E-commerce Mobile App",
103
+ }),
104
+ projectCreatorType: z.enum(ROLES).default(ROLES.CREATIVE).openapi({
105
+ description: "Type of creator who made this project.",
106
+ example: "CREATIVE",
107
+ }),
108
+ imagePlaceholderUrl: z.url().openapi({
109
+ description: "URL for the placeholder image of the project.",
110
+ example: "https://img.com",
111
+ }),
112
+ id: z.string().optional().openapi({
113
+ description: "CUID2 of the project.",
114
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
115
+ }),
116
+ description: z.string().optional().openapi({
117
+ description: "Detailed description of the project, max 1000 characters.",
118
+ example:
119
+ "A modern e-commerce mobile application built with React Native.",
120
+ }),
121
+ overview: z.string().optional().openapi({
122
+ description: "Brief overview of the project.",
123
+ example: "A comprehensive e-commerce solution for mobile devices.",
124
+ }),
125
+ url: z.string().optional().openapi({
126
+ description: "URL to the project or live demo.",
127
+ example: "https://example.com/project",
128
+ }),
129
+ clientId: z.string().optional().openapi({
130
+ description: "CUID2 of the client if this is a client project.",
131
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
132
+ }),
31
133
  clientType: z
32
- .enum(Object.values(CLIENT_TYPES) as [ClientType, ...ClientType[]])
134
+ .enum(CLIENT_TYPES)
33
135
  .optional()
34
- .openapi({ example: "BRAND" }),
35
- clientName: z.string().optional().openapi({ example: "Nike" }),
36
- projectCreatorType: z
37
- .enum(Object.values(ROLES) as [Role, ...Role[]])
38
- .openapi({ example: "CREATIVE" }),
136
+ .default(CLIENT_TYPES.NONE)
137
+ .openapi({
138
+ description: "Type of client for this project.",
139
+ example: "BRAND",
140
+ }),
141
+ clientName: z.string().optional().openapi({
142
+ description: "Name of the client.",
143
+ example: "Acme Corp",
144
+ }),
39
145
  tags: z
40
146
  .array(z.string())
41
147
  .optional()
42
- .openapi({ example: ["branding", "logo"] }),
43
- isFeatured: z.boolean().optional().openapi({ example: false }),
148
+ .openapi({
149
+ description: "Array of tags associated with the project.",
150
+ example: ["react-native", "e-commerce", "mobile"],
151
+ }),
152
+ searchVector: z.string().optional().openapi({
153
+ description: "Search vector for full-text search indexing.",
154
+ example: "ecommerce mobile app react native",
155
+ }),
156
+ isFeatured: z.boolean().optional().openapi({
157
+ description: "Whether the project is featured.",
158
+ example: true,
159
+ }),
44
160
  startDate: z.coerce
45
161
  .date()
46
162
  .optional()
47
- .openapi({ example: "2025-06-01T00:00:00.000Z" }),
163
+ .openapi({
164
+ description: "Start date of the project.",
165
+ example: new Date("2024-01-01"),
166
+ }),
48
167
  endDate: z.coerce
49
168
  .date()
50
169
  .optional()
51
- .openapi({ example: "2025-07-15T00:00:00.000Z" }),
52
- imagePlaceholderUrl: z
53
- .string()
54
- .url()
170
+ .openapi({
171
+ description: "End date of the project.",
172
+ example: new Date("2024-06-30"),
173
+ }),
174
+ createdAt: z.coerce
175
+ .date()
176
+ .optional()
177
+ .openapi({
178
+ description: "Timestamp when the project was created.",
179
+ example: new Date("2024-01-01T00:00:00.000Z"),
180
+ }),
181
+ updatedAt: z.coerce
182
+ .date()
183
+ .optional()
184
+ .openapi({
185
+ description: "Timestamp when the project was last updated.",
186
+ example: new Date("2024-06-30T00:00:00.000Z"),
187
+ }),
188
+ files: z
189
+ .array(
190
+ CreateFileInputSchema.extend({
191
+ isPlaceholder: z.boolean().default(false),
192
+ order: z.number().int().default(1),
193
+ })
194
+ )
55
195
  .optional()
56
- .openapi({ example: "https://example.com/project-image.png" }),
196
+ .openapi({
197
+ description: "Array of files/images for the project.",
198
+ example: [],
199
+ }),
57
200
  })
58
- .openapi("ProjectEntity");
201
+ .openapi({
202
+ title: "Create Project",
203
+ description: "Schema for creating a new project.",
204
+ });
59
205
 
60
206
  export const ProjectFileEntitySchema = z
61
207
  .object({
62
- id: z.cuid2().openapi({ example: "pfe_cksd0v6q0000s9a5y8z7p3x9" }),
63
- projectId: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
64
- url: z
65
- .string()
66
- .url()
67
- .openapi({ example: "https://cdn.example.com/project/image.jpg" }),
68
- mimeType: z.string().openapi({ example: "image/jpeg" }),
69
- fileSize: z.number().int().positive().openapi({ example: 1500000 }), // size in bytes
208
+ isPlaceholder: z.boolean().openapi({
209
+ description: "Indicates whether the file is a placeholder.",
210
+ example: false,
211
+ }),
212
+ order: z.number().int().openapi({
213
+ description: "Order index of the file in the project.",
214
+ example: 1,
215
+ }),
216
+ projectId: z.string().openapi({
217
+ description: "CUID2 of the project this file belongs to.",
218
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
219
+ }),
220
+ id: z.string().openapi({
221
+ description: "CUID2 of the project file record.",
222
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
223
+ }),
224
+ fileId: z.string().openapi({
225
+ description: "CUID2 of the linked file.",
226
+ example: "ckl1y9xyz0000qv7a0h1efgh4",
227
+ }),
70
228
  })
71
- .openapi("ProjectFileEntity");
229
+ .openapi({
230
+ title: "Project File Entity",
231
+ description: "Schema representing a file associated with a project.",
232
+ });
72
233
 
73
234
  export const ProjectSocialGraphEntitySchema = z
74
235
  .object({
package/src/types/file.ts CHANGED
@@ -18,6 +18,9 @@ export type FileUpdateEntity = z.infer<typeof FileUpdateEntitySchema>;
18
18
  export type GetPresignedUploadUrlInput = z.infer<
19
19
  typeof GetFilePresignedUploadUrlInputSchema
20
20
  >;
21
+ export type FileKeyInput = {
22
+ key: string;
23
+ };
21
24
 
22
25
  export type GetPresignedUploadUrlOutput = z.infer<
23
26
  typeof GetFilePresignedUploadUrlOutputSchema
@@ -30,11 +30,6 @@ export type ProjectEntity = {
30
30
  endDate?: Date;
31
31
  };
32
32
 
33
- export type ProjectWithFilesEntity = ProjectEntity &
34
- ProjectSocialGraphEntity & {
35
- projectFiles?: ProjectFileEntity[];
36
- };
37
-
38
33
  export type ProjectViewEntity = {
39
34
  id: string;
40
35
  userId?: string;
@@ -51,7 +46,6 @@ export type ProjectLikeEntity = {
51
46
  userId: string;
52
47
  projectId: string;
53
48
  };
54
-
55
49
  export type ProjectCommentEntity = {
56
50
  id: string;
57
51
  createdAt: Date;
@@ -60,17 +54,14 @@ export type ProjectCommentEntity = {
60
54
  parentCommentId?: string;
61
55
  content: string;
62
56
  };
63
-
64
57
  export type ProjectBookmarkEntity = {
65
58
  createdAt: Date;
66
59
  userId: string;
67
60
  projectId: string;
68
61
  };
69
-
70
62
  export type ProjectUpdateOutputEntity = {
71
63
  id: string;
72
64
  };
73
-
74
65
  export type MinimalProject = Pick<
75
66
  ProjectEntity,
76
67
  | "id"
@@ -86,13 +77,11 @@ export type ProjectWithClientEntity = MinimalProject & {
86
77
  client: MinimalUser;
87
78
  };
88
79
 
89
- export type ProjectWithUserEntity = MinimalProject & {
90
- user: Pick<
91
- BaseUserEntity,
92
- "id" | "name" | "email" | "image" | "username" | "role"
93
- >;
94
- projectFiles: (ProjectFileEntity & { fileUrl: string })[];
95
- } & Partial<ProjectSocialGraphEntity>;
80
+ export type ProjectWithProjectFilesEntity = MinimalProject & {
81
+ projectFiles: (ProjectFileEntity & {
82
+ fileUrl: string;
83
+ })[];
84
+ };
96
85
 
97
86
  export type ListProjectsInput = {
98
87
  query?: string;
@@ -105,16 +94,16 @@ export type ListProjectsInput = {
105
94
 
106
95
  export type ProjectWithProjectViewsEntity = MinimalProject & {
107
96
  views: ProjectViewEntity[];
108
- } & Partial<ProjectSocialGraphEntity>;
97
+ };
109
98
 
110
99
  export type ProjectWithProjectCommentsEntity = MinimalProject & {
111
100
  comments: ProjectCommentEntity[];
112
- } & Partial<ProjectSocialGraphEntity>;
101
+ };
113
102
 
114
103
  export type ProjectWithProjectLikesEntity = MinimalProject & {
115
104
  likes: ProjectLikeEntity[];
116
- } & Partial<ProjectSocialGraphEntity>;
105
+ };
117
106
 
118
107
  export type ProjectWithProjectBookmarksEntity = MinimalProject & {
119
108
  bookmarks: ProjectBookmarkEntity[];
120
- } & Partial<ProjectSocialGraphEntity>;
109
+ };