@zyacreatives/shared 1.3.8 → 1.4.0

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.
@@ -1,112 +1,94 @@
1
- import type { ClientType, Role } from "../constants";
2
- import type { ProjectSocialGraphEntity } from "./common";
3
- import { FileEntity } from "./file";
4
- import type { MinimalUser } from "./user";
1
+ import type { z } from "@hono/zod-openapi";
2
+ import type {
3
+ ProjectEntitySchema,
4
+ ProjectFileEntitySchema,
5
+ ProjectWithFilesEntitySchema,
6
+ ProjectViewEntitySchema,
7
+ ProjectLikeEntitySchema,
8
+ ProjectCommentEntitySchema,
9
+ ProjectBookmarkEntitySchema,
10
+ ProjectUpdateOutputEntitySchema,
11
+ CreateProjectInputSchema,
12
+ CreateProjectOutputSchema,
13
+ UpdateProjectInputSchema,
14
+ UpdateProjectOutputSchema,
15
+ ProjectIdSchema,
16
+ CommentOnProjectParamsSchema,
17
+ CommentOnProjectInputSchema,
18
+ CommentOnProjectOutputSchema,
19
+ DeleteProjectInputSchema,
20
+ DeleteProjectCommentParamsSchema,
21
+ DeleteProjectCommentOutputSchema,
22
+ DeleteProjectOutputSchema,
23
+ GetProjectParamsSchema,
24
+ GetProjectOutputSchema,
25
+ BookmarkProjectParamsSchema,
26
+ BookmarkProjectOutputSchema,
27
+ LikeProjectParamsSchema,
28
+ UnlikeProjectParamsSchema,
29
+ ViewProjectInputSchema,
30
+ MinimalProjectSchema,
31
+ ListProjectsInputSchema,
32
+ ProjectWithProjectViewsEntitySchema,
33
+ ProjectWithProjectCommentsEntitySchema,
34
+ ProjectWithProjectLikesEntitySchema,
35
+ ProjectWithProjectBookmarksEntitySchema,
36
+ } from "../schemas/project";
5
37
 
6
- export type ProjectFileEntity = {
7
- id: string;
8
- projectId: string;
9
- fileId: string;
10
- order: number;
11
- isPlaceholder: boolean;
12
- };
38
+ export type ProjectEntity = z.infer<typeof ProjectEntitySchema>;
39
+ export type ProjectFileEntity = z.infer<typeof ProjectFileEntitySchema>;
13
40
 
14
- export type ProjectEntity = {
15
- id: string;
16
- createdAt: Date;
17
- updatedAt: Date;
18
- userId: string;
19
- title: string;
20
- description?: string;
21
- overview?: string;
22
- url?: string;
23
- clientId?: string;
24
- clientType?: ClientType;
25
- clientName?: string;
26
- projectCreatorType: Role;
27
- tags?: string[];
28
- isFeatured?: boolean;
29
- startDate?: Date;
30
- imagePlaceholderUrl?: string;
31
- endDate?: Date;
32
- };
33
-
34
- export type ProjectStatsEntity = ProjectSocialGraphEntity;
35
-
36
- export type ProjectViewEntity = {
37
- id: string;
38
- userId?: string;
39
- ipAddress?: string;
40
- userAgent?: string;
41
- projectId: string;
42
- sessionId?: string;
43
- viewedAt: Date;
44
- viewDate: Date;
45
- };
46
-
47
- export type ProjectLikeEntity = {
48
- createdAt: Date;
49
- userId: string;
50
- projectId: string;
51
- };
52
- export type ProjectCommentEntity = {
53
- id: string;
54
- createdAt: Date;
55
- userId: string;
56
- projectId: string;
57
- parentCommentId?: string;
58
- content: string;
59
- };
60
- export type ProjectBookmarkEntity = {
61
- createdAt: Date;
62
- userId: string;
63
- projectId: string;
64
- };
65
- export type ProjectUpdateOutputEntity = {
66
- id: string;
67
- };
68
- export type MinimalProject = Pick<
69
- ProjectEntity,
70
- | "id"
71
- | "title"
72
- | "description"
73
- | "tags"
74
- | "startDate"
75
- | "endDate"
76
- | "imagePlaceholderUrl"
41
+ export type ProjectWithFilesEntity = z.infer<
42
+ typeof ProjectWithFilesEntitySchema
43
+ >;
44
+ export type ProjectViewEntity = z.infer<typeof ProjectViewEntitySchema>;
45
+ export type ProjectLikeEntity = z.infer<typeof ProjectLikeEntitySchema>;
46
+ export type ProjectCommentEntity = z.infer<typeof ProjectCommentEntitySchema>;
47
+ export type ProjectBookmarkEntity = z.infer<typeof ProjectBookmarkEntitySchema>;
48
+ export type ProjectUpdateOutputEntity = z.infer<
49
+ typeof ProjectUpdateOutputEntitySchema
77
50
  >;
