@zyacreatives/shared 2.0.61 → 2.0.63

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,18 +1,36 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- import { EXPERIENCE_LEVELS, ExperienceLevel } from "../constants";
3
- import { CuidSchema, ProfileIdentifierSchema } from "./common";
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
+
4
25
  export const CreativeEntitySchema = z
5
26
  .object({
6
27
  id: z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
7
-
8
28
  userId: z.cuid2().openapi({ example: "user_abc123" }),
9
-
10
29
  bio: z.string().optional().openapi({
11
30
  example: "A multi-disciplinary designer specializing in brand identity.",
12
31
  }),
13
-
32
+ role: z.string().optional().openapi({ example: "Designer" }),
14
33
  location: z.string().optional().openapi({ example: "London, UK" }),
15
-
16
34
  experienceLevel: z
17
35
  .enum(
18
36
  Object.values(EXPERIENCE_LEVELS) as [
@@ -32,7 +50,25 @@ export const CreativeEntitySchema = z
32
50
  .array(z.string())
33
51
  .optional()
34
52
  .openapi({ example: ["Design", "Art Direction"] }),
35
-
53
+ workExperience: z.object({
54
+ companyName: z.string(),
55
+ position: z.string(),
56
+ startDate: z.coerce.date().optional(),
57
+ endDate: z.coerce.date().optional(),
58
+ currentlyWorking: z.boolean().optional(),
59
+ description: z.string().optional(),
60
+ }).array().optional(),
61
+ links: z.object({
62
+ name: z.string(),
63
+ url: z.string(),
64
+ type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
65
+ }).array().optional(),
66
+ achievements: z.object({
67
+ title: z.string(),
68
+ description: z.string(),
69
+ link: z.string().optional(),
70
+ year: z.number().int().optional(),
71
+ }).array().optional(),
36
72
  createdAt: z.coerce
37
73
  .date()
38
74
  .optional()
@@ -102,15 +138,7 @@ export const CreateCreativeProfileInputSchema = z
102
138
  .openapi({
103
139
  example: EXPERIENCE_LEVELS.YEAR_1_3,
104
140
  }),
105
-
106
- bio: z
107
- .string()
108
- .max(210)
109
- .optional()
110
- .describe("Short professional summary or introduction.")
111
- .openapi({
112
- example: "I am a freelance UI/UX designer.",
113
- }),
141
+ role: z.string().optional().openapi({ example: "Designer" }),
114
142
 
115
143
  location: z
116
144
  .string()
@@ -145,6 +173,7 @@ export const UpdateCreativeProfileInputSchema = z
145
173
  .array(z.string())
146
174
  .optional()
147
175
  .openapi({ example: ["react", "design", "product"] }),
176
+ role: z.string().optional().openapi({ example: "Designer" }),
148
177
  bio: z
149
178
  .string()
150
179
  .max(210)
@@ -160,6 +189,25 @@ export const UpdateCreativeProfileInputSchema = z
160
189
  .min(1, "At least one discipline is required")
161
190
  .optional()
162
191
  .openapi({ example: ["frontend", "ui-ux"] }),
192
+ workExperience: z.object({
193
+ companyName: z.string(),
194
+ position: z.string(),
195
+ startDate: z.coerce.date().optional(),
196
+ endDate: z.coerce.date().optional(),
197
+ currentlyWorking: z.boolean().optional(),
198
+ description: z.string().optional(),
199
+ }).array().optional(),
200
+ links: z.object({
201
+ name: z.string(),
202
+ url: z.string(),
203
+ type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
204
+ }).array().optional(),
205
+ achievements: z.object({
206
+ title: z.string(),
207
+ description: z.string(),
208
+ link: z.string().optional(),
209
+ year: z.number().int().optional(),
210
+ }).array().optional(),
163
211
  })
164
212
  .openapi({
165
213
  title: "update creative profile",
@@ -177,3 +225,26 @@ export const CreateCreativeOutputSchema = CreativeEntitySchema;
177
225
  export const GetCreativeOutputSchema = CreativeEntitySchema;
178
226
 
179
227
  export const UpdateCreativeOutputSchema = CreativeEntitySchema;
228
+
229
+ export const CreativeWithUserEntitySchema = CreativeEntitySchema.extend({
230
+ user: MinimalUserSchema,
231
+ }).optional();
232
+
233
+ export const SearchCreativeInputSchema = z.object({
234
+ string: z
235
+ .string()
236
+ .min(1, { message: "Search string cannot be empty" })
237
+ .max(200, { message: "Search string cannot exceed 200 characters" }),
238
+ limit: z.coerce
239
+ .number()
240
+ .int({ message: "Limit must be an integer" })
241
+ .min(1, { message: "Limit must be at least 1" })
242
+ .max(100, { message: "Limit cannot exceed 100" })
243
+ .default(20),
244
+ cursor: z.string().optional(),
245
+ });
246
+
247
+ export const SearchCreativeOutputSchema = z.object({
248
+ creatives: z.array(CreativeWithUserEntitySchema),
249
+ nextCursor: z.string().optional(),
250
+ });
@@ -8,6 +8,10 @@ import {
8
8
  CreateBrandOutputSchema,
9
9
  GetBrandOutputSchema,
10
10
  UpdateBrandOutputSchema,
11
+ BrandWithUserEntitySchema,
12
+ SearchBrandInputSchema,
13
+ SearchBrandOutputSchema,
14
+ MinimalBrandEntitySchema,
11
15
  } from "../schemas/brand";
12
16
 
13
17
  export type BrandEntity = z.infer<typeof BrandEntitySchema>;
@@ -29,3 +33,9 @@ export type CreateBrandOutput = z.infer<typeof CreateBrandOutputSchema>;
29
33
  export type GetBrandOutput = z.infer<typeof GetBrandOutputSchema>;
30
34
 
31
35
  export type UpdateBrandOutput = z.infer<typeof UpdateBrandOutputSchema>;
36
+
37
+ export type BrandWithUserEntity = z.infer<typeof BrandWithUserEntitySchema>
38
+ export type SearchBrandInput = z.infer<typeof SearchBrandInputSchema>
39
+ export type SearchBrandOutput = z.infer<typeof SearchBrandOutputSchema>
40
+
41
+ export type MinimalBrandEntity = z.infer<typeof MinimalBrandEntitySchema>
@@ -8,6 +8,10 @@ import {
8
8
  CreateCreativeOutputSchema,
9
9
  GetCreativeOutputSchema,
10
10
  UpdateCreativeOutputSchema,
11
+ CreativeWithUserEntitySchema,
12
+ SearchCreativeInputSchema,
13
+ SearchCreativeOutputSchema,
14
+ MinimalCreativeEntitySchema,
11
15
  } from "../schemas/creative";
12
16
 
13
17
  export type CreativeEntity = z.infer<typeof CreativeEntitySchema>;
@@ -26,3 +30,8 @@ export type GetCreativeInput = z.infer<typeof GetCreativeInputSchema>;
26
30
  export type CreateCreativeOutput = z.infer<typeof CreateCreativeOutputSchema>;
27
31
  export type GetCreativeOutput = z.infer<typeof GetCreativeOutputSchema>;
28
32
  export type UpdateCreativeOutput = z.infer<typeof UpdateCreativeOutputSchema>;
33
+
34
+ export type CreativeWithUserEntity = z.infer<typeof CreativeWithUserEntitySchema>
35
+ export type SearchCreativeInput = z.infer<typeof SearchCreativeInputSchema>
36
+ export type SearchCreativeOutput = z.infer<typeof SearchCreativeOutputSchema>
37
+ export type MinimalCreativeEntity = z.infer<typeof MinimalCreativeEntitySchema>