@zyacreatives/shared 2.1.75 → 2.1.77
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/post.js +0 -1
- package/dist/schemas/project.d.ts +13 -11
- package/dist/schemas/project.js +10 -6
- package/dist/schemas/user.d.ts +58 -0
- package/dist/schemas/user.js +30 -1
- package/dist/types/project.d.ts +2 -2
- package/dist/types/user.d.ts +3 -1
- package/package.json +1 -1
- package/src/schemas/post.ts +1 -4
- package/src/schemas/project.ts +238 -231
- package/src/schemas/user.ts +36 -1
- package/src/types/project.ts +22 -22
- package/src/types/user.ts +10 -0
package/dist/schemas/post.js
CHANGED
|
@@ -152,7 +152,6 @@ exports.CreatePostOutputSchema = exports.PostEntitySchema;
|
|
|
152
152
|
exports.GetPostOutputSchema = exports.PostWithFilesEntitySchema;
|
|
153
153
|
exports.PostIdSchema = zod_openapi_1.z.object({ postId: zod_openapi_1.z.cuid2() });
|
|
154
154
|
exports.MinimalPostSchema = exports.PostEntitySchema.pick({
|
|
155
|
-
title: true,
|
|
156
155
|
id: true,
|
|
157
156
|
parentId: true,
|
|
158
157
|
content: true,
|
|
@@ -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
|
|
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
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
readonly
|
|
405
|
-
readonly
|
|
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<{
|
package/dist/schemas/project.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectWithProjectBookmarksEntitySchema = exports.
|
|
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
|
|
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.
|
|
253
|
-
likes: zod_openapi_1.z.array(
|
|
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
|
});
|
package/dist/schemas/user.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare const UserEntitySchema: z.ZodObject<{
|
|
|
30
30
|
DONE: "DONE";
|
|
31
31
|
}>;
|
|
32
32
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
33
|
+
version: z.ZodInt;
|
|
33
34
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
34
35
|
}, z.core.$strip>;
|
|
35
36
|
export declare const MinimalUserSchema: z.ZodObject<{
|
|
@@ -81,6 +82,7 @@ export declare const UserProfileEntitySchema: z.ZodObject<{
|
|
|
81
82
|
DONE: "DONE";
|
|
82
83
|
}>;
|
|
83
84
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
85
|
+
version: z.ZodInt;
|
|
84
86
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
85
87
|
profileType: z.ZodOptional<z.ZodEnum<{
|
|
86
88
|
creative: "creative";
|
|
@@ -258,6 +260,60 @@ export declare const UserWithProjectLikesEntitySchema: z.ZodObject<{
|
|
|
258
260
|
}, z.core.$strip>;
|
|
259
261
|
}, z.core.$strip>>;
|
|
260
262
|
}, z.core.$strip>;
|
|
263
|
+
export declare const UserWithPostLikesEntitySchema: z.ZodObject<{
|
|
264
|
+
userId: z.ZodCUID2;
|
|
265
|
+
postLikes: z.ZodArray<z.ZodObject<{
|
|
266
|
+
id: z.ZodCUID2;
|
|
267
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
268
|
+
userId: z.ZodCUID2;
|
|
269
|
+
parentId: z.ZodCUID2;
|
|
270
|
+
parentType: z.ZodEnum<{
|
|
271
|
+
readonly PROJECT: "PROJECT";
|
|
272
|
+
readonly USER: "USER";
|
|
273
|
+
readonly JOB: "JOB";
|
|
274
|
+
readonly POST: "POST";
|
|
275
|
+
readonly COMMENT: "COMMENT";
|
|
276
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
277
|
+
}>;
|
|
278
|
+
post: z.ZodObject<{
|
|
279
|
+
id: z.ZodCUID2;
|
|
280
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
281
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
282
|
+
content: z.ZodOptional<z.ZodString>;
|
|
283
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
id: z.ZodInt;
|
|
286
|
+
}, z.core.$strip>>>;
|
|
287
|
+
}, z.core.$strip>;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
}, z.core.$strip>;
|
|
290
|
+
export declare const UserWithPostBookmarksEntitySchema: z.ZodObject<{
|
|
291
|
+
userId: z.ZodCUID2;
|
|
292
|
+
postBookmarks: z.ZodArray<z.ZodObject<{
|
|
293
|
+
id: z.ZodCUID2;
|
|
294
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
295
|
+
userId: z.ZodCUID2;
|
|
296
|
+
parentId: z.ZodCUID2;
|
|
297
|
+
parentType: z.ZodEnum<{
|
|
298
|
+
readonly PROJECT: "PROJECT";
|
|
299
|
+
readonly USER: "USER";
|
|
300
|
+
readonly JOB: "JOB";
|
|
301
|
+
readonly POST: "POST";
|
|
302
|
+
readonly COMMENT: "COMMENT";
|
|
303
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
304
|
+
}>;
|
|
305
|
+
post: z.ZodObject<{
|
|
306
|
+
id: z.ZodCUID2;
|
|
307
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
308
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
309
|
+
content: z.ZodOptional<z.ZodString>;
|
|
310
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
311
|
+
name: z.ZodString;
|
|
312
|
+
id: z.ZodInt;
|
|
313
|
+
}, z.core.$strip>>>;
|
|
314
|
+
}, z.core.$strip>;
|
|
315
|
+
}, z.core.$strip>>;
|
|
316
|
+
}, z.core.$strip>;
|
|
261
317
|
export declare const UserWithProjectBookmarksEntitySchema: z.ZodObject<{
|
|
262
318
|
userId: z.ZodCUID2;
|
|
263
319
|
projectBookmarks: z.ZodArray<z.ZodObject<{
|
|
@@ -472,6 +528,7 @@ export declare const GetAuthenticatedUserOutputSchema: z.ZodObject<{
|
|
|
472
528
|
DONE: "DONE";
|
|
473
529
|
}>;
|
|
474
530
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
531
|
+
version: z.ZodInt;
|
|
475
532
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
476
533
|
}, z.core.$strip>;
|
|
477
534
|
export declare const GetAuthenticatedUserProfileOutputSchema: z.ZodObject<{
|
|
@@ -505,6 +562,7 @@ export declare const GetAuthenticatedUserProfileOutputSchema: z.ZodObject<{
|
|
|
505
562
|
DONE: "DONE";
|
|
506
563
|
}>;
|
|
507
564
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
565
|
+
version: z.ZodInt;
|
|
508
566
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
509
567
|
profileType: z.ZodOptional<z.ZodEnum<{
|
|
510
568
|
creative: "creative";
|
package/dist/schemas/user.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SearchUsersOutputSchema = exports.SearchUsersInputSchema = exports.GetUserActivityOutputSchema = exports.GetUserActivityInputSchema = exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.GetAuthenticatedUserProfileOutputSchema = exports.GetAuthenticatedUserOutputSchema = exports.UserWithPostsEntitySchema = exports.GetUserFollowingOutputSchema = exports.GetUserFollowersOutputSchema = exports.UserWithFollowersEntitySchema = exports.UserWithFollowingEntitySchema = exports.GetUserFollowersInputSchema = exports.GetUserFollowingInputSchema = exports.UserWithProjectBookmarksEntitySchema = exports.UserWithProjectLikesEntitySchema = exports.UserWithProjectsEntitySchema = exports.UserProfileEntitySchema = exports.UserStatsEntitySchema = exports.MinimalUserSchema = exports.UserEntitySchema = void 0;
|
|
3
|
+
exports.SearchUsersOutputSchema = exports.SearchUsersInputSchema = exports.GetUserActivityOutputSchema = exports.GetUserActivityInputSchema = exports.GetAuthenticatedUserWithProjectLikesOutputSchema = exports.GetAuthenticatedUserWithUserFollowersOutputSchema = exports.GetAuthenticatedUserWithUserFollowingOutputSchema = exports.GetAuthenticatedUserWithProjectBookmarksOutputSchema = exports.GetAuthenticatedUserWithProjectsOutputSchema = exports.GetAuthenticatedUserProfileOutputSchema = exports.GetAuthenticatedUserOutputSchema = exports.UserWithPostsEntitySchema = exports.GetUserFollowingOutputSchema = exports.GetUserFollowersOutputSchema = exports.UserWithFollowersEntitySchema = exports.UserWithFollowingEntitySchema = exports.GetUserFollowersInputSchema = exports.GetUserFollowingInputSchema = exports.UserWithProjectBookmarksEntitySchema = exports.UserWithPostBookmarksEntitySchema = exports.UserWithPostLikesEntitySchema = exports.UserWithProjectLikesEntitySchema = exports.UserWithProjectsEntitySchema = exports.UserProfileEntitySchema = exports.UserStatsEntitySchema = exports.MinimalUserSchema = exports.UserEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const project_1 = require("./project");
|
|
@@ -38,6 +38,7 @@ exports.UserEntitySchema = zod_openapi_1.z
|
|
|
38
38
|
createdAt: zod_openapi_1.z.coerce
|
|
39
39
|
.date()
|
|
40
40
|
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
41
|
+
version: zod_openapi_1.z.int(),
|
|
41
42
|
updatedAt: zod_openapi_1.z.coerce
|
|
42
43
|
.date()
|
|
43
44
|
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
@@ -82,6 +83,34 @@ exports.UserWithProjectLikesEntitySchema = zod_openapi_1.z.object({
|
|
|
82
83
|
}),
|
|
83
84
|
})),
|
|
84
85
|
});
|
|
86
|
+
exports.UserWithPostLikesEntitySchema = zod_openapi_1.z.object({
|
|
87
|
+
userId: zod_openapi_1.z.cuid2(),
|
|
88
|
+
postLikes: zod_openapi_1.z.array(like_1.LikeEntitySchema.extend({
|
|
89
|
+
post: post_1.PostEntitySchema.pick({
|
|
90
|
+
id: true,
|
|
91
|
+
parentId: true,
|
|
92
|
+
title: true,
|
|
93
|
+
content: true,
|
|
94
|
+
tags: true,
|
|
95
|
+
createdAt: true,
|
|
96
|
+
updatedAt: true,
|
|
97
|
+
}),
|
|
98
|
+
})),
|
|
99
|
+
});
|
|
100
|
+
exports.UserWithPostBookmarksEntitySchema = zod_openapi_1.z.object({
|
|
101
|
+
userId: zod_openapi_1.z.cuid2(),
|
|
102
|
+
postBookmarks: zod_openapi_1.z.array(bookmark_1.BookmarkEntitySchema.extend({
|
|
103
|
+
post: post_1.PostEntitySchema.pick({
|
|
104
|
+
id: true,
|
|
105
|
+
parentId: true,
|
|
106
|
+
title: true,
|
|
107
|
+
content: true,
|
|
108
|
+
tags: true,
|
|
109
|
+
createdAt: true,
|
|
110
|
+
updatedAt: true,
|
|
111
|
+
}),
|
|
112
|
+
})),
|
|
113
|
+
});
|
|
85
114
|
exports.UserWithProjectBookmarksEntitySchema = zod_openapi_1.z
|
|
86
115
|
.object({
|
|
87
116
|
userId: zod_openapi_1.z.cuid2(),
|
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,
|
|
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
|
|
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/dist/types/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MinimalUserSchema, UserEntitySchema, UserProfileEntitySchema, UserWithProjectsEntitySchema, UserWithProjectBookmarksEntitySchema, GetUserFollowingInputSchema, GetUserFollowersInputSchema, UserWithFollowingEntitySchema, UserWithFollowersEntitySchema, GetUserFollowingOutputSchema, GetUserFollowersOutputSchema, GetAuthenticatedUserOutputSchema, GetAuthenticatedUserProfileOutputSchema, GetAuthenticatedUserWithProjectsOutputSchema, GetAuthenticatedUserWithProjectBookmarksOutputSchema, GetAuthenticatedUserWithUserFollowingOutputSchema, GetAuthenticatedUserWithUserFollowersOutputSchema, SearchUsersInputSchema, UserWithProjectLikesEntitySchema, GetAuthenticatedUserWithProjectLikesOutputSchema, GetUserActivityInputSchema, GetUserActivityOutputSchema, UserStatsEntitySchema, UserWithPostsEntitySchema, SearchUsersOutputSchema } from "../schemas/user";
|
|
1
|
+
import { MinimalUserSchema, UserEntitySchema, UserProfileEntitySchema, UserWithProjectsEntitySchema, UserWithProjectBookmarksEntitySchema, GetUserFollowingInputSchema, GetUserFollowersInputSchema, UserWithFollowingEntitySchema, UserWithFollowersEntitySchema, GetUserFollowingOutputSchema, GetUserFollowersOutputSchema, GetAuthenticatedUserOutputSchema, GetAuthenticatedUserProfileOutputSchema, GetAuthenticatedUserWithProjectsOutputSchema, GetAuthenticatedUserWithProjectBookmarksOutputSchema, GetAuthenticatedUserWithUserFollowingOutputSchema, GetAuthenticatedUserWithUserFollowersOutputSchema, SearchUsersInputSchema, UserWithProjectLikesEntitySchema, GetAuthenticatedUserWithProjectLikesOutputSchema, GetUserActivityInputSchema, GetUserActivityOutputSchema, UserStatsEntitySchema, UserWithPostsEntitySchema, SearchUsersOutputSchema, UserWithPostBookmarksEntitySchema, UserWithPostLikesEntitySchema } from "../schemas/user";
|
|
2
2
|
import { z } from "@hono/zod-openapi";
|
|
3
3
|
export type BaseUserEntity = z.infer<typeof UserEntitySchema>;
|
|
4
4
|
export type MinimalUser = z.infer<typeof MinimalUserSchema>;
|
|
@@ -7,6 +7,8 @@ export type UserProfileEntity = z.infer<typeof UserProfileEntitySchema>;
|
|
|
7
7
|
export type UserWithProjectsEntity = z.infer<typeof UserWithProjectsEntitySchema>;
|
|
8
8
|
export type UserWithProjectBookmarksEntity = z.infer<typeof UserWithProjectBookmarksEntitySchema>;
|
|
9
9
|
export type UserWithProjectLikesEntity = z.infer<typeof UserWithProjectLikesEntitySchema>;
|
|
10
|
+
export type UserWithPostBookmarksEntity = z.infer<typeof UserWithPostBookmarksEntitySchema>;
|
|
11
|
+
export type UserWithPostLikesEntity = z.infer<typeof UserWithPostLikesEntitySchema>;
|
|
10
12
|
export type UserWithUserPostsEntity = z.infer<typeof UserWithPostsEntitySchema>;
|
|
11
13
|
export type GetUserFollowingInput = z.infer<typeof GetUserFollowingInputSchema>;
|
|
12
14
|
export type GetUserFollowersInput = z.infer<typeof GetUserFollowersInputSchema>;
|
package/package.json
CHANGED
package/src/schemas/post.ts
CHANGED
|
@@ -4,10 +4,8 @@ import {
|
|
|
4
4
|
POST_BADGE_TYPES,
|
|
5
5
|
POST_TYPES,
|
|
6
6
|
} from "../constants";
|
|
7
|
-
import { CreateFileInputSchema
|
|
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
|
|
|
@@ -172,7 +170,6 @@ export const CreatePostOutputSchema = PostEntitySchema;
|
|
|
172
170
|
export const GetPostOutputSchema = PostWithFilesEntitySchema;
|
|
173
171
|
export const PostIdSchema = z.object({ postId: z.cuid2() });
|
|
174
172
|
export const MinimalPostSchema = PostEntitySchema.pick({
|
|
175
|
-
title: true,
|
|
176
173
|
id: true,
|
|
177
174
|
parentId: true,
|
|
178
175
|
content: true,
|
package/src/schemas/project.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
|
|
144
|
+
.object({ id: z.cuid2() })
|
|
145
|
+
.openapi("ProjectUpdateOutputEntity");
|
|
144
146
|
|
|
145
147
|
export const CreateProjectInputSchema = z
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
227
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
242
|
+
title: "MinimalProject",
|
|
241
243
|
});
|
|
242
244
|
|
|
243
245
|
export const ListProjectsInputSchema = z
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
259
|
+
views: z.array(ViewEntitySchema),
|
|
258
260
|
}).openapi({
|
|
259
|
-
|
|
261
|
+
title: "ProjectWithProjectViewsEntity",
|
|
260
262
|
});
|
|
261
263
|
|
|
262
264
|
export const ProjectWithProjectCommentsEntitySchema =
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
MinimalProjectSchema.extend({
|
|
266
|
+
comments: z.array(CommentEntitySchema),
|
|
267
|
+
}).openapi({
|
|
268
|
+
title: "ProjectWithProjectCommentsEntity",
|
|
269
|
+
});
|
|
268
270
|
|
|
269
|
-
export const
|
|
270
|
-
|
|
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
|
-
|
|
279
|
+
title: "ProjectWithProjectLikesEntity",
|
|
273
280
|
});
|
|
274
281
|
|
|
275
282
|
export const ProjectWithProjectBookmarksEntitySchema =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
283
|
+
MinimalProjectSchema.extend({
|
|
284
|
+
bookmarks: z.array(BookmarkEntitySchema),
|
|
285
|
+
}).openapi({
|
|
286
|
+
title: "ProjectWithProjectBookmarksEntity",
|
|
287
|
+
});
|
package/src/schemas/user.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { LikeEntitySchema } from "./like";
|
|
|
20
20
|
import { BrandEntitySchema } from "./brand";
|
|
21
21
|
import { CreativeEntitySchema } from "./creative";
|
|
22
22
|
import { InvestorEntitySchema } from "./investor";
|
|
23
|
-
import { PostWithFilesEntitySchema } from "./post";
|
|
23
|
+
import { PostEntitySchema, PostWithFilesEntitySchema } from "./post";
|
|
24
24
|
|
|
25
25
|
export const UserEntitySchema = z
|
|
26
26
|
.object({
|
|
@@ -55,6 +55,7 @@ export const UserEntitySchema = z
|
|
|
55
55
|
createdAt: z.coerce
|
|
56
56
|
.date()
|
|
57
57
|
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
58
|
+
version: z.int(),
|
|
58
59
|
updatedAt: z.coerce
|
|
59
60
|
.date()
|
|
60
61
|
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
@@ -107,6 +108,40 @@ export const UserWithProjectLikesEntitySchema = z.object({
|
|
|
107
108
|
),
|
|
108
109
|
});
|
|
109
110
|
|
|
111
|
+
export const UserWithPostLikesEntitySchema = z.object({
|
|
112
|
+
userId: z.cuid2(),
|
|
113
|
+
postLikes: z.array(
|
|
114
|
+
LikeEntitySchema.extend({
|
|
115
|
+
post: PostEntitySchema.pick({
|
|
116
|
+
id: true,
|
|
117
|
+
parentId: true,
|
|
118
|
+
title: true,
|
|
119
|
+
content: true,
|
|
120
|
+
tags: true,
|
|
121
|
+
createdAt: true,
|
|
122
|
+
updatedAt: true,
|
|
123
|
+
}),
|
|
124
|
+
}),
|
|
125
|
+
),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const UserWithPostBookmarksEntitySchema = z.object({
|
|
129
|
+
userId: z.cuid2(),
|
|
130
|
+
postBookmarks: z.array(
|
|
131
|
+
BookmarkEntitySchema.extend({
|
|
132
|
+
post: PostEntitySchema.pick({
|
|
133
|
+
id: true,
|
|
134
|
+
parentId: true,
|
|
135
|
+
title: true,
|
|
136
|
+
content: true,
|
|
137
|
+
tags: true,
|
|
138
|
+
createdAt: true,
|
|
139
|
+
updatedAt: true,
|
|
140
|
+
}),
|
|
141
|
+
}),
|
|
142
|
+
),
|
|
143
|
+
});
|
|
144
|
+
|
|
110
145
|
export const UserWithProjectBookmarksEntitySchema = z
|
|
111
146
|
.object({
|
|
112
147
|
userId: z.cuid2(),
|
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
|
+
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
|
-
|
|
36
|
+
typeof ProjectWithProjectViewsEntitySchema
|
|
37
37
|
>;
|
|
38
38
|
export type ProjectWithProjectCommentsEntity = z.infer<
|
|
39
|
-
|
|
39
|
+
typeof ProjectWithProjectCommentsEntitySchema
|
|
40
40
|
>;
|
|
41
|
-
export type
|
|
42
|
-
|
|
41
|
+
export type ProjectWithLikesEntity = z.infer<
|
|
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>;
|
package/src/types/user.ts
CHANGED
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
UserStatsEntitySchema,
|
|
25
25
|
UserWithPostsEntitySchema,
|
|
26
26
|
SearchUsersOutputSchema,
|
|
27
|
+
UserWithPostBookmarksEntitySchema,
|
|
28
|
+
UserWithPostLikesEntitySchema,
|
|
27
29
|
} from "../schemas/user";
|
|
28
30
|
|
|
29
31
|
import { z } from "@hono/zod-openapi";
|
|
@@ -41,6 +43,14 @@ export type UserWithProjectBookmarksEntity = z.infer<
|
|
|
41
43
|
export type UserWithProjectLikesEntity = z.infer<
|
|
42
44
|
typeof UserWithProjectLikesEntitySchema
|
|
43
45
|
>;
|
|
46
|
+
|
|
47
|
+
export type UserWithPostBookmarksEntity = z.infer<
|
|
48
|
+
typeof UserWithPostBookmarksEntitySchema
|
|
49
|
+
>;
|
|
50
|
+
export type UserWithPostLikesEntity = z.infer<
|
|
51
|
+
typeof UserWithPostLikesEntitySchema
|
|
52
|
+
>;
|
|
53
|
+
|
|
44
54
|
export type UserWithUserPostsEntity = z.infer<typeof UserWithPostsEntitySchema>;
|
|
45
55
|
export type GetUserFollowingInput = z.infer<typeof GetUserFollowingInputSchema>;
|
|
46
56
|
export type GetUserFollowersInput = z.infer<typeof GetUserFollowersInputSchema>;
|