@zyacreatives/shared 2.1.74 → 2.1.76

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.
@@ -387,7 +387,7 @@ export declare const ProjectWithProjectCommentsEntitySchema: z.ZodObject<{
387
387
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
388
388
  }, z.core.$strip>>;
389
389
  }, z.core.$strip>;
390
- export declare const ProjectWithProjectLikesEntitySchema: z.ZodObject<{
390
+ export declare const ProjectWithLikesEntitySchema: z.ZodObject<{
391
391
  id: z.ZodString;
392
392
  description: z.ZodOptional<z.ZodString>;
393
393
  title: z.ZodString;
@@ -397,17 +397,19 @@ export declare const ProjectWithProjectLikesEntitySchema: z.ZodObject<{
397
397
  endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
398
398
  likes: z.ZodArray<z.ZodObject<{
399
399
  id: z.ZodCUID2;
400
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
401
- userId: z.ZodCUID2;
402
- parentId: z.ZodCUID2;
403
- parentType: z.ZodEnum<{
404
- readonly PROJECT: "PROJECT";
405
- readonly USER: "USER";
406
- readonly JOB: "JOB";
407
- readonly POST: "POST";
408
- readonly COMMENT: "COMMENT";
409
- readonly JOB_APPLICATION: "JOB_APPLICATION";
400
+ type: z.ZodEnum<{
401
+ readonly LIKE: "LIKE";
402
+ readonly UNLIKE: "UNLIKE";
403
+ readonly BOOKMARK: "BOOKMARK";
404
+ readonly UNBOOKMARK: "UNBOOKMARK";
405
+ readonly VIEW: "VIEW";
410
406
  }>;
407
+ actorName: z.ZodString;
408
+ actorId: z.ZodString;
409
+ actorUsername: z.ZodString;
410
+ actorImageUrl: z.ZodOptional<z.ZodURL>;
411
+ followsYou: z.ZodOptional<z.ZodBoolean>;
412
+ isFollowing: z.ZodOptional<z.ZodBoolean>;
411
413
  }, z.core.$strip>>;
412
414
  }, z.core.$strip>;
413
415
  export declare const ProjectWithProjectBookmarksEntitySchema: z.ZodObject<{
@@ -1,14 +1,14 @@
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.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.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;
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
7
  const comment_1 = require("./comment");
8
8
  const bookmark_1 = require("./bookmark");
9
9
  const view_1 = require("./view");
10
- const like_1 = require("./like");
11
10
  const user_1 = require("./user");
11
+ const activity_1 = require("./activity");
12
12
  exports.ProjectEntitySchema = zod_openapi_1.z
13
13
  .object({
14
14
  id: zod_openapi_1.z.string().openapi({
@@ -101,7 +101,9 @@ exports.ProjectFileEntitySchema = zod_openapi_1.z
101
101
  projectId: zod_openapi_1.z.string().openapi({
102
102
  description: "CUID2 of the project this file belongs to.",
103
103
  }),
104
- fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
104
+ fileId: zod_openapi_1.z
105
+ .string()
106
+ .openapi({ description: "CUID2 of the linked file." }),
105
107
  isPlaceholder: zod_openapi_1.z.boolean().openapi({
106
108
  description: "Indicates whether the file is a placeholder.",
107
109
  example: false,
@@ -123,7 +125,6 @@ exports.ProjectSocialGraphEntitySchema = zod_openapi_1.z
123
125
  noOfViews: zod_openapi_1.z.number().int().optional().openapi({ example: 1200 }),
124
126
  })
125
127
  .openapi("ProjectSocialGraphEntity");
126
- /* ------------------------------ Derived Entities ------------------------------ */
127
128
  exports.ProjectDetailsEntitySchema = exports.ProjectEntitySchema.extend({
128
129
  user: user_1.MinimalUserSchema,
129
130
  projectFiles: zod_openapi_1.z
@@ -249,8 +250,11 @@ exports.ProjectWithProjectCommentsEntitySchema = exports.MinimalProjectSchema.ex
249
250
  }).openapi({
250
251
  title: "ProjectWithProjectCommentsEntity",
251
252
  });
252
- exports.ProjectWithProjectLikesEntitySchema = exports.MinimalProjectSchema.extend({
253
- likes: zod_openapi_1.z.array(like_1.LikeEntitySchema),
253
+ exports.ProjectWithLikesEntitySchema = exports.MinimalProjectSchema.extend({
254
+ likes: zod_openapi_1.z.array(activity_1.ActivitySchema.extend({
255
+ followsYou: zod_openapi_1.z.boolean().optional(),
256
+ isFollowing: zod_openapi_1.z.boolean().optional(),
257
+ })),
254
258
  }).openapi({
255
259
  title: "ProjectWithProjectLikesEntity",
256
260
  });
@@ -793,7 +793,7 @@ export declare const SearchUsersInputSchema: z.ZodObject<{
793
793
  ADMIN: "ADMIN";
794
794
  }>>;
795
795
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
796
- cursor: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
796
+ cursor: z.ZodOptional<z.ZodString>;
797
797
  }, z.core.$strip>;
798
798
  export declare const SearchUsersOutputSchema: z.ZodObject<{
799
799
  users: z.ZodArray<z.ZodObject<{
@@ -168,7 +168,7 @@ exports.SearchUsersInputSchema = zod_openapi_1.z.object({
168
168
  .max(100)
169
169
  .default(20)
170
170
  .openapi({ example: 20 }),
171
- cursor: zod_openapi_1.z.coerce.number().min(0).default(0).openapi({
171
+ cursor: zod_openapi_1.z.string().optional().openapi({
172
172
  example: 0,
173
173
  description: "The offset/cursor for pagination",
174
174
  }),
@@ -1,5 +1,5 @@
1
1
  import type { z } from "@hono/zod-openapi";
2
- import type { ProjectEntitySchema, ProjectIdSchema, MinimalProjectSchema, ProjectFileEntitySchema, ProjectDetailsEntitySchema, ProjectWithProjectViewsEntitySchema, ProjectWithProjectCommentsEntitySchema, ProjectWithProjectLikesEntitySchema, 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, ListProjectsInputSchema, ViewProjectInputSchema } from "../schemas/project";
3
3
  import { ViewEntitySchema } from "../schemas/view";
4
4
  import { LikeEntitySchema } from "../schemas/like";
5
5
  import { CommentEntitySchema } from "../schemas/comment";
@@ -13,7 +13,7 @@ export type ProjectCommentEntity = z.infer<typeof CommentEntitySchema>;
13
13
  export type ProjectDetailsEntity = z.infer<typeof ProjectDetailsEntitySchema>;
14
14
  export type ProjectWithProjectViewsEntity = z.infer<typeof ProjectWithProjectViewsEntitySchema>;
15
15
  export type ProjectWithProjectCommentsEntity = z.infer<typeof ProjectWithProjectCommentsEntitySchema>;
16
- export type ProjectWithProjectLikesEntity = z.infer<typeof ProjectWithProjectLikesEntitySchema>;
16
+ export type ProjectWithLikesEntity = z.infer<typeof ProjectWithLikesEntitySchema>;
17
17
  export type ProjectWithProjectBookmarksEntity = z.infer<typeof ProjectWithProjectBookmarksEntitySchema>;
18
18
  export type CreateProjectInput = z.infer<typeof CreateProjectInputSchema>;
19
19
  export type CreateProjectOutput = z.infer<typeof CreateProjectOutputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.74",
3
+ "version": "2.1.76",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,10 +4,8 @@ import {
4
4
  POST_BADGE_TYPES,
5
5
  POST_TYPES,
6
6
  } from "../constants";
7
- import { CreateFileInputSchema, FileEntitySchema } from "./file";
8
- import { BookmarkEntitySchema } from "./bookmark";
7
+ import { CreateFileInputSchema } from "./file";
9
8
  import { CommentEntitySchema } from "./comment";
10
- import { LikeEntitySchema } from "./like";
11
9
  import { EntityStatsSchema } from "./entity-stats";
12
10
  import { ActivitySchema } from "./activity";
13
11
 
@@ -4,277 +4,284 @@ import { CreateFileInputSchema, FileEntitySchema } from "./file";
4
4
  import { CommentEntitySchema } from "./comment";
5
5
  import { BookmarkEntitySchema } from "./bookmark";
6
6
  import { ViewEntitySchema } from "./view";
7
- import { LikeEntitySchema } from "./like";
8
7
  import { MinimalUserSchema } from "./user";
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: "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
- })
91
- .openapi({
92
- title: "Project DB Entity",
93
- description: "Schema representing a project stored in the database.",
94
- });
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
+ });
95
96
 
96
97
  export const ProjectFileEntitySchema = z
97
- .object({
98
- id: z
99
- .string()
100
- .openapi({ description: "CUID2 of the project file record." }),
101
- projectId: z.string().openapi({
102
- description: "CUID2 of the project this file belongs to.",
103
- }),
104
- fileId: z.string().openapi({ description: "CUID2 of the linked file." }),
105
- isPlaceholder: z.boolean().openapi({
106
- description: "Indicates whether the file is a placeholder.",
107
- example: false,
108
- }),
109
- order: z.number().int().openapi({
110
- description: "Order index of the file in the project.",
111
- example: 1,
112
- }),
113
- })
114
- .openapi({
115
- title: "Project File Entity",
116
- description: "Schema representing a file associated with a project.",
117
- });
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
+ });
118
121
 
119
122
  export const ProjectSocialGraphEntitySchema = z
120
- .object({
121
- noOfLikes: z.number().int().optional().openapi({ example: 150 }),
122
- noOfComments: z.number().int().optional().openapi({ example: 45 }),
123
- noOfBookmarks: z.number().int().optional().openapi({ example: 22 }),
124
- noOfViews: z.number().int().optional().openapi({ example: 1200 }),
125
- })
126
- .openapi("ProjectSocialGraphEntity");
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");
127
130
 
128
- /* ------------------------------ Derived Entities ------------------------------ */
129
131
  export const ProjectDetailsEntitySchema = ProjectEntitySchema.extend({
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." }),
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." }),
139
141
  }).openapi({ title: "ProjectDetailsEntity" });
140
142
 
141
143
  export const ProjectUpdateOutputEntitySchema = z
142
- .object({ id: z.cuid2() })
143
- .openapi("ProjectUpdateOutputEntity");
144
+ .object({ id: z.cuid2() })
145
+ .openapi("ProjectUpdateOutputEntity");
144
146
 
145
147
  export const CreateProjectInputSchema = z
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" });
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" });
186
188
 
187
189
  export const UpdateProjectInputSchema = z
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
- })
206
- .openapi({ title: "Update Project" });
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" });
207
209
 
208
210
  export const ViewProjectInputSchema = z
209
- .object({
210
- projectId: z.cuid2(),
211
- id: z.cuid2().optional(),
212
- userId: z.cuid2().optional(),
213
- sessionId: z.string().optional(),
214
- ipAddress: z.string().optional(),
215
- userAgent: z.string().optional(),
216
- viewedAt: z.date().optional(),
217
- viewDate: z.date().optional(),
218
- })
219
- .openapi({ title: "View Project" });
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" });
220
222
 
221
223
  export const CreateProjectOutputSchema = ProjectEntitySchema;
222
224
  export const UpdateProjectOutputSchema = ProjectEntitySchema;
223
225
  export const DeleteProjectOutputSchema = ProjectEntitySchema;
224
226
 
225
227
  export const GetProjectOutputSchema = ProjectDetailsEntitySchema.extend({
226
- isLiked: z.boolean().optional(),
227
- isBookmarked: z.boolean().optional(),
228
+ isLiked: z.boolean().optional(),
229
+ isBookmarked: z.boolean().optional(),
228
230
  });
229
231
 
230
232
  export const ProjectIdSchema = z.object({ projectId: z.cuid2() });
231
233
  export const MinimalProjectSchema = ProjectEntitySchema.pick({
232
- id: true,
233
- title: true,
234
- description: true,
235
- tags: true,
236
- startDate: true,
237
- endDate: true,
238
- imagePlaceholderUrl: true,
234
+ id: true,
235
+ title: true,
236
+ description: true,
237
+ tags: true,
238
+ startDate: true,
239
+ endDate: true,
240
+ imagePlaceholderUrl: true,
239
241
  }).openapi({
240
- title: "MinimalProject",
242
+ title: "MinimalProject",
241
243
  });
242
244
 
243
245
  export const ListProjectsInputSchema = z
244
- .object({
245
- query: z.string().optional(),
246
- tags: z.array(z.string()).optional(),
247
- clientName: z.string().optional(),
248
- userId: z.string().optional(),
249
- page: z.number().int().optional().default(1),
250
- perPage: z.number().int().optional().default(10),
251
- })
252
- .openapi({
253
- title: "ListProjectsInput",
254
- });
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
+ });
255
257
 
256
258
  export const ProjectWithProjectViewsEntitySchema = MinimalProjectSchema.extend({
257
- views: z.array(ViewEntitySchema),
259
+ views: z.array(ViewEntitySchema),
258
260
  }).openapi({
259
- title: "ProjectWithProjectViewsEntity",
261
+ title: "ProjectWithProjectViewsEntity",
260
262
  });
261
263
 
262
264
  export const ProjectWithProjectCommentsEntitySchema =
263
- MinimalProjectSchema.extend({
264
- comments: z.array(CommentEntitySchema),
265
- }).openapi({
266
- title: "ProjectWithProjectCommentsEntity",
267
- });
265
+ MinimalProjectSchema.extend({
266
+ comments: z.array(CommentEntitySchema),
267
+ }).openapi({
268
+ title: "ProjectWithProjectCommentsEntity",
269
+ });
268
270
 
269
- export const ProjectWithProjectLikesEntitySchema = MinimalProjectSchema.extend({
270
- likes: z.array(LikeEntitySchema),
271
+ export const ProjectWithLikesEntitySchema = MinimalProjectSchema.extend({
272
+ likes: z.array(
273
+ ActivitySchema.extend({
274
+ followsYou: z.boolean().optional(),
275
+ isFollowing: z.boolean().optional(),
276
+ }),
277
+ ),
271
278
  }).openapi({
272
- title: "ProjectWithProjectLikesEntity",
279
+ title: "ProjectWithProjectLikesEntity",
273
280
  });
274
281
 
275
282
  export const ProjectWithProjectBookmarksEntitySchema =
276
- MinimalProjectSchema.extend({
277
- bookmarks: z.array(BookmarkEntitySchema),
278
- }).openapi({
279
- title: "ProjectWithProjectBookmarksEntity",
280
- });
283
+ MinimalProjectSchema.extend({
284
+ bookmarks: z.array(BookmarkEntitySchema),
285
+ }).openapi({
286
+ title: "ProjectWithProjectBookmarksEntity",
287
+ });
@@ -233,7 +233,7 @@ export const SearchUsersInputSchema = z.object({
233
233
  .max(100)
234
234
  .default(20)
235
235
  .openapi({ example: 20 }),
236
- cursor: z.coerce.number().min(0).default(0).openapi({
236
+ cursor: z.string().optional().openapi({
237
237
  example: 0,
238
238
  description: "The offset/cursor for pagination",
239
239
  }),
@@ -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
- ProjectWithProjectLikesEntitySchema,
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
+ ListProjectsInputSchema,
19
+ ViewProjectInputSchema,
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
- export type ProjectWithProjectLikesEntity = z.infer<
42
- typeof ProjectWithProjectLikesEntitySchema
41
+ export type ProjectWithLikesEntity = z.infer<
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>;