@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.
@@ -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
- }, z.core.$strip>;
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 ListProjectsInputSchema: z.ZodObject<{
321
+ export declare const SearchProjectsInputSchema: z.ZodObject<{
325
322
  query: z.ZodOptional<z.ZodString>;
326
323
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
327
- clientName: z.ZodOptional<z.ZodString>;
328
- userId: z.ZodOptional<z.ZodString>;
329
- page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
330
- perPage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
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;
@@ -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.ListProjectsInputSchema = exports.MinimalProjectSchema = exports.ProjectIdSchema = exports.GetProjectOutputSchema = exports.DeleteProjectOutputSchema = exports.UpdateProjectOutputSchema = exports.CreateProjectOutputSchema = exports.ViewProjectInputSchema = exports.UpdateProjectInputSchema = exports.CreateProjectInputSchema = exports.ProjectUpdateOutputEntitySchema = exports.ProjectDetailsEntitySchema = exports.ProjectSocialGraphEntitySchema = exports.ProjectFileEntitySchema = exports.ProjectEntitySchema = void 0;
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.ListProjectsInputSchema = zod_openapi_1.z
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
- clientName: zod_openapi_1.z.string().optional(),
236
- userId: zod_openapi_1.z.string().optional(),
237
- page: zod_openapi_1.z.number().int().optional().default(1),
238
- perPage: zod_openapi_1.z.number().int().optional().default(10),
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({
@@ -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<{
@@ -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, ListProjectsInputSchema, ViewProjectInputSchema } from "../schemas/project";
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 ListProjectsInput = z.infer<typeof ListProjectsInputSchema>;
25
- export type ViewProjectInput = z.infer<typeof ViewProjectInputSchema>;
24
+ export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
25
+ export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.78",
3
+ "version": "2.1.79",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,280 +8,281 @@ import { MinimalUserSchema } from "./user";
8
8
  import { ActivitySchema } from "./activity";
9
9
 
10
10
  export const ProjectEntitySchema = z
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:
26
- "Detailed description of the project, max 1000 characters.",
27
- example:
28
- "A modern e-commerce mobile application built with React Native.",
29
- }),
30
- overview: z.string().optional().openapi({
31
- description: "Brief overview of the project.",
32
- example: "A comprehensive e-commerce solution for mobile devices.",
33
- }),
34
- url: z.string().optional().openapi({
35
- description: "URL to the project or live demo.",
36
- example: "https://example.com/project",
37
- }),
38
- imagePlaceholderUrl: z.string().url().openapi({
39
- description: "URL for the placeholder image of the project.",
40
- example: "https://img.com",
41
- }),
42
- tags: z
43
- .array(z.string())
44
- .optional()
45
- .openapi({
46
- description: "Array of tags associated with the project.",
47
- example: ["react-native", "e-commerce", "mobile"],
48
- }),
49
- projectCreatorType: z.enum(ROLES).openapi({
50
- description: "Type of creator who made this project.",
51
- example: "CREATIVE",
52
- }),
53
- clientId: z.string().optional().openapi({
54
- description: "CUID2 of the client if this is a client project.",
55
- example: "ckl1y9xyz0000qv7a0h1efgh4",
56
- }),
57
- clientType: z.enum(CLIENT_TYPES).optional().openapi({
58
- description: "Type of client for this project.",
59
- example: "BRAND",
60
- }),
61
- clientName: z.string().optional().openapi({
62
- description: "Name of the client.",
63
- example: "Acme Corp",
64
- }),
65
- isFeatured: z.boolean().optional().openapi({
66
- description: "Whether the project is featured.",
67
- example: true,
68
- }),
69
- startDate: z.coerce
70
- .date()
71
- .optional()
72
- .openapi({
73
- description: "Start date of the project.",
74
- example: new Date("2024-01-01"),
75
- }),
76
- endDate: z.coerce
77
- .date()
78
- .optional()
79
- .openapi({
80
- description: "End date of the project.",
81
- example: new Date("2024-06-30"),
82
- }),
83
- createdAt: z.coerce.date().openapi({
84
- description: "Timestamp when the project was created.",
85
- example: new Date("2024-01-01T00:00:00.000Z"),
86
- }),
87
- updatedAt: z.coerce.date().openapi({
88
- description: "Timestamp when the project was last updated.",
89
- example: new Date("2024-06-30T00:00:00.000Z"),
90
- }),
91
- })
92
- .openapi({
93
- title: "Project DB Entity",
94
- description: "Schema representing a project stored in the database.",
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
- .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
106
- .string()
107
- .openapi({ description: "CUID2 of the linked file." }),
108
- isPlaceholder: z.boolean().openapi({
109
- description: "Indicates whether the file is a placeholder.",
110
- example: false,
111
- }),
112
- order: z.number().int().openapi({
113
- description: "Order index of the file in the project.",
114
- example: 1,
115
- }),
116
- })
117
- .openapi({
118
- title: "Project File Entity",
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
- .object({
124
- noOfLikes: z.number().int().optional().openapi({ example: 150 }),
125
- noOfComments: z.number().int().optional().openapi({ example: 45 }),
126
- noOfBookmarks: z.number().int().optional().openapi({ example: 22 }),
127
- noOfViews: z.number().int().optional().openapi({ example: 1200 }),
128
- })
129
- .openapi("ProjectSocialGraphEntity");
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
- user: MinimalUserSchema,
133
- projectFiles: z
134
- .array(
135
- ProjectFileEntitySchema.extend({
136
- file: FileEntitySchema,
137
- }),
138
- )
139
- .optional()
140
- .openapi({ description: "Files associated with the project." }),
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
- .object({ id: z.cuid2() })
145
- .openapi("ProjectUpdateOutputEntity");
142
+ .object({ id: z.cuid2() })
143
+ .openapi("ProjectUpdateOutputEntity");
146
144
 
147
145
  export const CreateProjectInputSchema = z
148
- .object({
149
- title: z.string().min(1).max(100),
150
- description: z.string().max(1000).optional(),
151
- overview: z.string().optional(),
152
- url: z.string().optional(),
153
- imagePlaceholderUrl: z.url(),
154
- tags: z.array(z.string()).default([]),
155
- startDate: z.coerce.date().optional(),
156
- endDate: z.coerce.date().optional(),
157
- projectCreatorType: z.enum(ROLES).default(ROLES.CREATIVE),
158
- clientId: z.string().optional(),
159
- clientType: z.enum(CLIENT_TYPES).default(CLIENT_TYPES.NONE),
160
- clientName: z.string().optional(),
161
- files: z.array(
162
- CreateFileInputSchema.extend({
163
- isPlaceholder: z.boolean().default(false),
164
- order: z.int().default(1),
165
- }),
166
- ),
167
- })
168
- .superRefine(({ startDate, endDate }, ctx) => {
169
- const today = new Date();
170
- today.setHours(0, 0, 0, 0);
171
- if (!startDate) return;
172
- if (startDate > today)
173
- ctx.addIssue({
174
- path: ["startDate"],
175
- code: "custom",
176
- message: "Start date cannot be in the future",
177
- });
178
- if (endDate) {
179
- if (startDate > endDate)
180
- ctx.addIssue({
181
- path: ["startDate"],
182
- code: "custom",
183
- message: "Start date cannot be after end date",
184
- });
185
- }
186
- })
187
- .openapi({ title: "Create Project" });
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
- .object({
191
- id: z.cuid2(),
192
- title: z.string().optional(),
193
- description: z.string().optional(),
194
- overview: z.string().optional(),
195
- url: z.url().optional(),
196
- imagePlaceholderUrl: z.url().optional(),
197
- tags: z.array(z.string()).optional(),
198
- projectCreatorType: z.enum(ROLES).optional(),
199
- clientId: z.cuid2().optional(),
200
- clientType: z.enum(CLIENT_TYPES).optional(),
201
- clientName: z.string().optional(),
202
- isFeatured: z.boolean().optional(),
203
- startDate: z.coerce.date().optional(),
204
- endDate: z.coerce.date().optional(),
205
- createdAt: z.date().optional(),
206
- updatedAt: z.date().optional(),
207
- })
208
- .openapi({ title: "Update Project" });
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
- isLiked: z.boolean().optional(),
229
- isBookmarked: z.boolean().optional(),
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
- id: true,
235
- title: true,
236
- description: true,
237
- tags: true,
238
- startDate: true,
239
- endDate: true,
240
- imagePlaceholderUrl: true,
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
- title: "MinimalProject",
228
+ title: "MinimalProject",
243
229
  });