78
51
 
79
- export type ProjectWithClientEntity = MinimalProject & {
80
- client: MinimalUser;
81
- };
82
-
83
- export type ProjectWithProjectFilesEntity = MinimalProject & {
84
- projectFiles: (ProjectFileEntity & {
85
- file: FileEntity;
86
- })[];
87
- };
88
-
89
- export type ListProjectsInput = {
90
- query?: string;
91
- tags?: string[];
92
- clientName?: string;
93
- userId?: string;
94
- page?: number;
95
- perPage?: number;
96
- };
97
-
98
- export type ProjectWithProjectViewsEntity = MinimalProject & {
99
- views: ProjectViewEntity[];
100
- };
101
-
102
- export type ProjectWithProjectCommentsEntity = MinimalProject & {
103
- comments: ProjectCommentEntity[];
104
- };
52
+ export type CreateProjectInput = z.infer<typeof CreateProjectInputSchema>;
53
+ export type CreateProjectOutput = z.infer<typeof CreateProjectOutputSchema>;
54
+ export type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;
55
+ export type UpdateProjectOutput = z.infer<typeof UpdateProjectOutputSchema>;
105
56
 
106
- export type ProjectWithProjectLikesEntity = MinimalProject & {
107
- likes: ProjectLikeEntity[];
108
- };
57
+ export type ProjectId = z.infer<typeof ProjectIdSchema>;
58
+ export type CommentOnProjectParams = z.infer<
59
+ typeof CommentOnProjectParamsSchema
60
+ >;
61
+ export type CommentOnProjectInput = z.infer<typeof CommentOnProjectInputSchema>;
62
+ export type CommentOnProjectOutput = z.infer<
63
+ typeof CommentOnProjectOutputSchema
64
+ >;
65
+ export type DeleteProjectInput = z.infer<typeof DeleteProjectInputSchema>;
66
+ export type DeleteProjectCommentParams = z.infer<
67
+ typeof DeleteProjectCommentParamsSchema
68
+ >;
69
+ export type DeleteProjectCommentOutput = z.infer<
70
+ typeof DeleteProjectCommentOutputSchema
71
+ >;
72
+ export type DeleteProjectOutput = z.infer<typeof DeleteProjectOutputSchema>;
73
+ export type GetProjectParams = z.infer<typeof GetProjectParamsSchema>;
74
+ export type GetProjectOutput = z.infer<typeof GetProjectOutputSchema>;
75
+ export type BookmarkProjectParams = z.infer<typeof BookmarkProjectParamsSchema>;
76
+ export type BookmarkProjectOutput = z.infer<typeof BookmarkProjectOutputSchema>;
77
+ export type LikeProjectParams = z.infer<typeof LikeProjectParamsSchema>;
78
+ export type UnlikeProjectParams = z.infer<typeof UnlikeProjectParamsSchema>;
79
+ export type ViewProjectInput = z.infer<typeof ViewProjectInputSchema>;
109
80
 
110
- export type ProjectWithProjectBookmarksEntity = MinimalProject & {
111
- bookmarks: ProjectBookmarkEntity[];
112
- };
81
+ export type MinimalProject = z.infer<typeof MinimalProjectSchema>;
82
+ export type ListProjectsInput = z.infer<typeof ListProjectsInputSchema>;
83
+ export type ProjectWithProjectViewsEntity = z.infer<
84
+ typeof ProjectWithProjectViewsEntitySchema
85
+ >;
86
+ export type ProjectWithProjectCommentsEntity = z.infer<
87
+ typeof ProjectWithProjectCommentsEntitySchema
88
+ >;
89
+ export type ProjectWithProjectLikesEntity = z.infer<
90
+ typeof ProjectWithProjectLikesEntitySchema
91
+ >;
92
+ export type ProjectWithProjectBookmarksEntity = z.infer<
93
+ typeof ProjectWithProjectBookmarksEntitySchema
94
+ >;