@zyacreatives/shared 1.5.5 → 1.5.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.
- package/dist/schemas/project.d.ts +120 -135
- package/dist/schemas/project.js +132 -357
- package/dist/schemas/user.d.ts +8 -8
- package/dist/types/project.d.ts +12 -20
- package/package.json +1 -1
- package/src/schemas/project.ts +138 -371
- package/src/types/project.ts +35 -55
package/dist/schemas/project.js
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithProjectLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.ListProjectsInputSchema = exports.MinimalProjectSchema = exports.
|
|
3
|
+
exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithProjectLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.ListProjectsInputSchema = exports.MinimalProjectSchema = exports.CommentOnProjectParamsSchema = exports.ProjectIdSchema = exports.BookmarkProjectOutputSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.DeleteProjectCommentOutputSchema = exports.CommentOnProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.DeleteProjectCommentInputSchema = exports.CommentOnProjectInputSchema = exports.ViewProjectInputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.ProjectBookmarkEntitySchema = exports.ProjectCommentEntitySchema = exports.ProjectLikeEntitySchema = exports.ProjectViewEntitySchema = exports.ProjectWithFilesEntitySchema = 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");
|
|
7
|
+
/* ------------------------------ Core Entities ------------------------------ */
|
|
7
8
|
exports.ProjectEntitySchema = zod_openapi_1.z
|
|
8
9
|
.object({
|
|
9
|
-
|
|
10
|
-
description: "
|
|
11
|
-
example: "
|
|
10
|
+
id: zod_openapi_1.z.string().openapi({
|
|
11
|
+
description: "CUID2 of the project.",
|
|
12
|
+
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
13
|
+
}),
|
|
14
|
+
userId: zod_openapi_1.z.string().openapi({
|
|
15
|
+
description: "CUID2 of the user who created the project.",
|
|
16
|
+
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
12
17
|
}),
|
|
13
18
|
title: zod_openapi_1.z.string().openapi({
|
|
14
19
|
description: "Title of the project.",
|
|
15
20
|
example: "E-commerce Mobile App",
|
|
16
21
|
}),
|
|
22
|
+
description: zod_openapi_1.z.string().optional().openapi({
|
|
23
|
+
description: "Detailed description of the project, max 1000 characters.",
|
|
24
|
+
example: "A modern e-commerce mobile application built with React Native.",
|
|
25
|
+
}),
|
|
26
|
+
overview: zod_openapi_1.z.string().optional().openapi({
|
|
27
|
+
description: "Brief overview of the project.",
|
|
28
|
+
example: "A comprehensive e-commerce solution for mobile devices.",
|
|
29
|
+
}),
|
|
17
30
|
url: zod_openapi_1.z.string().optional().openapi({
|
|
18
31
|
description: "URL to the project or live demo.",
|
|
19
32
|
example: "https://example.com/project",
|
|
@@ -29,24 +42,6 @@ exports.ProjectEntitySchema = zod_openapi_1.z
|
|
|
29
42
|
description: "Array of tags associated with the project.",
|
|
30
43
|
example: ["react-native", "e-commerce", "mobile"],
|
|
31
44
|
}),
|
|
32
|
-
startDate: zod_openapi_1.z.coerce
|
|
33
|
-
.date()
|
|
34
|
-
.optional()
|
|
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()
|
|
41
|
-
.optional()
|
|
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
45
|
projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).openapi({
|
|
51
46
|
description: "Type of creator who made this project.",
|
|
52
47
|
example: "CREATIVE",
|
|
@@ -63,14 +58,28 @@ exports.ProjectEntitySchema = zod_openapi_1.z
|
|
|
63
58
|
description: "Name of the client.",
|
|
64
59
|
example: "Acme Corp",
|
|
65
60
|
}),
|
|
66
|
-
id: zod_openapi_1.z.string().openapi({
|
|
67
|
-
description: "CUID2 of the project.",
|
|
68
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
69
|
-
}),
|
|
70
61
|
isFeatured: zod_openapi_1.z.boolean().optional().openapi({
|
|
71
62
|
description: "Whether the project is featured.",
|
|
72
63
|
example: true,
|
|
73
64
|
}),
|
|
65
|
+
startDate: zod_openapi_1.z.coerce
|
|
66
|
+
.date()
|
|
67
|
+
.optional()
|
|
68
|
+
.openapi({
|
|
69
|
+
description: "Start date of the project.",
|
|
70
|
+
example: new Date("2024-01-01"),
|
|
71
|
+
}),
|
|
72
|
+
endDate: zod_openapi_1.z.coerce
|
|
73
|
+
.date()
|
|
74
|
+
.optional()
|
|
75
|
+
.openapi({
|
|
76
|
+
description: "End date of the project.",
|
|
77
|
+
example: new Date("2024-06-30"),
|
|
78
|
+
}),
|
|
79
|
+
searchVector: zod_openapi_1.z.string().openapi({
|
|
80
|
+
description: "Search vector for full-text search indexing.",
|
|
81
|
+
example: "ecommerce mobile app react native",
|
|
82
|
+
}),
|
|
74
83
|
createdAt: zod_openapi_1.z.coerce.date().openapi({
|
|
75
84
|
description: "Timestamp when the project was created.",
|
|
76
85
|
example: new Date("2024-01-01T00:00:00.000Z"),
|
|
@@ -79,14 +88,6 @@ exports.ProjectEntitySchema = zod_openapi_1.z
|
|
|
79
88
|
description: "Timestamp when the project was last updated.",
|
|
80
89
|
example: new Date("2024-06-30T00:00:00.000Z"),
|
|
81
90
|
}),
|
|
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
|
})
|
|
91
92
|
.openapi({
|
|
92
93
|
title: "Project DB Entity",
|
|
@@ -94,6 +95,13 @@ exports.ProjectEntitySchema = zod_openapi_1.z
|
|
|
94
95
|
});
|
|
95
96
|
exports.ProjectFileEntitySchema = zod_openapi_1.z
|
|
96
97
|
.object({
|
|
98
|
+
id: zod_openapi_1.z
|
|
99
|
+
.string()
|
|
100
|
+
.openapi({ description: "CUID2 of the project file record." }),
|
|
101
|
+
projectId: zod_openapi_1.z.string().openapi({
|
|
102
|
+
description: "CUID2 of the project this file belongs to.",
|
|
103
|
+
}),
|
|
104
|
+
fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
97
105
|
isPlaceholder: zod_openapi_1.z.boolean().openapi({
|
|
98
106
|
description: "Indicates whether the file is a placeholder.",
|
|
99
107
|
example: false,
|
|
@@ -102,18 +110,6 @@ exports.ProjectFileEntitySchema = zod_openapi_1.z
|
|
|
102
110
|
description: "Order index of the file in the project.",
|
|
103
111
|
example: 1,
|
|
104
112
|
}),
|
|
105
|
-
projectId: zod_openapi_1.z.string().openapi({
|
|
106
|
-
description: "CUID2 of the project this file belongs to.",
|
|
107
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
108
|
-
}),
|
|
109
|
-
id: zod_openapi_1.z.string().openapi({
|
|
110
|
-
description: "CUID2 of the project file record.",
|
|
111
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
112
|
-
}),
|
|
113
|
-
fileId: zod_openapi_1.z.string().openapi({
|
|
114
|
-
description: "CUID2 of the linked file.",
|
|
115
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
116
|
-
}),
|
|
117
113
|
})
|
|
118
114
|
.openapi({
|
|
119
115
|
title: "Project File Entity",
|
|
@@ -127,6 +123,7 @@ exports.ProjectSocialGraphEntitySchema = zod_openapi_1.z
|
|
|
127
123
|
noOfViews: zod_openapi_1.z.number().int().optional().openapi({ example: 1200 }),
|
|
128
124
|
})
|
|
129
125
|
.openapi("ProjectSocialGraphEntity");
|
|
126
|
+
/* ------------------------------ Derived Entities ------------------------------ */
|
|
130
127
|
exports.ProjectWithFilesEntitySchema = exports.ProjectEntitySchema.extend({
|
|
131
128
|
projectFiles: zod_openapi_1.z
|
|
132
129
|
.array(exports.ProjectFileEntitySchema.extend({
|
|
@@ -134,329 +131,141 @@ exports.ProjectWithFilesEntitySchema = exports.ProjectEntitySchema.extend({
|
|
|
134
131
|
}))
|
|
135
132
|
.optional()
|
|
136
133
|
.openapi({ description: "Files associated with the project." }),
|
|
137
|
-
}).openapi({
|
|
138
|
-
title: "ProjectWithFilesEntity",
|
|
139
|
-
});
|
|
134
|
+
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
140
135
|
exports.ProjectViewEntitySchema = zod_openapi_1.z
|
|
141
136
|
.object({
|
|
142
|
-
id: zod_openapi_1.z.cuid2()
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
sessionId: zod_openapi_1.z.string().optional().openapi({ example: "sess_xyz789" }),
|
|
151
|
-
viewedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-14T10:30:00.000Z" }),
|
|
152
|
-
viewDate: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-14T00:00:00.000Z" }),
|
|
137
|
+
id: zod_openapi_1.z.cuid2(),
|
|
138
|
+
projectId: zod_openapi_1.z.cuid2(),
|
|
139
|
+
userId: zod_openapi_1.z.cuid2().optional(),
|
|
140
|
+
ipAddress: zod_openapi_1.z.ipv4().optional(),
|
|
141
|
+
userAgent: zod_openapi_1.z.string().optional(),
|
|
142
|
+
sessionId: zod_openapi_1.z.string().optional(),
|
|
143
|
+
viewedAt: zod_openapi_1.z.coerce.date(),
|
|
144
|
+
viewDate: zod_openapi_1.z.coerce.date(),
|
|
153
145
|
})
|
|
154
146
|
.openapi("ProjectViewEntity");
|
|
155
147
|
exports.ProjectLikeEntitySchema = zod_openapi_1.z
|
|
156
148
|
.object({
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
.openapi({ example: "2025-10-13T11:00:00.000Z" }),
|
|
161
|
-
userId: zod_openapi_1.z.cuid2().openapi({ example: "user_liker_123" }),
|
|
162
|
-
projectId: zod_openapi_1.z.cuid2().openapi({ example: "proj_abc456" }),
|
|
149
|
+
projectId: zod_openapi_1.z.cuid2(),
|
|
150
|
+
userId: zod_openapi_1.z.cuid2(),
|
|
151
|
+
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
163
152
|
})
|
|
164
153
|
.openapi("ProjectLikeEntity");
|
|
165
154
|
exports.ProjectCommentEntitySchema = zod_openapi_1.z
|
|
166
155
|
.object({
|
|
167
|
-
id: zod_openapi_1.z.cuid2()
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
projectId: zod_openapi_1.z.cuid2().openapi({ example: "proj_abc456" }),
|
|
174
|
-
parentCommentId: zod_openapi_1.z
|
|
175
|
-
.cuid2()
|
|
176
|
-
.optional()
|
|
177
|
-
.openapi({ example: "comment_id_parent_1" }),
|
|
178
|
-
content: zod_openapi_1.z
|
|
179
|
-
.string()
|
|
180
|
-
.min(1)
|
|
181
|
-
.openapi({ example: "Amazing work on the color palette!" }),
|
|
156
|
+
id: zod_openapi_1.z.cuid2(),
|
|
157
|
+
projectId: zod_openapi_1.z.cuid2(),
|
|
158
|
+
userId: zod_openapi_1.z.cuid2(),
|
|
159
|
+
parentCommentId: zod_openapi_1.z.cuid2().optional(),
|
|
160
|
+
content: zod_openapi_1.z.string().min(1),
|
|
161
|
+
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
182
162
|
})
|
|
183
163
|
.openapi("ProjectCommentEntity");
|
|
184
164
|
exports.ProjectBookmarkEntitySchema = zod_openapi_1.z
|
|
185
165
|
.object({
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
.openapi({ example: "2025-10-13T13:00:00.000Z" }),
|
|
190
|
-
userId: zod_openapi_1.z.cuid2().openapi({ example: "user_bookmark_789" }),
|
|
191
|
-
projectId: zod_openapi_1.z.cuid2().openapi({ example: "proj_abc456" }),
|
|
166
|
+
projectId: zod_openapi_1.z.cuid2(),
|
|
167
|
+
userId: zod_openapi_1.z.cuid2(),
|
|
168
|
+
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
192
169
|
})
|
|
193
170
|
.openapi("ProjectBookmarkEntity");
|
|
194
171
|
exports.ProjectUpdateOutputEntitySchema = zod_openapi_1.z
|
|
195
|
-
.object({
|
|
196
|
-
id: zod_openapi_1.z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
197
|
-
})
|
|
172
|
+
.object({ id: zod_openapi_1.z.cuid2() })
|
|
198
173
|
.openapi("ProjectUpdateOutputEntity");
|
|
199
174
|
exports.CreateProjectInputSchema = zod_openapi_1.z
|
|
200
175
|
.object({
|
|
201
|
-
title: zod_openapi_1.z.string().min(1).max(100)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
tags: zod_openapi_1.z
|
|
215
|
-
.array(zod_openapi_1.z.string())
|
|
216
|
-
.default([])
|
|
217
|
-
.openapi({
|
|
218
|
-
description: "Array of tags associated with the project.",
|
|
219
|
-
example: ["react-native", "e-commerce", "mobile"],
|
|
220
|
-
}),
|
|
221
|
-
startDate: zod_openapi_1.z.coerce.date().openapi({
|
|
222
|
-
description: "Start date of the project.",
|
|
223
|
-
example: new Date("2024-01-01"),
|
|
224
|
-
}),
|
|
225
|
-
endDate: zod_openapi_1.z.coerce
|
|
226
|
-
.date()
|
|
227
|
-
.optional()
|
|
228
|
-
.openapi({
|
|
229
|
-
description: "End date of the project.",
|
|
230
|
-
example: new Date("2024-06-30"),
|
|
231
|
-
}),
|
|
232
|
-
overview: zod_openapi_1.z.string().optional().openapi({
|
|
233
|
-
description: "Brief overview of the project.",
|
|
234
|
-
example: "A comprehensive e-commerce solution for mobile devices.",
|
|
235
|
-
}),
|
|
236
|
-
projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).default(constants_1.ROLES.CREATIVE).openapi({
|
|
237
|
-
description: "Type of creator who made this project.",
|
|
238
|
-
example: "CREATIVE",
|
|
239
|
-
}),
|
|
240
|
-
clientId: zod_openapi_1.z.string().optional().openapi({
|
|
241
|
-
description: "CUID2 of the client if this is a client project.",
|
|
242
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
243
|
-
}),
|
|
244
|
-
clientType: zod_openapi_1.z.enum(constants_1.CLIENT_TYPES).default(constants_1.CLIENT_TYPES.NONE).openapi({
|
|
245
|
-
description: "Type of client for this project.",
|
|
246
|
-
example: "BRAND",
|
|
247
|
-
}),
|
|
248
|
-
clientName: zod_openapi_1.z.string().optional().default("").openapi({
|
|
249
|
-
description: "Name of the client.",
|
|
250
|
-
example: "Acme Corp",
|
|
251
|
-
}),
|
|
252
|
-
files: zod_openapi_1.z
|
|
253
|
-
.array(file_1.CreateFileInputSchema.extend({
|
|
176
|
+
title: zod_openapi_1.z.string().min(1).max(100),
|
|
177
|
+
description: zod_openapi_1.z.string().max(1000).optional(),
|
|
178
|
+
overview: zod_openapi_1.z.string().optional(),
|
|
179
|
+
url: zod_openapi_1.z.string(),
|
|
180
|
+
imagePlaceholderUrl: zod_openapi_1.z.url(),
|
|
181
|
+
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).default([]),
|
|
182
|
+
startDate: zod_openapi_1.z.coerce.date(),
|
|
183
|
+
endDate: zod_openapi_1.z.coerce.date().optional(),
|
|
184
|
+
projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).default(constants_1.ROLES.CREATIVE),
|
|
185
|
+
clientId: zod_openapi_1.z.string().optional(),
|
|
186
|
+
clientType: zod_openapi_1.z.enum(constants_1.CLIENT_TYPES).default(constants_1.CLIENT_TYPES.NONE),
|
|
187
|
+
clientName: zod_openapi_1.z.string().optional(),
|
|
188
|
+
files: zod_openapi_1.z.array(file_1.CreateFileInputSchema.extend({
|
|
254
189
|
isPlaceholder: zod_openapi_1.z.boolean().default(false),
|
|
255
190
|
order: zod_openapi_1.z.int().default(1),
|
|
256
|
-
}))
|
|
257
|
-
.openapi({
|
|
258
|
-
description: "Array of files/images for the project.",
|
|
259
|
-
example: [],
|
|
260
|
-
}),
|
|
191
|
+
})),
|
|
261
192
|
})
|
|
262
193
|
.superRefine(({ startDate, endDate }, ctx) => {
|
|
263
194
|
const today = new Date();
|
|
264
195
|
today.setHours(0, 0, 0, 0);
|
|
265
|
-
if (startDate > today)
|
|
196
|
+
if (startDate > today)
|
|
266
197
|
ctx.addIssue({
|
|
267
198
|
path: ["startDate"],
|
|
268
199
|
code: "custom",
|
|
269
200
|
message: "Start date cannot be in the future",
|
|
270
201
|
});
|
|
271
|
-
}
|
|
272
202
|
if (endDate) {
|
|
273
|
-
if (endDate > today)
|
|
203
|
+
if (endDate > today)
|
|
274
204
|
ctx.addIssue({
|
|
275
205
|
path: ["endDate"],
|
|
276
206
|
code: "custom",
|
|
277
207
|
message: "End date cannot be in the future",
|
|
278
208
|
});
|
|
279
|
-
|
|
280
|
-
if (startDate > endDate) {
|
|
209
|
+
if (startDate > endDate)
|
|
281
210
|
ctx.addIssue({
|
|
282
211
|
path: ["startDate"],
|
|
283
212
|
code: "custom",
|
|
284
213
|
message: "Start date cannot be after end date",
|
|
285
214
|
});
|
|
286
|
-
}
|
|
287
215
|
}
|
|
288
216
|
})
|
|
289
|
-
.openapi({
|
|
290
|
-
title: "Create Project",
|
|
291
|
-
description: "Schema for creating a new project.",
|
|
292
|
-
});
|
|
293
|
-
exports.CreateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
217
|
+
.openapi({ title: "Create Project" });
|
|
294
218
|
exports.UpdateProjectInputSchema = zod_openapi_1.z
|
|
295
219
|
.object({
|
|
296
|
-
id: zod_openapi_1.z.cuid2()
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
description: "Updated overview of the project.",
|
|
313
|
-
example: "Updated project overview.",
|
|
314
|
-
}),
|
|
315
|
-
url: zod_openapi_1.z.url().optional().openapi({
|
|
316
|
-
description: "Updated URL to the project or live demo.",
|
|
317
|
-
example: "https://updated-example.com/project",
|
|
318
|
-
}),
|
|
319
|
-
clientId: zod_openapi_1.z.cuid2().optional().openapi({
|
|
320
|
-
description: "Updated client ID.",
|
|
321
|
-
example: "ckl1y9xyz0000qv7a0h1efgh5",
|
|
322
|
-
}),
|
|
323
|
-
clientType: zod_openapi_1.z.enum(["CREATIVE", "BRAND", "NONE"]).optional().openapi({
|
|
324
|
-
description: "Updated client type.",
|
|
325
|
-
example: "BRAND",
|
|
326
|
-
}),
|
|
327
|
-
clientName: zod_openapi_1.z.string().optional().openapi({
|
|
328
|
-
description: "Updated client name.",
|
|
329
|
-
example: "Updated Acme Corp",
|
|
330
|
-
}),
|
|
331
|
-
projectCreatorType: zod_openapi_1.z
|
|
332
|
-
.enum(["CREATIVE", "BRAND", "INVESTOR", "ADMIN"])
|
|
333
|
-
.optional()
|
|
334
|
-
.openapi({
|
|
335
|
-
description: "Updated project creator type.",
|
|
336
|
-
example: "CREATIVE",
|
|
337
|
-
}),
|
|
338
|
-
tags: zod_openapi_1.z
|
|
339
|
-
.array(zod_openapi_1.z.string())
|
|
340
|
-
.optional()
|
|
341
|
-
.openapi({
|
|
342
|
-
description: "Updated array of tags.",
|
|
343
|
-
example: ["react-native", "e-commerce", "mobile", "updated"],
|
|
344
|
-
}),
|
|
345
|
-
isFeatured: zod_openapi_1.z.boolean().optional().openapi({
|
|
346
|
-
description: "Whether the project should be featured.",
|
|
347
|
-
example: true,
|
|
348
|
-
}),
|
|
349
|
-
startDate: zod_openapi_1.z
|
|
350
|
-
.date()
|
|
351
|
-
.optional()
|
|
352
|
-
.openapi({
|
|
353
|
-
description: "Updated start date of the project.",
|
|
354
|
-
example: new Date("2024-02-01"),
|
|
355
|
-
}),
|
|
356
|
-
endDate: zod_openapi_1.z
|
|
357
|
-
.date()
|
|
358
|
-
.optional()
|
|
359
|
-
.openapi({
|
|
360
|
-
description: "Updated end date of the project.",
|
|
361
|
-
example: new Date("2024-07-30"),
|
|
362
|
-
}),
|
|
363
|
-
createdAt: zod_openapi_1.z
|
|
364
|
-
.date()
|
|
365
|
-
.optional()
|
|
366
|
-
.openapi({
|
|
367
|
-
description: "Creation date (read-only).",
|
|
368
|
-
example: new Date("2024-01-01T12:00:00Z"),
|
|
369
|
-
}),
|
|
370
|
-
updatedAt: zod_openapi_1.z
|
|
371
|
-
.date()
|
|
372
|
-
.optional()
|
|
373
|
-
.openapi({
|
|
374
|
-
description: "Last update date (read-only).",
|
|
375
|
-
example: new Date("2024-06-30T18:00:00Z"),
|
|
376
|
-
}),
|
|
220
|
+
id: zod_openapi_1.z.cuid2(),
|
|
221
|
+
title: zod_openapi_1.z.string().optional(),
|
|
222
|
+
description: zod_openapi_1.z.string().optional(),
|
|
223
|
+
overview: zod_openapi_1.z.string().optional(),
|
|
224
|
+
url: zod_openapi_1.z.url().optional(),
|
|
225
|
+
imagePlaceholderUrl: zod_openapi_1.z.url().optional(),
|
|
226
|
+
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
|
|
227
|
+
projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).optional(),
|
|
228
|
+
clientId: zod_openapi_1.z.cuid2().optional(),
|
|
229
|
+
clientType: zod_openapi_1.z.enum(constants_1.CLIENT_TYPES).optional(),
|
|
230
|
+
clientName: zod_openapi_1.z.string().optional(),
|
|
231
|
+
isFeatured: zod_openapi_1.z.boolean().optional(),
|
|
232
|
+
startDate: zod_openapi_1.z.date().optional(),
|
|
233
|
+
endDate: zod_openapi_1.z.date().optional(),
|
|
234
|
+
createdAt: zod_openapi_1.z.date().optional(),
|
|
235
|
+
updatedAt: zod_openapi_1.z.date().optional(),
|
|
377
236
|
})
|
|
378
|
-
.openapi({
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
});
|
|
382
|
-
exports.UpdateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
383
|
-
exports.ProjectIdSchema = zod_openapi_1.z.object({
|
|
237
|
+
.openapi({ title: "Update Project" });
|
|
238
|
+
exports.ViewProjectInputSchema = zod_openapi_1.z
|
|
239
|
+
.object({
|
|
384
240
|
projectId: zod_openapi_1.z.cuid2(),
|
|
385
|
-
|
|
386
|
-
|
|
241
|
+
id: zod_openapi_1.z.cuid2().optional(),
|
|
242
|
+
userId: zod_openapi_1.z.cuid2().optional(),
|
|
243
|
+
sessionId: zod_openapi_1.z.string().optional(),
|
|
244
|
+
ipAddress: zod_openapi_1.z.string().optional(),
|
|
245
|
+
userAgent: zod_openapi_1.z.string().optional(),
|
|
246
|
+
viewedAt: zod_openapi_1.z.date().optional(),
|
|
247
|
+
viewDate: zod_openapi_1.z.date().optional(),
|
|
248
|
+
})
|
|
249
|
+
.openapi({ title: "View Project" });
|
|
387
250
|
exports.CommentOnProjectInputSchema = zod_openapi_1.z
|
|
388
251
|
.object({
|
|
389
|
-
content: zod_openapi_1.z.string()
|
|
390
|
-
|
|
391
|
-
example: "This is a great project!",
|
|
392
|
-
}),
|
|
393
|
-
parentCommentId: zod_openapi_1.z.cuid2().optional().openapi({
|
|
394
|
-
description: "CUID2 of the parent comment if this is a reply.",
|
|
395
|
-
example: "ckl1z0abc0000qv7a0h1abcd4",
|
|
396
|
-
}),
|
|
252
|
+
content: zod_openapi_1.z.string(),
|
|
253
|
+
parentCommentId: zod_openapi_1.z.cuid2().optional(),
|
|
397
254
|
})
|
|
398
|
-
.openapi({
|
|
399
|
-
|
|
400
|
-
description: "Schema for commenting on a project.",
|
|
401
|
-
});
|
|
402
|
-
exports.CommentOnProjectOutputSchema = exports.ProjectCommentEntitySchema;
|
|
403
|
-
exports.DeleteProjectInputSchema = exports.ProjectIdSchema;
|
|
404
|
-
exports.DeleteProjectCommentParamsSchema = zod_openapi_1.z.object({
|
|
255
|
+
.openapi({ title: "Comment on Project" });
|
|
256
|
+
exports.DeleteProjectCommentInputSchema = zod_openapi_1.z.object({
|
|
405
257
|
commentId: zod_openapi_1.z.cuid2(),
|
|
406
258
|
});
|
|
259
|
+
/* ------------------------------ Output Schemas ------------------------------ */
|
|
260
|
+
exports.CreateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
261
|
+
exports.UpdateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
262
|
+
exports.CommentOnProjectOutputSchema = exports.ProjectCommentEntitySchema;
|
|
407
263
|
exports.DeleteProjectCommentOutputSchema = exports.ProjectCommentEntitySchema;
|
|
408
264
|
exports.DeleteProjectOutputSchema = exports.ProjectEntitySchema;
|
|
409
|
-
exports.GetProjectParamsSchema = exports.ProjectIdSchema;
|
|
410
265
|
exports.GetProjectOutputSchema = exports.ProjectWithFilesEntitySchema;
|
|
411
|
-
exports.BookmarkProjectParamsSchema = exports.ProjectIdSchema;
|
|
412
266
|
exports.BookmarkProjectOutputSchema = exports.ProjectBookmarkEntitySchema;
|
|
413
|
-
exports.
|
|
414
|
-
exports.
|
|
415
|
-
exports.ViewProjectInputSchema = zod_openapi_1.z
|
|
416
|
-
.object({
|
|
417
|
-
projectId: zod_openapi_1.z.cuid2().openapi({
|
|
418
|
-
description: "CUID2 identifier of the project being viewed.",
|
|
419
|
-
example: "ckl1z0abc0000qv7a0h1abcd2",
|
|
420
|
-
}),
|
|
421
|
-
id: zod_openapi_1.z.cuid2().optional().openapi({
|
|
422
|
-
description: "CUID2 identifier of the view record (auto-generated).",
|
|
423
|
-
example: "ckl1z0abc0000qv7a0h1abcd5",
|
|
424
|
-
}),
|
|
425
|
-
userId: zod_openapi_1.z.cuid2().optional().openapi({
|
|
426
|
-
description: "CUID2 of the user who viewed the project.",
|
|
427
|
-
example: "ckl1y9xyz0000qv7a0h1efgh3",
|
|
428
|
-
}),
|
|
429
|
-
sessionId: zod_openapi_1.z.string().optional().openapi({
|
|
430
|
-
description: "Session ID for anonymous users.",
|
|
431
|
-
example: "sess_123456789",
|
|
432
|
-
}),
|
|
433
|
-
ipAddress: zod_openapi_1.z.string().optional().openapi({
|
|
434
|
-
description: "IP address of the viewer.",
|
|
435
|
-
example: "192.168.1.1",
|
|
436
|
-
}),
|
|
437
|
-
userAgent: zod_openapi_1.z.string().optional().openapi({
|
|
438
|
-
description: "User agent string of the viewer.",
|
|
439
|
-
example: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
|
|
440
|
-
}),
|
|
441
|
-
viewedAt: zod_openapi_1.z
|
|
442
|
-
.date()
|
|
443
|
-
.optional()
|
|
444
|
-
.openapi({
|
|
445
|
-
description: "Date and time when the project was viewed.",
|
|
446
|
-
example: new Date("2024-01-15T14:30:00Z"),
|
|
447
|
-
}),
|
|
448
|
-
viewDate: zod_openapi_1.z
|
|
449
|
-
.date()
|
|
450
|
-
.optional()
|
|
451
|
-
.openapi({
|
|
452
|
-
description: "Date when the project was viewed.",
|
|
453
|
-
example: new Date("2024-01-15"),
|
|
454
|
-
}),
|
|
455
|
-
})
|
|
456
|
-
.openapi({
|
|
457
|
-
title: "View Project",
|
|
458
|
-
description: "Schema for recording a project view.",
|
|
459
|
-
});
|
|
267
|
+
exports.ProjectIdSchema = zod_openapi_1.z.object({ projectId: zod_openapi_1.z.cuid2() });
|
|
268
|
+
exports.CommentOnProjectParamsSchema = exports.ProjectIdSchema;
|
|
460
269
|
exports.MinimalProjectSchema = exports.ProjectEntitySchema.pick({
|
|
461
270
|
id: true,
|
|
462
271
|
title: true,
|
|
@@ -467,71 +276,37 @@ exports.MinimalProjectSchema = exports.ProjectEntitySchema.pick({
|
|
|
467
276
|
imagePlaceholderUrl: true,
|
|
468
277
|
}).openapi({
|
|
469
278
|
title: "MinimalProject",
|
|
470
|
-
description: "Subset of project fields for lightweight listings.",
|
|
471
279
|
});
|
|
472
280
|
exports.ListProjectsInputSchema = zod_openapi_1.z
|
|
473
281
|
.object({
|
|
474
|
-
query: zod_openapi_1.z.string().optional()
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
.optional()
|
|
481
|
-
.openapi({
|
|
482
|
-
description: "Tags to filter projects by.",
|
|
483
|
-
example: ["react", "design"],
|
|
484
|
-
}),
|
|
485
|
-
clientName: zod_openapi_1.z.string().optional().openapi({
|
|
486
|
-
description: "Client name to filter projects by.",
|
|
487
|
-
example: "Acme Corp",
|
|
488
|
-
}),
|
|
489
|
-
userId: zod_openapi_1.z.string().optional().openapi({
|
|
490
|
-
description: "Filter projects by user ID.",
|
|
491
|
-
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
492
|
-
}),
|
|
493
|
-
page: zod_openapi_1.z.number().int().optional().default(1).openapi({
|
|
494
|
-
description: "Page number for pagination.",
|
|
495
|
-
example: 1,
|
|
496
|
-
}),
|
|
497
|
-
perPage: zod_openapi_1.z.number().int().optional().default(10).openapi({
|
|
498
|
-
description: "Number of items per page.",
|
|
499
|
-
example: 10,
|
|
500
|
-
}),
|
|
282
|
+
query: zod_openapi_1.z.string().optional(),
|
|
283
|
+
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
|
|
284
|
+
clientName: zod_openapi_1.z.string().optional(),
|
|
285
|
+
userId: zod_openapi_1.z.string().optional(),
|
|
286
|
+
page: zod_openapi_1.z.number().int().optional().default(1),
|
|
287
|
+
perPage: zod_openapi_1.z.number().int().optional().default(10),
|
|
501
288
|
})
|
|
502
289
|
.openapi({
|
|
503
290
|
title: "ListProjectsInput",
|
|
504
|
-
description: "Parameters for listing or searching projects.",
|
|
505
291
|
});
|
|
292
|
+
/* ------------------------------ Aggregates ------------------------------ */
|
|
506
293
|
exports.ProjectWithProjectViewsEntitySchema = exports.MinimalProjectSchema.extend({
|
|
507
|
-
views: zod_openapi_1.z.array(exports.ProjectViewEntitySchema)
|
|
508
|
-
description: "Array of project view records.",
|
|
509
|
-
}),
|
|
294
|
+
views: zod_openapi_1.z.array(exports.ProjectViewEntitySchema),
|
|
510
295
|
}).openapi({
|
|
511
296
|
title: "ProjectWithProjectViewsEntity",
|
|
512
|
-
description: "Project entity with associated views.",
|
|
513
297
|
});
|
|
514
298
|
exports.ProjectWithProjectCommentsEntitySchema = exports.MinimalProjectSchema.extend({
|
|
515
|
-
comments: zod_openapi_1.z.array(exports.ProjectCommentEntitySchema)
|
|
516
|
-
description: "Array of comments on the project.",
|
|
517
|
-
}),
|
|
299
|
+
comments: zod_openapi_1.z.array(exports.ProjectCommentEntitySchema),
|
|
518
300
|
}).openapi({
|
|
519
301
|
title: "ProjectWithProjectCommentsEntity",
|
|
520
|
-
description: "Project entity with associated comments.",
|
|
521
302
|
});
|
|
522
303
|
exports.ProjectWithProjectLikesEntitySchema = exports.MinimalProjectSchema.extend({
|
|
523
|
-
likes: zod_openapi_1.z.array(exports.ProjectLikeEntitySchema)
|
|
524
|
-
description: "Array of likes on the project.",
|
|
525
|
-
}),
|
|
304
|
+
likes: zod_openapi_1.z.array(exports.ProjectLikeEntitySchema),
|
|
526
305
|
}).openapi({
|
|
527
306
|
title: "ProjectWithProjectLikesEntity",
|
|
528
|
-
description: "Project entity with associated likes.",
|
|
529
307
|
});
|
|
530
308
|
exports.ProjectWithProjectBookmarksEntitySchema = exports.MinimalProjectSchema.extend({
|
|
531
|
-
bookmarks: zod_openapi_1.z.array(exports.ProjectBookmarkEntitySchema)
|
|
532
|
-
description: "Array of bookmarks for the project.",
|
|
533
|
-
}),
|
|
309
|
+
bookmarks: zod_openapi_1.z.array(exports.ProjectBookmarkEntitySchema),
|
|
534
310
|
}).openapi({
|
|
535
311
|
title: "ProjectWithProjectBookmarksEntity",
|
|
536
|
-
description: "Project entity with associated bookmarks.",
|
|
537
312
|
});
|