244
230
 
245
- export const ListProjectsInputSchema = z
246
- .object({
247
- query: z.string().optional(),
248
- tags: z.array(z.string()).optional(),
249
- clientName: z.string().optional(),
250
- userId: z.string().optional(),
251
- page: z.number().int().optional().default(1),
252
- perPage: z.number().int().optional().default(10),
253
- })
254
- .openapi({
255
- title: "ListProjectsInput",
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
- views: z.array(ViewEntitySchema),
260
+ views: z.array(ViewEntitySchema),
260
261
  }).openapi({
261
- title: "ProjectWithProjectViewsEntity",
262
+ title: "ProjectWithProjectViewsEntity",
262
263
  });
263
264
 
264
265
  export const ProjectWithProjectCommentsEntitySchema =
265
- MinimalProjectSchema.extend({
266
- comments: z.array(CommentEntitySchema),
267
- }).openapi({
268
- title: "ProjectWithProjectCommentsEntity",
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
- likes: z.array(
273
- ActivitySchema.extend({
274
- followsYou: z.boolean().optional(),
275
- isFollowing: z.boolean().optional(),
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
- title: "ProjectWithProjectLikesEntity",
280
+ title: "ProjectWithProjectLikesEntity",
280
281
  });
281
282
 
282
283
  export const ProjectWithProjectBookmarksEntitySchema =
283
- MinimalProjectSchema.extend({
284
- bookmarks: z.array(BookmarkEntitySchema),
285
- }).openapi({
286
- title: "ProjectWithProjectBookmarksEntity",
287
- });
284
+ MinimalProjectSchema.extend({
285
+ bookmarks: z.array(BookmarkEntitySchema),
286
+ }).openapi({
287
+ title: "ProjectWithProjectBookmarksEntity",
288
+ });
@@ -1,22 +1,22 @@
1
1
  import type { z } from "@hono/zod-openapi";
2
2
  import type {
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
- ListProjectsInputSchema,
19
- ViewProjectInputSchema,
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
- typeof ProjectWithProjectViewsEntitySchema
36
+ typeof ProjectWithProjectViewsEntitySchema
37
37
  >;
38
38
  export type ProjectWithProjectCommentsEntity = z.infer<
39
- typeof ProjectWithProjectCommentsEntitySchema
39
+ typeof ProjectWithProjectCommentsEntitySchema
40
40
  >;
41
41
  export type ProjectWithLikesEntity = z.infer<
42
- typeof ProjectWithLikesEntitySchema
42
+ typeof ProjectWithLikesEntitySchema
43
43
  >;
44
44
  export type ProjectWithProjectBookmarksEntity = z.infer<
45
- typeof ProjectWithProjectBookmarksEntitySchema
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 ListProjectsInput = z.infer<typeof ListProjectsInputSchema>;
56
- export type ViewProjectInput = z.infer<typeof ViewProjectInputSchema>;
55
+ export type SearchProjectsInput = z.infer<typeof SearchProjectsInputSchema>;
56
+ export type SearchProjectsOutput = z.infer<typeof SearchProjectsOutputSchema>;