@zyacreatives/shared 2.1.84 → 2.1.86
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/README.md +1 -1
- package/dist/schemas/post.d.ts +26 -0
- package/dist/schemas/post.js +24 -1
- package/dist/types/post.d.ts +2 -1
- package/package.json +1 -1
- package/src/constants.ts +483 -483
- package/src/index.ts +4 -4
- package/src/schemas/activity.ts +14 -14
- package/src/schemas/auth.ts +43 -43
- package/src/schemas/bookmark.ts +38 -38
- package/src/schemas/brand.ts +146 -146
- package/src/schemas/chat.ts +31 -31
- package/src/schemas/comment.ts +60 -60
- package/src/schemas/common.ts +22 -22
- package/src/schemas/creative.ts +222 -222
- package/src/schemas/discipline.ts +88 -88
- package/src/schemas/entity-stats.ts +43 -43
- package/src/schemas/feed.ts +11 -11
- package/src/schemas/file.ts +61 -61
- package/src/schemas/index.ts +21 -21
- package/src/schemas/investor.ts +211 -211
- package/src/schemas/job-application.ts +257 -257
- package/src/schemas/job.ts +364 -364
- package/src/schemas/like.ts +38 -38
- package/src/schemas/message.ts +112 -112
- package/src/schemas/notification.ts +71 -71
- package/src/schemas/post.ts +279 -255
- package/src/schemas/project.ts +298 -298
- package/src/schemas/user-strike.ts +21 -21
- package/src/schemas/user.ts +283 -283
- package/src/schemas/username.ts +11 -11
- package/src/schemas/view.ts +50 -50
- package/src/types/auth.ts +5 -5
- package/src/types/bookmark.ts +4 -4
- package/src/types/brand.ts +37 -37
- package/src/types/chat.ts +21 -21
- package/src/types/comment.ts +12 -12
- package/src/types/common.ts +9 -9
- package/src/types/creative.ts +33 -33
- package/src/types/discipline.ts +32 -32
- package/src/types/entity-stats.ts +4 -4
- package/src/types/feed.ts +5 -5
- package/src/types/file.ts +39 -39
- package/src/types/index.ts +22 -22
- package/src/types/investor.ts +34 -34
- package/src/types/job-application.ts +41 -41
- package/src/types/job.ts +71 -71
- package/src/types/like.ts +3 -3
- package/src/types/message.ts +23 -23
- package/src/types/notification.ts +34 -34
- package/src/types/post.ts +63 -60
- package/src/types/project.ts +65 -65
- package/src/types/user-strike.ts +10 -10
- package/src/types/user.ts +96 -96
- package/src/types/username.ts +4 -4
- package/src/utils/slugify.ts +10 -10
- package/tsconfig.json +13 -13
package/src/schemas/comment.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
-
|
|
4
|
-
export const CommentEntitySchema = z.object({
|
|
5
|
-
id: z.cuid2().openapi({
|
|
6
|
-
description: "The unique CUID2 identifier for the comment.",
|
|
7
|
-
example: "tr4q2k7k0000c7625z2k8ggy",
|
|
8
|
-
}),
|
|
9
|
-
userId: z.cuid2().openapi({
|
|
10
|
-
description: "The CUID2 of the user who created the comment.",
|
|
11
|
-
example: "clq9p8f2z0000c762s7k4g1b",
|
|
12
|
-
}),
|
|
13
|
-
parentId: z.cuid2().openapi({
|
|
14
|
-
description:
|
|
15
|
-
"The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
|
|
16
|
-
example: "clq9p8f2z0000c762s7k4g1b",
|
|
17
|
-
}),
|
|
18
|
-
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
19
|
-
description: "The type of the parent entity this comment is attached to.",
|
|
20
|
-
example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
|
|
21
|
-
}),
|
|
22
|
-
content: z.string().openapi({
|
|
23
|
-
description: "The text content of the comment. May contain Markdown.",
|
|
24
|
-
example: "This is a great point! I hadn't considered that perspective.",
|
|
25
|
-
}),
|
|
26
|
-
commenterUsername: z.string().optional(),
|
|
27
|
-
commenterName: z.string().optional(),
|
|
28
|
-
commenterImageUrl: z.string().optional(),
|
|
29
|
-
replyToId: z.cuid2().optional().nullable().openapi({
|
|
30
|
-
description:
|
|
31
|
-
"The ID of the parent comment if this is a reply. Null for top-level comments.",
|
|
32
|
-
example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
|
|
33
|
-
}),
|
|
34
|
-
createdAt: z.coerce.date().optional().openapi({
|
|
35
|
-
description: "The date and time the comment was created.",
|
|
36
|
-
example: "2023-10-27T10:00:00.000Z",
|
|
37
|
-
format: "date-time",
|
|
38
|
-
}),
|
|
39
|
-
isLiked: z.boolean().default(false),
|
|
40
|
-
likesCount: z.int().default(0),
|
|
41
|
-
updatedAt: z.coerce.date().optional().openapi({
|
|
42
|
-
description: "The date and time the comment was last updated.",
|
|
43
|
-
example: "2023-10-27T10:05:00.000Z",
|
|
44
|
-
format: "date-time",
|
|
45
|
-
}),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const CommentInputSchema = z
|
|
49
|
-
.object({
|
|
50
|
-
content: z.string(),
|
|
51
|
-
parentCommentId: z.cuid2().optional(),
|
|
52
|
-
replyToId: z.cuid2().optional(),
|
|
53
|
-
})
|
|
54
|
-
.openapi({ title: "Comment on Project" });
|
|
55
|
-
|
|
56
|
-
export const DeleteCommentInputSchema = z.object({
|
|
57
|
-
commentId: z.cuid2(),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export const CommentOutputSchema = CommentEntitySchema;
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
+
|
|
4
|
+
export const CommentEntitySchema = z.object({
|
|
5
|
+
id: z.cuid2().openapi({
|
|
6
|
+
description: "The unique CUID2 identifier for the comment.",
|
|
7
|
+
example: "tr4q2k7k0000c7625z2k8ggy",
|
|
8
|
+
}),
|
|
9
|
+
userId: z.cuid2().openapi({
|
|
10
|
+
description: "The CUID2 of the user who created the comment.",
|
|
11
|
+
example: "clq9p8f2z0000c762s7k4g1b",
|
|
12
|
+
}),
|
|
13
|
+
parentId: z.cuid2().openapi({
|
|
14
|
+
description:
|
|
15
|
+
"The CUID2 of the parent entity (e.g., a post or project) this comment belongs to.",
|
|
16
|
+
example: "clq9p8f2z0000c762s7k4g1b",
|
|
17
|
+
}),
|
|
18
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
19
|
+
description: "The type of the parent entity this comment is attached to.",
|
|
20
|
+
example: "POST", // Assuming 'POST' is a value in ACTIVITY_PARENT_TYPES
|
|
21
|
+
}),
|
|
22
|
+
content: z.string().openapi({
|
|
23
|
+
description: "The text content of the comment. May contain Markdown.",
|
|
24
|
+
example: "This is a great point! I hadn't considered that perspective.",
|
|
25
|
+
}),
|
|
26
|
+
commenterUsername: z.string().optional(),
|
|
27
|
+
commenterName: z.string().optional(),
|
|
28
|
+
commenterImageUrl: z.string().optional(),
|
|
29
|
+
replyToId: z.cuid2().optional().nullable().openapi({
|
|
30
|
+
description:
|
|
31
|
+
"The ID of the parent comment if this is a reply. Null for top-level comments.",
|
|
32
|
+
example: "tr4q2k7k0000c7625z2k8ggy", // Example of a parent comment's ID
|
|
33
|
+
}),
|
|
34
|
+
createdAt: z.coerce.date().optional().openapi({
|
|
35
|
+
description: "The date and time the comment was created.",
|
|
36
|
+
example: "2023-10-27T10:00:00.000Z",
|
|
37
|
+
format: "date-time",
|
|
38
|
+
}),
|
|
39
|
+
isLiked: z.boolean().default(false),
|
|
40
|
+
likesCount: z.int().default(0),
|
|
41
|
+
updatedAt: z.coerce.date().optional().openapi({
|
|
42
|
+
description: "The date and time the comment was last updated.",
|
|
43
|
+
example: "2023-10-27T10:05:00.000Z",
|
|
44
|
+
format: "date-time",
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const CommentInputSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
content: z.string(),
|
|
51
|
+
parentCommentId: z.cuid2().optional(),
|
|
52
|
+
replyToId: z.cuid2().optional(),
|
|
53
|
+
})
|
|
54
|
+
.openapi({ title: "Comment on Project" });
|
|
55
|
+
|
|
56
|
+
export const DeleteCommentInputSchema = z.object({
|
|
57
|
+
commentId: z.cuid2(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const CommentOutputSchema = CommentEntitySchema;
|
package/src/schemas/common.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
export const CuidSchema = z.cuid2({ error: "Invalid CUID2 is written." });
|
|
4
|
-
|
|
5
|
-
export const UserIdentifierSchema = z.object({
|
|
6
|
-
by: z.enum(["id", "username"]).optional().default("id"),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export type UserIdentifier = z.infer<typeof UserIdentifierSchema>;
|
|
10
|
-
|
|
11
|
-
export const ProfileIdentifierSchema = z.object({
|
|
12
|
-
by: z.enum(["id", "userId"]).optional().default("id"),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export type ProfileIdentifier = z.infer<typeof ProfileIdentifierSchema>;
|
|
16
|
-
|
|
17
|
-
export const ProjectIdentifierSchema = z.object({
|
|
18
|
-
by: z.enum(["id", "userId"]).optional().default("id"),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export type ProjectIdentifier = z.infer<typeof ProjectIdentifierSchema>;
|
|
22
|
-
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const CuidSchema = z.cuid2({ error: "Invalid CUID2 is written." });
|
|
4
|
+
|
|
5
|
+
export const UserIdentifierSchema = z.object({
|
|
6
|
+
by: z.enum(["id", "username"]).optional().default("id"),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type UserIdentifier = z.infer<typeof UserIdentifierSchema>;
|
|
10
|
+
|
|
11
|
+
export const ProfileIdentifierSchema = z.object({
|
|
12
|
+
by: z.enum(["id", "userId"]).optional().default("id"),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type ProfileIdentifier = z.infer<typeof ProfileIdentifierSchema>;
|
|
16
|
+
|
|
17
|
+
export const ProjectIdentifierSchema = z.object({
|
|
18
|
+
by: z.enum(["id", "userId"]).optional().default("id"),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type ProjectIdentifier = z.infer<typeof ProjectIdentifierSchema>;
|
|
22
|
+
|
package/src/schemas/creative.ts
CHANGED
|
@@ -1,222 +1,222 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { EXPERIENCE_LEVELS, ExperienceLevel, LINK_TYPES } from "../constants";
|
|
3
|
-
import { ProfileIdentifierSchema } from "./common";
|
|
4
|
-
import { MinimalUserSchema } from "./user";
|
|
5
|
-
|
|
6
|
-
export const MinimalCreativeEntitySchema = z.object({
|
|
7
|
-
id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
8
|
-
userId: z.cuid2().openapi({ example: "user_abc123" }),
|
|
9
|
-
bio: z.string().optional().openapi({
|
|
10
|
-
example: "A multi-disciplinary designer specializing in brand identity.",
|
|
11
|
-
}),
|
|
12
|
-
role: z.string().optional().openapi({ example: "Designer" }),
|
|
13
|
-
location: z.string().optional().openapi({ example: "London, UK" }),
|
|
14
|
-
experienceLevel: z
|
|
15
|
-
.enum(
|
|
16
|
-
Object.values(EXPERIENCE_LEVELS) as [
|
|
17
|
-
ExperienceLevel,
|
|
18
|
-
...ExperienceLevel[],
|
|
19
|
-
],
|
|
20
|
-
)
|
|
21
|
-
.optional()
|
|
22
|
-
.openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
|
|
23
|
-
|
|
24
|
-
disciplines: z
|
|
25
|
-
.array(z.string())
|
|
26
|
-
.optional()
|
|
27
|
-
.openapi({ example: ["Design", "Art Direction"] }),
|
|
28
|
-
createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
29
|
-
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const CreativeEntitySchema = z
|
|
33
|
-
.object({
|
|
34
|
-
id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
35
|
-
userId: z.cuid2().openapi({ example: "user_abc123" }),
|
|
36
|
-
bio: z.string().optional().openapi({
|
|
37
|
-
example: "A multi-disciplinary designer specializing in brand identity.",
|
|
38
|
-
}),
|
|
39
|
-
role: z.string().optional().openapi({ example: "Designer" }),
|
|
40
|
-
version: z.int(),
|
|
41
|
-
location: z.string().optional().openapi({ example: "London, UK" }),
|
|
42
|
-
experienceLevel: z
|
|
43
|
-
.enum(
|
|
44
|
-
Object.values(EXPERIENCE_LEVELS) as [
|
|
45
|
-
ExperienceLevel,
|
|
46
|
-
...ExperienceLevel[],
|
|
47
|
-
],
|
|
48
|
-
)
|
|
49
|
-
.optional()
|
|
50
|
-
.openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
|
|
51
|
-
|
|
52
|
-
disciplines: z
|
|
53
|
-
.array(z.string())
|
|
54
|
-
.optional()
|
|
55
|
-
.openapi({ example: ["Design", "Art Direction"] }),
|
|
56
|
-
workExperience: z
|
|
57
|
-
.object({
|
|
58
|
-
companyName: z.string(),
|
|
59
|
-
position: z.string(),
|
|
60
|
-
startDate: z.coerce.date().optional(),
|
|
61
|
-
endDate: z.coerce.date().optional(),
|
|
62
|
-
currentlyWorking: z.boolean().optional(),
|
|
63
|
-
description: z.string(),
|
|
64
|
-
})
|
|
65
|
-
.array()
|
|
66
|
-
.optional(),
|
|
67
|
-
links: z
|
|
68
|
-
.object({
|
|
69
|
-
url: z.union([
|
|
70
|
-
z.url({ message: "Please enter a valid URL" }),
|
|
71
|
-
z.literal(""),
|
|
72
|
-
]),
|
|
73
|
-
type: z.enum(LINK_TYPES),
|
|
74
|
-
})
|
|
75
|
-
.array()
|
|
76
|
-
.optional(),
|
|
77
|
-
achievements: z
|
|
78
|
-
.object({
|
|
79
|
-
title: z.string(),
|
|
80
|
-
link: z.string().optional(),
|
|
81
|
-
year: z.coerce.number().int().optional(),
|
|
82
|
-
})
|
|
83
|
-
.array()
|
|
84
|
-
.optional(),
|
|
85
|
-
createdAt: z.coerce
|
|
86
|
-
.date()
|
|
87
|
-
.optional()
|
|
88
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
89
|
-
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
.openapi({
|
|
93
|
-
title: "CreativeEntitySchema",
|
|
94
|
-
description:
|
|
95
|
-
"Represents a creative profile, including bio, experience level, location, disciplines and timestamps.",
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
export const CreateCreativeProfileInputSchema = z
|
|
99
|
-
.object({
|
|
100
|
-
experienceLevel: z
|
|
101
|
-
.enum(EXPERIENCE_LEVELS)
|
|
102
|
-
.describe("Overall experience range of the creative.")
|
|
103
|
-
.default(EXPERIENCE_LEVELS.YEAR_0_1)
|
|
104
|
-
.openapi({
|
|
105
|
-
example: EXPERIENCE_LEVELS.YEAR_1_3,
|
|
106
|
-
}),
|
|
107
|
-
role: z.string().optional().openapi({ example: "Designer" }),
|
|
108
|
-
|
|
109
|
-
location: z
|
|
110
|
-
.string()
|
|
111
|
-
.max(100)
|
|
112
|
-
.optional()
|
|
113
|
-
.describe("Primary location where the creative works or resides.")
|
|
114
|
-
.openapi({
|
|
115
|
-
example: "Lagos, Nigeria",
|
|
116
|
-
}),
|
|
117
|
-
disciplineSlugs: z
|
|
118
|
-
.array(z.string())
|
|
119
|
-
.min(1, "At least one discipline is required")
|
|
120
|
-
.default([])
|
|
121
|
-
.describe("List of discipline slugs representing the creative’s fields.")
|
|
122
|
-
.openapi({
|
|
123
|
-
example: ["ui-ux", "frontend"],
|
|
124
|
-
}),
|
|
125
|
-
})
|
|
126
|
-
.openapi({
|
|
127
|
-
title: "create creative profile",
|
|
128
|
-
description: "Payload for creating a new creative profile.",
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
export const UpdateCreativeProfileInputSchema = z
|
|
132
|
-
.object({
|
|
133
|
-
experienceLevel: z
|
|
134
|
-
.enum(EXPERIENCE_LEVELS)
|
|
135
|
-
.optional()
|
|
136
|
-
.openapi({ example: EXPERIENCE_LEVELS.YEAR_3_5 }),
|
|
137
|
-
role: z.string().optional().openapi({ example: "Designer" }),
|
|
138
|
-
bio: z
|
|
139
|
-
.string()
|
|
140
|
-
.max(600)
|
|
141
|
-
.optional()
|
|
142
|
-
.openapi({ example: "I am a freelance UI/UX designer." }),
|
|
143
|
-
location: z
|
|
144
|
-
.string()
|
|
145
|
-
.max(100)
|
|
146
|
-
.optional()
|
|
147
|
-
.openapi({ example: "Lagos, Nigeria" }),
|
|
148
|
-
disciplineSlugs: z
|
|
149
|
-
.array(z.string())
|
|
150
|
-
.min(1, "At least one discipline is required")
|
|
151
|
-
.optional()
|
|
152
|
-
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
153
|
-
workExperience: z
|
|
154
|
-
.object({
|
|
155
|
-
companyName: z.string(),
|
|
156
|
-
position: z.string(),
|
|
157
|
-
startDate: z.string().optional(),
|
|
158
|
-
endDate: z.string().optional(),
|
|
159
|
-
currentlyWorking: z.boolean().default(false),
|
|
160
|
-
description: z.string().optional(),
|
|
161
|
-
})
|
|
162
|
-
.array()
|
|
163
|
-
.optional(),
|
|
164
|
-
links: z
|
|
165
|
-
.object({
|
|
166
|
-
url: z.union([
|
|
167
|
-
z.url({ message: "Please enter a valid URL" }),
|
|
168
|
-
z.literal(""),
|
|
169
|
-
]),
|
|
170
|
-
type: z.enum(LINK_TYPES),
|
|
171
|
-
})
|
|
172
|
-
.array()
|
|
173
|
-
.optional(),
|
|
174
|
-
version: z.int(),
|
|
175
|
-
achievements: z
|
|
176
|
-
.object({
|
|
177
|
-
title: z.string(),
|
|
178
|
-
link: z.string().optional(),
|
|
179
|
-
year: z.coerce.number().int().optional(),
|
|
180
|
-
})
|
|
181
|
-
.array()
|
|
182
|
-
.optional(),
|
|
183
|
-
})
|
|
184
|
-
.openapi({
|
|
185
|
-
title: "update creative profile",
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
export const GetCreativeInputSchema = z.object({
|
|
189
|
-
value: z.cuid2(),
|
|
190
|
-
by: ProfileIdentifierSchema.shape.by,
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
export const GetCreativeQuerySchema = ProfileIdentifierSchema;
|
|
194
|
-
|
|
195
|
-
export const CreateCreativeOutputSchema = CreativeEntitySchema;
|
|
196
|
-
|
|
197
|
-
export const GetCreativeOutputSchema = CreativeEntitySchema;
|
|
198
|
-
|
|
199
|
-
export const UpdateCreativeOutputSchema = CreativeEntitySchema;
|
|
200
|
-
|
|
201
|
-
export const CreativeWithUserEntitySchema = MinimalCreativeEntitySchema.extend({
|
|
202
|
-
user: MinimalUserSchema,
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
export const SearchCreativeInputSchema = z.object({
|
|
206
|
-
string: z
|
|
207
|
-
.string()
|
|
208
|
-
.min(1, { message: "Search string cannot be empty" })
|
|
209
|
-
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
210
|
-
limit: z.coerce
|
|
211
|
-
.number()
|
|
212
|
-
.int({ message: "Limit must be an integer" })
|
|
213
|
-
.min(1, { message: "Limit must be at least 1" })
|
|
214
|
-
.max(100, { message: "Limit cannot exceed 100" })
|
|
215
|
-
.default(20),
|
|
216
|
-
cursor: z.string().optional(),
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
export const SearchCreativeOutputSchema = z.object({
|
|
220
|
-
creatives: z.array(CreativeWithUserEntitySchema),
|
|
221
|
-
nextCursor: z.string().optional().nullable(),
|
|
222
|
-
});
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { EXPERIENCE_LEVELS, ExperienceLevel, LINK_TYPES } from "../constants";
|
|
3
|
+
import { ProfileIdentifierSchema } from "./common";
|
|
4
|
+
import { MinimalUserSchema } from "./user";
|
|
5
|
+
|
|
6
|
+
export const MinimalCreativeEntitySchema = z.object({
|
|
7
|
+
id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
8
|
+
userId: z.cuid2().openapi({ example: "user_abc123" }),
|
|
9
|
+
bio: z.string().optional().openapi({
|
|
10
|
+
example: "A multi-disciplinary designer specializing in brand identity.",
|
|
11
|
+
}),
|
|
12
|
+
role: z.string().optional().openapi({ example: "Designer" }),
|
|
13
|
+
location: z.string().optional().openapi({ example: "London, UK" }),
|
|
14
|
+
experienceLevel: z
|
|
15
|
+
.enum(
|
|
16
|
+
Object.values(EXPERIENCE_LEVELS) as [
|
|
17
|
+
ExperienceLevel,
|
|
18
|
+
...ExperienceLevel[],
|
|
19
|
+
],
|
|
20
|
+
)
|
|
21
|
+
.optional()
|
|
22
|
+
.openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
|
|
23
|
+
|
|
24
|
+
disciplines: z
|
|
25
|
+
.array(z.string())
|
|
26
|
+
.optional()
|
|
27
|
+
.openapi({ example: ["Design", "Art Direction"] }),
|
|
28
|
+
createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
29
|
+
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const CreativeEntitySchema = z
|
|
33
|
+
.object({
|
|
34
|
+
id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
35
|
+
userId: z.cuid2().openapi({ example: "user_abc123" }),
|
|
36
|
+
bio: z.string().optional().openapi({
|
|
37
|
+
example: "A multi-disciplinary designer specializing in brand identity.",
|
|
38
|
+
}),
|
|
39
|
+
role: z.string().optional().openapi({ example: "Designer" }),
|
|
40
|
+
version: z.int(),
|
|
41
|
+
location: z.string().optional().openapi({ example: "London, UK" }),
|
|
42
|
+
experienceLevel: z
|
|
43
|
+
.enum(
|
|
44
|
+
Object.values(EXPERIENCE_LEVELS) as [
|
|
45
|
+
ExperienceLevel,
|
|
46
|
+
...ExperienceLevel[],
|
|
47
|
+
],
|
|
48
|
+
)
|
|
49
|
+
.optional()
|
|
50
|
+
.openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
|
|
51
|
+
|
|
52
|
+
disciplines: z
|
|
53
|
+
.array(z.string())
|
|
54
|
+
.optional()
|
|
55
|
+
.openapi({ example: ["Design", "Art Direction"] }),
|
|
56
|
+
workExperience: z
|
|
57
|
+
.object({
|
|
58
|
+
companyName: z.string(),
|
|
59
|
+
position: z.string(),
|
|
60
|
+
startDate: z.coerce.date().optional(),
|
|
61
|
+
endDate: z.coerce.date().optional(),
|
|
62
|
+
currentlyWorking: z.boolean().optional(),
|
|
63
|
+
description: z.string(),
|
|
64
|
+
})
|
|
65
|
+
.array()
|
|
66
|
+
.optional(),
|
|
67
|
+
links: z
|
|
68
|
+
.object({
|
|
69
|
+
url: z.union([
|
|
70
|
+
z.url({ message: "Please enter a valid URL" }),
|
|
71
|
+
z.literal(""),
|
|
72
|
+
]),
|
|
73
|
+
type: z.enum(LINK_TYPES),
|
|
74
|
+
})
|
|
75
|
+
.array()
|
|
76
|
+
.optional(),
|
|
77
|
+
achievements: z
|
|
78
|
+
.object({
|
|
79
|
+
title: z.string(),
|
|
80
|
+
link: z.string().optional(),
|
|
81
|
+
year: z.coerce.number().int().optional(),
|
|
82
|
+
})
|
|
83
|
+
.array()
|
|
84
|
+
.optional(),
|
|
85
|
+
createdAt: z.coerce
|
|
86
|
+
.date()
|
|
87
|
+
.optional()
|
|
88
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
89
|
+
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
90
|
+
|
|
91
|
+
})
|
|
92
|
+
.openapi({
|
|
93
|
+
title: "CreativeEntitySchema",
|
|
94
|
+
description:
|
|
95
|
+
"Represents a creative profile, including bio, experience level, location, disciplines and timestamps.",
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export const CreateCreativeProfileInputSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
experienceLevel: z
|
|
101
|
+
.enum(EXPERIENCE_LEVELS)
|
|
102
|
+
.describe("Overall experience range of the creative.")
|
|
103
|
+
.default(EXPERIENCE_LEVELS.YEAR_0_1)
|
|
104
|
+
.openapi({
|
|
105
|
+
example: EXPERIENCE_LEVELS.YEAR_1_3,
|
|
106
|
+
}),
|
|
107
|
+
role: z.string().optional().openapi({ example: "Designer" }),
|
|
108
|
+
|
|
109
|
+
location: z
|
|
110
|
+
.string()
|
|
111
|
+
.max(100)
|
|
112
|
+
.optional()
|
|
113
|
+
.describe("Primary location where the creative works or resides.")
|
|
114
|
+
.openapi({
|
|
115
|
+
example: "Lagos, Nigeria",
|
|
116
|
+
}),
|
|
117
|
+
disciplineSlugs: z
|
|
118
|
+
.array(z.string())
|
|
119
|
+
.min(1, "At least one discipline is required")
|
|
120
|
+
.default([])
|
|
121
|
+
.describe("List of discipline slugs representing the creative’s fields.")
|
|
122
|
+
.openapi({
|
|
123
|
+
example: ["ui-ux", "frontend"],
|
|
124
|
+
}),
|
|
125
|
+
})
|
|
126
|
+
.openapi({
|
|
127
|
+
title: "create creative profile",
|
|
128
|
+
description: "Payload for creating a new creative profile.",
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const UpdateCreativeProfileInputSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
experienceLevel: z
|
|
134
|
+
.enum(EXPERIENCE_LEVELS)
|
|
135
|
+
.optional()
|
|
136
|
+
.openapi({ example: EXPERIENCE_LEVELS.YEAR_3_5 }),
|
|
137
|
+
role: z.string().optional().openapi({ example: "Designer" }),
|
|
138
|
+
bio: z
|
|
139
|
+
.string()
|
|
140
|
+
.max(600)
|
|
141
|
+
.optional()
|
|
142
|
+
.openapi({ example: "I am a freelance UI/UX designer." }),
|
|
143
|
+
location: z
|
|
144
|
+
.string()
|
|
145
|
+
.max(100)
|
|
146
|
+
.optional()
|
|
147
|
+
.openapi({ example: "Lagos, Nigeria" }),
|
|
148
|
+
disciplineSlugs: z
|
|
149
|
+
.array(z.string())
|
|
150
|
+
.min(1, "At least one discipline is required")
|
|
151
|
+
.optional()
|
|
152
|
+
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
153
|
+
workExperience: z
|
|
154
|
+
.object({
|
|
155
|
+
companyName: z.string(),
|
|
156
|
+
position: z.string(),
|
|
157
|
+
startDate: z.string().optional(),
|
|
158
|
+
endDate: z.string().optional(),
|
|
159
|
+
currentlyWorking: z.boolean().default(false),
|
|
160
|
+
description: z.string().optional(),
|
|
161
|
+
})
|
|
162
|
+
.array()
|
|
163
|
+
.optional(),
|
|
164
|
+
links: z
|
|
165
|
+
.object({
|
|
166
|
+
url: z.union([
|
|
167
|
+
z.url({ message: "Please enter a valid URL" }),
|
|
168
|
+
z.literal(""),
|
|
169
|
+
]),
|
|
170
|
+
type: z.enum(LINK_TYPES),
|
|
171
|
+
})
|
|
172
|
+
.array()
|
|
173
|
+
.optional(),
|
|
174
|
+
version: z.int(),
|
|
175
|
+
achievements: z
|
|
176
|
+
.object({
|
|
177
|
+
title: z.string(),
|
|
178
|
+
link: z.string().optional(),
|
|
179
|
+
year: z.coerce.number().int().optional(),
|
|
180
|
+
})
|
|
181
|
+
.array()
|
|
182
|
+
.optional(),
|
|
183
|
+
})
|
|
184
|
+
.openapi({
|
|
185
|
+
title: "update creative profile",
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
export const GetCreativeInputSchema = z.object({
|
|
189
|
+
value: z.cuid2(),
|
|
190
|
+
by: ProfileIdentifierSchema.shape.by,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
export const GetCreativeQuerySchema = ProfileIdentifierSchema;
|
|
194
|
+
|
|
195
|
+
export const CreateCreativeOutputSchema = CreativeEntitySchema;
|
|
196
|
+
|
|
197
|
+
export const GetCreativeOutputSchema = CreativeEntitySchema;
|
|
198
|
+
|
|
199
|
+
export const UpdateCreativeOutputSchema = CreativeEntitySchema;
|
|
200
|
+
|
|
201
|
+
export const CreativeWithUserEntitySchema = MinimalCreativeEntitySchema.extend({
|
|
202
|
+
user: MinimalUserSchema,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export const SearchCreativeInputSchema = z.object({
|
|
206
|
+
string: z
|
|
207
|
+
.string()
|
|
208
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
209
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
210
|
+
limit: z.coerce
|
|
211
|
+
.number()
|
|
212
|
+
.int({ message: "Limit must be an integer" })
|
|
213
|
+
.min(1, { message: "Limit must be at least 1" })
|
|
214
|
+
.max(100, { message: "Limit cannot exceed 100" })
|
|
215
|
+
.default(20),
|
|
216
|
+
cursor: z.string().optional(),
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
export const SearchCreativeOutputSchema = z.object({
|
|
220
|
+
creatives: z.array(CreativeWithUserEntitySchema),
|
|
221
|
+
nextCursor: z.string().optional().nullable(),
|
|
222
|
+
});
|