@zyacreatives/shared 2.1.78 → 2.1.79
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 +22 -15
- package/dist/schemas/project.js +23 -21
- package/dist/schemas/user.d.ts +2 -0
- package/dist/types/project.d.ts +3 -3
- package/package.json +1 -1
- package/src/schemas/project.ts +240 -239
- package/src/types/project.ts +23 -23
|
@@ -26,6 +26,7 @@ export declare const ProjectEntitySchema: z.ZodObject<{
|
|
|
26
26
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
27
27
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
28
28
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
29
|
+
version: z.ZodInt;
|
|
29
30
|
}, z.core.$strip>;
|
|
30
31
|
export declare const ProjectFileEntitySchema: z.ZodObject<{
|
|
31
32
|
id: z.ZodString;
|
|
@@ -67,6 +68,7 @@ export declare const ProjectDetailsEntitySchema: z.ZodObject<{
|
|
|
67
68
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
68
69
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
69
70
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
71
|
+
version: z.ZodInt;
|
|
70
72
|
user: z.ZodObject<{
|
|
71
73
|
email: z.ZodEmail;
|
|
72
74
|
username: z.ZodOptional<z.ZodString>;
|
|
@@ -155,16 +157,7 @@ export declare const UpdateProjectInputSchema: z.ZodObject<{
|
|
|
155
157
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
156
158
|
createdAt: z.ZodOptional<z.ZodDate>;
|
|
157
159
|
updatedAt: z.ZodOptional<z.ZodDate>;
|
|
158
|
-
|
|
159
|
-
export declare const ViewProjectInputSchema: z.ZodObject<{
|
|
160
|
-
projectId: z.ZodCUID2;
|
|
161
|
-
id: z.ZodOptional<z.ZodCUID2>;
|
|
162
|
-
userId: z.ZodOptional<z.ZodCUID2>;
|
|
163
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
164
|
-
ipAddress: z.ZodOptional<z.ZodString>;
|
|
165
|
-
userAgent: z.ZodOptional<z.ZodString>;
|
|
166
|
-
viewedAt: z.ZodOptional<z.ZodDate>;
|
|
167
|
-
viewDate: z.ZodOptional<z.ZodDate>;
|
|
160
|
+
version: z.ZodInt;
|
|
168
161
|
}, z.core.$strip>;
|
|
169
162
|
export declare const CreateProjectOutputSchema: z.ZodObject<{
|
|
170
163
|
id: z.ZodString;
|
|
@@ -193,6 +186,7 @@ export declare const CreateProjectOutputSchema: z.ZodObject<{
|
|
|
193
186
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
194
187
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
195
188
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
189
|
+
version: z.ZodInt;
|
|
196
190
|
}, z.core.$strip>;
|
|
197
191
|
export declare const UpdateProjectOutputSchema: z.ZodObject<{
|
|
198
192
|
id: z.ZodString;
|
|
@@ -221,6 +215,7 @@ export declare const UpdateProjectOutputSchema: z.ZodObject<{
|
|
|
221
215
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
222
216
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
223
217
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
218
|
+
version: z.ZodInt;
|
|
224
219
|
}, z.core.$strip>;
|
|
225
220
|
export declare const DeleteProjectOutputSchema: z.ZodObject<{
|
|
226
221
|
id: z.ZodString;
|
|
@@ -249,6 +244,7 @@ export declare const DeleteProjectOutputSchema: z.ZodObject<{
|
|
|
249
244
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
250
245
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
251
246
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
247
|
+
version: z.ZodInt;
|
|
252
248
|
}, z.core.$strip>;
|
|
253
249
|
export declare const GetProjectOutputSchema: z.ZodObject<{
|
|
254
250
|
id: z.ZodString;
|
|
@@ -277,6 +273,7 @@ export declare const GetProjectOutputSchema: z.ZodObject<{
|
|
|
277
273
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
278
274
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
279
275
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
276
|
+
version: z.ZodInt;
|
|
280
277
|
user: z.ZodObject<{
|
|
281
278
|
email: z.ZodEmail;
|
|
282
279
|
username: z.ZodOptional<z.ZodString>;
|
|
@@ -321,13 +318,23 @@ export declare const MinimalProjectSchema: z.ZodObject<{
|
|
|
321
318
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
322
319
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
323
320
|
}, z.core.$strip>;
|
|
324
|
-
export declare const
|
|
321
|
+
export declare const SearchProjectsInputSchema: z.ZodObject<{
|
|
325
322
|
query: z.ZodOptional<z.ZodString>;
|
|
326
323
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
324
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
325
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
326
|
+
}, z.core.$strip>;
|
|
327
|
+
export declare const SearchProjectsOutputSchema: z.ZodObject<{
|
|
328
|
+
projects: z.ZodArray<z.ZodObject<{
|
|
329
|
+
id: z.ZodString;
|
|
330
|
+
description: z.ZodOptional<z.ZodString>;
|
|
331
|
+
title: z.ZodString;
|
|
332
|
+
imagePlaceholderUrl: z.ZodString;
|
|
333
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
334
|
+
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
335
|
+
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
336
|
+
}, z.core.$strip>>;
|
|
337
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
331
338
|
}, z.core.$strip>;
|
|
332
339
|
export declare const ProjectWithProjectViewsEntitySchema: z.ZodObject<{
|
|
333
340
|
id: z.ZodString;
|
package/dist/schemas/project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.
|
|
3
|
+
exports.ProjectWithProjectBookmarksEntitySchema = exports.ProjectWithLikesEntitySchema = exports.ProjectWithProjectCommentsEntitySchema = exports.ProjectWithProjectViewsEntitySchema = exports.SearchProjectsOutputSchema = exports.SearchProjectsInputSchema = exports.MinimalProjectSchema = exports.ProjectIdSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.ProjectDetailsEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.ProjectEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const file_1 = require("./file");
|
|
@@ -88,6 +88,7 @@ exports.ProjectEntitySchema = zod_openapi_1.z
|
|
|
88
88
|
description: "Timestamp when the project was last updated.",
|
|
89
89
|
example: new Date("2024-06-30T00:00:00.000Z"),
|
|
90
90
|
}),
|
|
91
|
+
version: zod_openapi_1.z.int(),
|
|
91
92
|
})
|
|
92
93
|
.openapi({
|
|
93
94
|
title: "Project DB Entity",
|
|
@@ -101,9 +102,7 @@ exports.ProjectFileEntitySchema = zod_openapi_1.z
|
|
|
101
102
|
projectId: zod_openapi_1.z.string().openapi({
|
|
102
103
|
description: "CUID2 of the project this file belongs to.",
|
|
103
104
|
}),
|
|
104
|
-
fileId: zod_openapi_1.z
|
|
105
|
-
.string()
|
|
106
|
-
.openapi({ description: "CUID2 of the linked file." }),
|
|
105
|
+
fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
107
106
|
isPlaceholder: zod_openapi_1.z.boolean().openapi({
|
|
108
107
|
description: "Indicates whether the file is a placeholder.",
|
|
109
108
|
example: false,
|
|
@@ -195,20 +194,9 @@ exports.UpdateProjectInputSchema = zod_openapi_1.z
|
|
|
195
194
|
endDate: zod_openapi_1.z.coerce.date().optional(),
|
|
196
195
|
createdAt: zod_openapi_1.z.date().optional(),
|
|
197
196
|
updatedAt: zod_openapi_1.z.date().optional(),
|
|
197
|
+
version: zod_openapi_1.z.int(),
|
|
198
198
|
})
|
|
199
199
|
.openapi({ title: "Update Project" });
|
|
200
|
-
exports.ViewProjectInputSchema = zod_openapi_1.z
|
|
201
|
-
.object({
|
|
202
|
-
projectId: zod_openapi_1.z.cuid2(),
|
|
203
|
-
id: zod_openapi_1.z.cuid2().optional(),
|
|
204
|
-
userId: zod_openapi_1.z.cuid2().optional(),
|
|
205
|
-
sessionId: zod_openapi_1.z.string().optional(),
|
|
206
|
-
ipAddress: zod_openapi_1.z.string().optional(),
|
|
207
|
-
userAgent: zod_openapi_1.z.string().optional(),
|
|
208
|
-
viewedAt: zod_openapi_1.z.date().optional(),
|
|
209
|
-
viewDate: zod_openapi_1.z.date().optional(),
|
|
210
|
-
})
|
|
211
|
-
.openapi({ title: "View Project" });
|
|
212
200
|
exports.CreateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
213
201
|
exports.UpdateProjectOutputSchema = exports.ProjectEntitySchema;
|
|
214
202
|
exports.DeleteProjectOutputSchema = exports.ProjectEntitySchema;
|
|
@@ -228,18 +216,32 @@ exports.MinimalProjectSchema = exports.ProjectEntitySchema.pick({
|
|
|
228
216
|
}).openapi({
|
|
229
217
|
title: "MinimalProject",
|
|
230
218
|
});
|
|
231
|
-
exports.
|
|
219
|
+
exports.SearchProjectsInputSchema = zod_openapi_1.z
|
|
232
220
|
.object({
|
|
233
221
|
query: zod_openapi_1.z.string().optional(),
|
|
234
222
|
tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
223
|
+
limit: zod_openapi_1.z.coerce
|
|
224
|
+
.number()
|
|
225
|
+
.min(1)
|
|
226
|
+
.max(100)
|
|
227
|
+
.default(20)
|
|
228
|
+
.openapi({ example: 20 }),
|
|
229
|
+
cursor: zod_openapi_1.z
|
|
230
|
+
.string()
|
|
231
|
+
.optional()
|
|
232
|
+
.openapi({ example: "ckl1y9xyz0000qv7a0h1efgh4" }),
|
|
239
233
|
})
|
|
240
234
|
.openapi({
|
|
241
235
|
title: "ListProjectsInput",
|
|
242
236
|
});
|
|
237
|
+
exports.SearchProjectsOutputSchema = zod_openapi_1.z
|
|
238
|
+
.object({
|
|
239
|
+
projects: zod_openapi_1.z.array(exports.MinimalProjectSchema),
|
|
240
|
+
nextCursor: zod_openapi_1.z.string().optional(),
|
|
241
|
+
})
|
|
242
|
+
.openapi({
|
|
243
|
+
title: "SearchProjectsOutput",
|
|
244
|
+
});
|
|
243
245
|
exports.ProjectWithProjectViewsEntitySchema = exports.MinimalProjectSchema.extend({
|
|
244
246
|
views: zod_openapi_1.z.array(view_1.ViewEntitySchema),
|
|
245
247
|
}).openapi({
|
package/dist/schemas/user.d.ts
CHANGED
|
@@ -234,6 +234,7 @@ export declare const UserWithProjectsEntitySchema: z.ZodObject<{
|
|
|
234
234
|
isFeatured: z.ZodOptional<z.ZodBoolean>;
|
|
235
235
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
236
236
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
237
|
+
version: z.ZodInt;
|
|
237
238
|
}, z.core.$strip>>;
|
|
238
239
|
}, z.core.$strip>;
|
|
239
240
|
export declare const UserWithProjectLikesEntitySchema: z.ZodObject<{
|
|
@@ -716,6 +717,7 @@ export declare const GetAuthenticatedUserWithProjectsOutputSchema: z.ZodObject<{
|
|
|
716
717
|
isFeatured: z.ZodOptional<z.ZodBoolean>;
|
|
717
718
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
718
719
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
720
|
+
version: z.ZodInt;
|
|
719
721
|
}, z.core.$strip>>;
|
|
720
722
|
}, z.core.$strip>;
|
|
721
723
|
export declare const GetAuthenticatedUserWithProjectBookmarksOutputSchema: z.ZodObject<{
|
package/dist/types/project.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from "@hono/zod-openapi";
|
|
2
|
-
import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema, ProjectDetailsEntitySchema, ProjectWithProjectViewsEntitySchema, ProjectWithProjectCommentsEntitySchema, ProjectWithLikesEntitySchema, ProjectWithProjectBookmarksEntitySchema, CreateProjectInputSchema, CreateProjectOutputSchema, UpdateProjectInputSchema, UpdateProjectOutputSchema, DeleteProjectOutputSchema, GetProjectOutputSchema,
|
|
2
|
+
import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema, ProjectDetailsEntitySchema, ProjectWithProjectViewsEntitySchema, ProjectWithProjectCommentsEntitySchema, ProjectWithLikesEntitySchema, ProjectWithProjectBookmarksEntitySchema, CreateProjectInputSchema, CreateProjectOutputSchema, UpdateProjectInputSchema, UpdateProjectOutputSchema, DeleteProjectOutputSchema, GetProjectOutputSchema, SearchProjectsInputSchema, SearchProjectsOutputSchema } from "../schemas/project";
|
|
3
3
|
import { ViewEntitySchema } from "../schemas/view";
|
|
4
4
|
import { LikeEntitySchema } from "../schemas/like";
|
|
5
5
|
import { CommentEntitySchema } from "../schemas/comment";
|
|
@@ -21,5 +21,5 @@ export type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;
|
|
|
21
21
|
export type UpdateProjectOutput = z.infer<typeof UpdateProjectOutputSchema>;
|
|
22
22
|
export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
|
|
23
23
|
export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
|
|
24
|
-
export type
|
|
25
|
-
export type
|
|
24
|
+
export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
|
|
25
|
+
export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;
|
package/package.json
CHANGED
package/src/schemas/project.ts
CHANGED
|
@@ -8,280 +8,281 @@ import { MinimalUserSchema } from "./user";
|
|
|
8
8
|
import { ActivitySchema } from "./activity";
|
|
9
9
|
|
|
10
10
|
export const ProjectEntitySchema = z
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
11
|
+
.object({
|
|
12
|
+
id: z.string().openapi({
|
|
13
|
+
description: "CUID2 of the project.",
|
|
14
|
+
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
15
|
+
}),
|
|
16
|
+
userId: z.string().openapi({
|
|
17
|
+
description: "CUID2 of the user who created the project.",
|
|
18
|
+
example: "ckl1y9xyz0000qv7a0h1efgh4",
|
|
19
|
+
}),
|
|
20
|
+
title: z.string().openapi({
|
|
21
|
+
description: "Title of the project.",
|
|
22
|
+
example: "E-commerce Mobile App",
|
|
23
|
+
}),
|
|
24
|
+
description: z.string().optional().openapi({
|
|
25
|
+
description: "Detailed description of the project, max 1000 characters.",
|
|
26
|
+
example:
|
|
27
|
+
"A modern e-commerce mobile application built with React Native.",
|
|
28
|
+
}),
|
|
29
|
+
overview: z.string().optional().openapi({
|
|
30
|
+
description: "Brief overview of the project.",
|
|
31
|
+
example: "A comprehensive e-commerce solution for mobile devices.",
|
|
32
|
+
}),
|
|
33
|
+
url: z.string().optional().openapi({
|
|
34
|
+
description: "URL to the project or live demo.",
|
|
35
|
+
example: "https://example.com/project",
|
|
36
|
+
}),
|
|
37
|
+
imagePlaceholderUrl: z.string().url().openapi({
|
|
38
|
+
description: "URL for the placeholder image of the project.",
|
|
39
|
+
example: "https://img.com",
|
|
40
|
+
}),
|
|
41
|
+
tags: z
|
|
42
|
+
.array(z.string())
|
|
43
|
+
.optional()
|
|
44
|
+
.openapi({
|
|
45
|
+
description: "Array of tags associated with the project.",
|
|
46
|
+
example: ["react-native", "e-commerce", "mobile"],
|
|
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
|
+
isFeatured: z.boolean().optional().openapi({
|
|
65
|
+
description: "Whether the project is featured.",
|
|
66
|
+
example: true,
|
|
67
|
+
}),
|
|
68
|
+
startDate: z.coerce
|
|
69
|
+
.date()
|
|
70
|
+
.optional()
|
|
71
|
+
.openapi({
|
|
72
|
+
description: "Start date of the project.",
|
|
73
|
+
example: new Date("2024-01-01"),
|
|
74
|
+
}),
|
|
75
|
+
endDate: z.coerce
|
|
76
|
+
.date()
|
|
77
|
+
.optional()
|
|
78
|
+
.openapi({
|
|
79
|
+
description: "End date of the project.",
|
|
80
|
+
example: new Date("2024-06-30"),
|
|
81
|
+
}),
|
|
82
|
+
createdAt: z.coerce.date().openapi({
|
|
83
|
+
description: "Timestamp when the project was created.",
|
|
84
|
+
example: new Date("2024-01-01T00:00:00.000Z"),
|
|
85
|
+
}),
|
|
86
|
+
updatedAt: z.coerce.date().openapi({
|
|
87
|
+
description: "Timestamp when the project was last updated.",
|
|
88
|
+
example: new Date("2024-06-30T00:00:00.000Z"),
|
|
89
|
+
}),
|
|
90
|
+
version: z.int(),
|
|
91
|
+
})
|
|
92
|
+
.openapi({
|
|
93
|
+
title: "Project DB Entity",
|
|
94
|
+
description: "Schema representing a project stored in the database.",
|
|
95
|
+
});
|
|
96
96
|
|
|
97
97
|
export const ProjectFileEntitySchema = z
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.
|
|
118
|
-
|
|
119
|
-
description: "Schema representing a file associated with a project.",
|
|
120
|
-
});
|
|
98
|
+
.object({
|
|
99
|
+
id: z
|
|
100
|
+
.string()
|
|
101
|
+
.openapi({ description: "CUID2 of the project file record." }),
|
|
102
|
+
projectId: z.string().openapi({
|
|
103
|
+
description: "CUID2 of the project this file belongs to.",
|
|
104
|
+
}),
|
|
105
|
+
fileId: z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
106
|
+
isPlaceholder: z.boolean().openapi({
|
|
107
|
+
description: "Indicates whether the file is a placeholder.",
|
|
108
|
+
example: false,
|
|
109
|
+
}),
|
|
110
|
+
order: z.number().int().openapi({
|
|
111
|
+
description: "Order index of the file in the project.",
|
|
112
|
+
example: 1,
|
|
113
|
+
}),
|
|
114
|
+
})
|
|
115
|
+
.openapi({
|
|
116
|
+
title: "Project File Entity",
|
|
117
|
+
description: "Schema representing a file associated with a project.",
|
|
118
|
+
});
|
|
121
119
|
|
|
122
120
|
export const ProjectSocialGraphEntitySchema = z
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
.object({
|
|
122
|
+
noOfLikes: z.number().int().optional().openapi({ example: 150 }),
|
|
123
|
+
noOfComments: z.number().int().optional().openapi({ example: 45 }),
|
|
124
|
+
noOfBookmarks: z.number().int().optional().openapi({ example: 22 }),
|
|
125
|
+
noOfViews: z.number().int().optional().openapi({ example: 1200 }),
|
|
126
|
+
})
|
|
127
|
+
.openapi("ProjectSocialGraphEntity");
|
|
130
128
|
|
|
131
129
|
export const ProjectDetailsEntitySchema = ProjectEntitySchema.extend({
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
user: MinimalUserSchema,
|
|
131
|
+
projectFiles: z
|
|
132
|
+
.array(
|
|
133
|
+
ProjectFileEntitySchema.extend({
|
|
134
|
+
file: FileEntitySchema,
|
|
135
|
+
}),
|
|
136
|
+
)
|
|
137
|
+
.optional()
|
|
138
|
+
.openapi({ description: "Files associated with the project." }),
|
|
141
139
|
}).openapi({ title: "ProjectDetailsEntity" });
|
|
142
140
|
|
|
143
141
|
export const ProjectUpdateOutputEntitySchema = z
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
.object({ id: z.cuid2() })
|
|
143
|
+
.openapi("ProjectUpdateOutputEntity");
|
|
146
144
|
|
|
147
145
|
export const CreateProjectInputSchema = z
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
146
|
+
.object({
|
|
147
|
+
title: z.string().min(1).max(100),
|
|
148
|
+
description: z.string().max(1000).optional(),
|
|
149
|
+
overview: z.string().optional(),
|
|
150
|
+
url: z.string().optional(),
|
|
151
|
+
imagePlaceholderUrl: z.url(),
|
|
152
|
+
tags: z.array(z.string()).default([]),
|
|
153
|
+
startDate: z.coerce.date().optional(),
|
|
154
|
+
endDate: z.coerce.date().optional(),
|
|
155
|
+
projectCreatorType: z.enum(ROLES).default(ROLES.CREATIVE),
|
|
156
|
+
clientId: z.string().optional(),
|
|
157
|
+
clientType: z.enum(CLIENT_TYPES).default(CLIENT_TYPES.NONE),
|
|
158
|
+
clientName: z.string().optional(),
|
|
159
|
+
files: z.array(
|
|
160
|
+
CreateFileInputSchema.extend({
|
|
161
|
+
isPlaceholder: z.boolean().default(false),
|
|
162
|
+
order: z.int().default(1),
|
|
163
|
+
}),
|
|
164
|
+
),
|
|
165
|
+
})
|
|
166
|
+
.superRefine(({ startDate, endDate }, ctx) => {
|
|
167
|
+
const today = new Date();
|
|
168
|
+
today.setHours(0, 0, 0, 0);
|
|
169
|
+
if (!startDate) return;
|
|
170
|
+
if (startDate > today)
|
|
171
|
+
ctx.addIssue({
|
|
172
|
+
path: ["startDate"],
|
|
173
|
+
code: "custom",
|
|
174
|
+
message: "Start date cannot be in the future",
|
|
175
|
+
});
|
|
176
|
+
if (endDate) {
|
|
177
|
+
if (startDate > endDate)
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
path: ["startDate"],
|
|
180
|
+
code: "custom",
|
|
181
|
+
message: "Start date cannot be after end date",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
.openapi({ title: "Create Project" });
|
|
188
186
|
|
|
189
187
|
export const UpdateProjectInputSchema = z
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
export const ViewProjectInputSchema = z
|
|
211
|
-
.object({
|
|
212
|
-
projectId: z.cuid2(),
|
|
213
|
-
id: z.cuid2().optional(),
|
|
214
|
-
userId: z.cuid2().optional(),
|
|
215
|
-
sessionId: z.string().optional(),
|
|
216
|
-
ipAddress: z.string().optional(),
|
|
217
|
-
userAgent: z.string().optional(),
|
|
218
|
-
viewedAt: z.date().optional(),
|
|
219
|
-
viewDate: z.date().optional(),
|
|
220
|
-
})
|
|
221
|
-
.openapi({ title: "View Project" });
|
|
188
|
+
.object({
|
|
189
|
+
id: z.cuid2(),
|
|
190
|
+
title: z.string().optional(),
|
|
191
|
+
description: z.string().optional(),
|
|
192
|
+
overview: z.string().optional(),
|
|
193
|
+
url: z.url().optional(),
|
|
194
|
+
imagePlaceholderUrl: z.url().optional(),
|
|
195
|
+
tags: z.array(z.string()).optional(),
|
|
196
|
+
projectCreatorType: z.enum(ROLES).optional(),
|
|
197
|
+
clientId: z.cuid2().optional(),
|
|
198
|
+
clientType: z.enum(CLIENT_TYPES).optional(),
|
|
199
|
+
clientName: z.string().optional(),
|
|
200
|
+
isFeatured: z.boolean().optional(),
|
|
201
|
+
startDate: z.coerce.date().optional(),
|
|
202
|
+
endDate: z.coerce.date().optional(),
|
|
203
|
+
createdAt: z.date().optional(),
|
|
204
|
+
updatedAt: z.date().optional(),
|
|
205
|
+
version: z.int(),
|
|
206
|
+
})
|
|
207
|
+
.openapi({ title: "Update Project" });
|
|
222
208
|
|
|
223
209
|
export const CreateProjectOutputSchema = ProjectEntitySchema;
|
|
224
210
|
export const UpdateProjectOutputSchema = ProjectEntitySchema;
|
|
225
211
|
export const DeleteProjectOutputSchema = ProjectEntitySchema;
|
|
226
212
|
|
|
227
213
|
export const GetProjectOutputSchema = ProjectDetailsEntitySchema.extend({
|
|
228
|
-
|
|
229
|
-
|
|
214
|
+
isLiked: z.boolean().optional(),
|
|
215
|
+
isBookmarked: z.boolean().optional(),
|
|
230
216
|
});
|
|
231
217
|
|
|
232
218
|
export const ProjectIdSchema = z.object({ projectId: z.cuid2() });
|
|
233
219
|
export const MinimalProjectSchema = ProjectEntitySchema.pick({
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
220
|
+
id: true,
|
|
221
|
+
title: true,
|
|
222
|
+
description: true,
|
|
223
|
+
tags: true,
|
|
224
|
+
startDate: true,
|
|
225
|
+
endDate: true,
|
|
226
|
+
imagePlaceholderUrl: true,
|
|
241
227
|
}).openapi({
|
|
242
|
-
|
|
228
|
+
title: "MinimalProject",
|
|
243
229
|
});
|
|
244
230
|
|
|
245
|
-
export const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
231
|
+
export const SearchProjectsInputSchema = z
|
|
232
|
+
.object({
|
|
233
|
+
query: z.string().optional(),
|
|
234
|
+
tags: z.array(z.string()).optional(),
|
|
235
|
+
limit: z.coerce
|
|
236
|
+
.number()
|
|
237
|
+
.min(1)
|
|
238
|
+
.max(100)
|
|
239
|
+
.default(20)
|
|
240
|
+
.openapi({ example: 20 }),
|
|
241
|
+
cursor: z
|
|
242
|
+
.string()
|
|
243
|
+
.optional()
|
|
244
|
+
.openapi({ example: "ckl1y9xyz0000qv7a0h1efgh4" }),
|
|
245
|
+
})
|
|
246
|
+
.openapi({
|
|
247
|
+
title: "ListProjectsInput",
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
export const SearchProjectsOutputSchema = z
|
|
251
|
+
.object({
|
|
252
|
+
projects: z.array(MinimalProjectSchema),
|
|
253
|
+
nextCursor: z.string().optional(),
|
|
254
|
+
})
|
|
255
|
+
.openapi({
|
|
256
|
+
title: "SearchProjectsOutput",
|
|
257
|
+
});
|
|
257
258
|
|
|
258
259
|
export const ProjectWithProjectViewsEntitySchema = MinimalProjectSchema.extend({
|
|
259
|
-
|
|
260
|
+
views: z.array(ViewEntitySchema),
|
|
260
261
|
}).openapi({
|
|
261
|
-
|
|
262
|
+
title: "ProjectWithProjectViewsEntity",
|
|
262
263
|
});
|
|
263
264
|
|
|
264
265
|
export const ProjectWithProjectCommentsEntitySchema =
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
MinimalProjectSchema.extend({
|
|
267
|
+
comments: z.array(CommentEntitySchema),
|
|
268
|
+
}).openapi({
|
|
269
|
+
title: "ProjectWithProjectCommentsEntity",
|
|
270
|
+
});
|
|
270
271
|
|
|
271
272
|
export const ProjectWithLikesEntitySchema = MinimalProjectSchema.extend({
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
likes: z.array(
|
|
274
|
+
ActivitySchema.extend({
|
|
275
|
+
followsYou: z.boolean().optional(),
|
|
276
|
+
isFollowing: z.boolean().optional(),
|
|
277
|
+
}),
|
|
278
|
+
),
|
|
278
279
|
}).openapi({
|
|
279
|
-
|
|
280
|
+
title: "ProjectWithProjectLikesEntity",
|
|
280
281
|
});
|
|
281
282
|
|
|
282
283
|
export const ProjectWithProjectBookmarksEntitySchema =
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
MinimalProjectSchema.extend({
|
|
285
|
+
bookmarks: z.array(BookmarkEntitySchema),
|
|
286
|
+
}).openapi({
|
|
287
|
+
title: "ProjectWithProjectBookmarksEntity",
|
|
288
|
+
});
|
package/src/types/project.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { z } from "@hono/zod-openapi";
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
ProjectEntitySchema,
|
|
4
|
+
ProjectIdSchema,
|
|
5
|
+
MinimalProjectSchema,
|
|
6
|
+
ProjectFileEntitySchema,
|
|
7
|
+
ProjectDetailsEntitySchema,
|
|
8
|
+
ProjectWithProjectViewsEntitySchema,
|
|
9
|
+
ProjectWithProjectCommentsEntitySchema,
|
|
10
|
+
ProjectWithLikesEntitySchema,
|
|
11
|
+
ProjectWithProjectBookmarksEntitySchema,
|
|
12
|
+
CreateProjectInputSchema,
|
|
13
|
+
CreateProjectOutputSchema,
|
|
14
|
+
UpdateProjectInputSchema,
|
|
15
|
+
UpdateProjectOutputSchema,
|
|
16
|
+
DeleteProjectOutputSchema,
|
|
17
|
+
GetProjectOutputSchema,
|
|
18
|
+
SearchProjectsInputSchema,
|
|
19
|
+
SearchProjectsOutputSchema,
|
|
20
20
|
} from "../schemas/project";
|
|
21
21
|
import { ViewEntitySchema } from "../schemas/view";
|
|
22
22
|
import { LikeEntitySchema } from "../schemas/like";
|
|
@@ -33,16 +33,16 @@ export type ProjectCommentEntity = z.infer<typeof CommentEntitySchema>;
|
|
|
33
33
|
|
|
34
34
|
export type ProjectDetailsEntity = z.infer<typeof ProjectDetailsEntitySchema>;
|
|
35
35
|
export type ProjectWithProjectViewsEntity = z.infer<
|
|
36
|
-
|
|
36
|
+
typeof ProjectWithProjectViewsEntitySchema
|
|
37
37
|
>;
|
|
38
38
|
export type ProjectWithProjectCommentsEntity = z.infer<
|
|
39
|
-
|
|
39
|
+
typeof ProjectWithProjectCommentsEntitySchema
|
|
40
40
|
>;
|
|
41
41
|
export type ProjectWithLikesEntity = z.infer<
|
|
42
|
-
|
|
42
|
+
typeof ProjectWithLikesEntitySchema
|
|
43
43
|
>;
|
|
44
44
|
export type ProjectWithProjectBookmarksEntity = z.infer<
|
|
45
|
-
|
|
45
|
+
typeof ProjectWithProjectBookmarksEntitySchema
|
|
46
46
|
>;
|
|
47
47
|
|
|
48
48
|
export type CreateProjectInput = z.infer<typeof CreateProjectInputSchema>;
|
|
@@ -52,5 +52,5 @@ export type UpdateProjectOutput = z.infer<typeof UpdateProjectOutputSchema>;
|
|
|
52
52
|
export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
|
|
53
53
|
|
|
54
54
|
export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
|
|
55
|
-
export type
|
|
56
|
-
export type
|
|
55
|
+
export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
|
|
56
|
+
export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;
|