@zyacreatives/shared 2.5.49 → 2.5.51
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/brand.d.ts +134 -109
- package/dist/schemas/brand.js +49 -112
- package/dist/schemas/common.d.ts +25 -0
- package/dist/schemas/common.js +30 -1
- package/dist/schemas/creative.d.ts +224 -150
- package/dist/schemas/creative.js +91 -170
- package/dist/schemas/investor.d.ts +362 -261
- package/dist/schemas/investor.js +111 -211
- package/dist/schemas/job-application.d.ts +6 -6
- package/dist/schemas/notification.d.ts +12 -12
- package/dist/schemas/project.d.ts +20 -20
- package/dist/schemas/user.d.ts +265 -1161
- package/dist/schemas/user.js +141 -252
- package/package.json +1 -1
- package/src/schemas/brand.ts +73 -129
- package/src/schemas/common.ts +32 -0
- package/src/schemas/creative.ts +118 -187
- package/src/schemas/investor.ts +154 -278
- package/src/schemas/user.ts +186 -438
package/src/schemas/brand.ts
CHANGED
|
@@ -3,131 +3,92 @@ import { LINK_TYPES } from "../constants";
|
|
|
3
3
|
import { ProfileIdentifierSchema } from "./common";
|
|
4
4
|
import { MinimalUserSchema } from "./user";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
|
|
7
|
+
const BrandShape = z.object({
|
|
8
|
+
brandName: z.string().min(1).max(200),
|
|
9
|
+
bio: z.string().max(600).default(""),
|
|
10
|
+
location: z.string(),
|
|
11
|
+
disciplines: z.array(z.string()).default([]),
|
|
12
|
+
links: z
|
|
13
|
+
.array(
|
|
14
|
+
z.object({
|
|
15
|
+
url: z.url(),
|
|
16
|
+
type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
|
|
17
|
+
}),
|
|
18
|
+
)
|
|
19
|
+
.default([]),
|
|
20
|
+
achievements: z
|
|
21
|
+
.array(
|
|
22
|
+
z.object({
|
|
23
|
+
title: z.string(),
|
|
24
|
+
link: z.url().optional(),
|
|
25
|
+
year: z.number().int().optional(),
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
28
|
+
.default([]),
|
|
22
29
|
});
|
|
23
30
|
|
|
24
|
-
export type
|
|
31
|
+
export type BrandShapeType = z.infer<typeof BrandShape>;
|
|
32
|
+
|
|
25
33
|
|
|
26
34
|
export const BrandEntitySchema = z
|
|
27
35
|
.object({
|
|
28
36
|
id: z.cuid2().openapi({ example: "brd_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
29
37
|
userId: z.cuid2().openapi({ example: "user_owner_123" }),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}),
|
|
34
|
-
location: z.string().openapi({
|
|
35
|
-
example: "UK",
|
|
36
|
-
}),
|
|
37
|
-
disciplines: z
|
|
38
|
-
.array(z.string())
|
|
39
|
-
.optional()
|
|
40
|
-
.openapi({ example: ["Marketing", "Product Development"] }),
|
|
41
|
-
links: z
|
|
42
|
-
.object({
|
|
43
|
-
url: z.url(),
|
|
44
|
-
type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
|
|
45
|
-
})
|
|
46
|
-
.array()
|
|
47
|
-
.optional(),
|
|
48
|
-
achievements: z
|
|
49
|
-
.object({
|
|
50
|
-
title: z.string(),
|
|
51
|
-
link: z.url().optional(),
|
|
52
|
-
year: z.number().int().optional(),
|
|
53
|
-
})
|
|
54
|
-
.array()
|
|
55
|
-
.optional(),
|
|
56
|
-
createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
57
|
-
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
38
|
+
...BrandShape.shape,
|
|
39
|
+
createdAt: z.iso.datetime(),
|
|
40
|
+
updatedAt: z.iso.datetime(),
|
|
58
41
|
version: z.int(),
|
|
59
42
|
})
|
|
60
|
-
.openapi("
|
|
43
|
+
.openapi("BrandEntity");
|
|
61
44
|
|
|
62
45
|
export type BrandEntity = z.infer<typeof BrandEntitySchema>;
|
|
63
46
|
|
|
64
|
-
export const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
47
|
+
export const MinimalBrandEntitySchema = BrandEntitySchema.pick({
|
|
48
|
+
id: true,
|
|
49
|
+
userId: true,
|
|
50
|
+
brandName: true,
|
|
51
|
+
bio: true,
|
|
52
|
+
disciplines: true,
|
|
53
|
+
createdAt: true,
|
|
54
|
+
updatedAt: true,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export type MinimalBrandEntity = z.infer<typeof MinimalBrandEntitySchema>;
|
|
58
|
+
|
|
59
|
+
export const BrandWithUserEntitySchema = MinimalBrandEntitySchema.extend({
|
|
60
|
+
user: MinimalUserSchema,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export type BrandWithUserEntity = z.infer<typeof BrandWithUserEntitySchema>;
|
|
64
|
+
|
|
65
|
+
export const CreateBrandProfileInputSchema = BrandShape.pick({
|
|
66
|
+
brandName: true,
|
|
67
|
+
location: true,
|
|
68
|
+
}).extend({
|
|
69
|
+
disciplineSlugs: z
|
|
70
|
+
.array(z.string())
|
|
71
|
+
.min(1, "At least one discipline is required"),
|
|
72
|
+
});
|
|
82
73
|
|
|
83
74
|
export type CreateBrandProfileInput = z.infer<
|
|
84
75
|
typeof CreateBrandProfileInputSchema
|
|
85
76
|
>;
|
|
86
77
|
|
|
87
|
-
export const UpdateBrandProfileInputSchema =
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
links: z
|
|
91
|
-
.object({
|
|
92
|
-
url: z.union([
|
|
93
|
-
z.url({ message: "Please enter a valid URL" }),
|
|
94
|
-
z.literal(""),
|
|
95
|
-
]),
|
|
96
|
-
type: z.enum(LINK_TYPES),
|
|
97
|
-
})
|
|
98
|
-
.array()
|
|
99
|
-
.optional(),
|
|
100
|
-
location: z.string().openapi({
|
|
101
|
-
example: "UK",
|
|
102
|
-
}),
|
|
103
|
-
achievements: z
|
|
104
|
-
.object({
|
|
105
|
-
title: z.string(),
|
|
106
|
-
link: z.url().optional(),
|
|
107
|
-
year: z.number().int().optional(),
|
|
108
|
-
})
|
|
109
|
-
.array()
|
|
110
|
-
.optional(),
|
|
111
|
-
bio: z
|
|
112
|
-
.string()
|
|
113
|
-
.max(600)
|
|
114
|
-
.optional()
|
|
115
|
-
.openapi({ example: "Updated bio for our creative agency." }),
|
|
116
|
-
disciplineSlugs: z
|
|
117
|
-
.array(z.string())
|
|
118
|
-
.min(1, "At least one discipline is required")
|
|
119
|
-
.optional()
|
|
120
|
-
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
78
|
+
export const UpdateBrandProfileInputSchema = BrandShape.partial()
|
|
79
|
+
.extend({
|
|
80
|
+
disciplineSlugs: z.array(z.string()).optional(),
|
|
121
81
|
version: z.int(),
|
|
122
82
|
})
|
|
123
|
-
.
|
|
124
|
-
|
|
83
|
+
.refine((d) => Object.values(d).some((v) => v !== undefined), {
|
|
84
|
+
message: "At least one field must be provided",
|
|
125
85
|
});
|
|
126
86
|
|
|
127
87
|
export type UpdateBrandProfileInput = z.infer<
|
|
128
88
|
typeof UpdateBrandProfileInputSchema
|
|
129
89
|
>;
|
|
130
90
|
|
|
91
|
+
|
|
131
92
|
export const GetBrandInputSchema = z.object({
|
|
132
93
|
value: z.cuid2(),
|
|
133
94
|
by: ProfileIdentifierSchema.shape.by,
|
|
@@ -137,35 +98,9 @@ export type GetBrandInput = z.infer<typeof GetBrandInputSchema>;
|
|
|
137
98
|
|
|
138
99
|
export const GetBrandQuerySchema = ProfileIdentifierSchema;
|
|
139
100
|
|
|
140
|
-
export const CreateBrandOutputSchema = BrandEntitySchema;
|
|
141
|
-
|
|
142
|
-
export type CreateBrandOutput = z.infer<typeof CreateBrandOutputSchema>;
|
|
143
|
-
|
|
144
|
-
export const GetBrandOutputSchema = BrandEntitySchema;
|
|
145
|
-
|
|
146
|
-
export type GetBrandOutput = z.infer<typeof GetBrandOutputSchema>;
|
|
147
|
-
|
|
148
|
-
export const UpdateBrandOutputSchema = BrandEntitySchema;
|
|
149
|
-
|
|
150
|
-
export type UpdateBrandOutput = z.infer<typeof UpdateBrandOutputSchema>;
|
|
151
|
-
|
|
152
|
-
export const BrandWithUserEntitySchema = MinimalBrandEntitySchema.extend({
|
|
153
|
-
user: MinimalUserSchema,
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
export type BrandWithUserEntity = z.infer<typeof BrandWithUserEntitySchema>;
|
|
157
|
-
|
|
158
101
|
export const SearchBrandInputSchema = z.object({
|
|
159
|
-
string: z
|
|
160
|
-
|
|
161
|
-
.min(1, { message: "Search string cannot be empty" })
|
|
162
|
-
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
163
|
-
limit: z.coerce
|
|
164
|
-
.number()
|
|
165
|
-
.int({ message: "Limit must be an integer" })
|
|
166
|
-
.min(1, { message: "Limit must be at least 1" })
|
|
167
|
-
.max(100, { message: "Limit cannot exceed 100" })
|
|
168
|
-
.default(20),
|
|
102
|
+
string: z.string().min(1, "Search string cannot be empty").max(200),
|
|
103
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
169
104
|
cursor: z.string().optional(),
|
|
170
105
|
});
|
|
171
106
|
|
|
@@ -173,7 +108,16 @@ export type SearchBrandInput = z.infer<typeof SearchBrandInputSchema>;
|
|
|
173
108
|
|
|
174
109
|
export const SearchBrandOutputSchema = z.object({
|
|
175
110
|
brands: z.array(BrandWithUserEntitySchema),
|
|
176
|
-
nextCursor: z.string().
|
|
111
|
+
nextCursor: z.string().nullable().optional(),
|
|
177
112
|
});
|
|
178
113
|
|
|
179
114
|
export type SearchBrandOutput = z.infer<typeof SearchBrandOutputSchema>;
|
|
115
|
+
|
|
116
|
+
export const CreateBrandOutputSchema = BrandEntitySchema;
|
|
117
|
+
export type CreateBrandOutput = z.infer<typeof CreateBrandOutputSchema>;
|
|
118
|
+
|
|
119
|
+
export const GetBrandOutputSchema = BrandEntitySchema;
|
|
120
|
+
export type GetBrandOutput = z.infer<typeof GetBrandOutputSchema>;
|
|
121
|
+
|
|
122
|
+
export const UpdateBrandOutputSchema = BrandEntitySchema;
|
|
123
|
+
export type UpdateBrandOutput = z.infer<typeof UpdateBrandOutputSchema>;
|
package/src/schemas/common.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { CommentEntitySchema } from "./comment";
|
|
3
3
|
import { ActivitySchema } from "./activity";
|
|
4
|
+
import { LINK_TYPES } from "../constants";
|
|
4
5
|
|
|
5
6
|
export const CuidSchema = z.cuid2({ error: "Invalid CUID2 is written." });
|
|
6
7
|
|
|
@@ -51,3 +52,34 @@ export const EntityRepliesOutputSchema = z.object({
|
|
|
51
52
|
nextCursor: z.string().nullable(),
|
|
52
53
|
});
|
|
53
54
|
export type EntityRepliesOutput = z.infer<typeof EntityRepliesOutputSchema>;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
export const LinkSchema = z.object({
|
|
58
|
+
url: z.url({ message: "Please enter a valid URL" }).or(z.literal("")),
|
|
59
|
+
type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const AchievementSchema = z.object({
|
|
63
|
+
title: z.string().min(1),
|
|
64
|
+
link: z.url().optional(),
|
|
65
|
+
year: z.number().int().optional(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const WorkExperienceSchema = z.object({
|
|
69
|
+
companyName: z.string().min(1),
|
|
70
|
+
position: z.string().min(1),
|
|
71
|
+
startDate: z.iso.datetime().optional(),
|
|
72
|
+
endDate: z.iso.datetime().optional(),
|
|
73
|
+
currentlyWorking: z.boolean().default(false),
|
|
74
|
+
description: z.string().default(""),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const WebsiteUrlInputSchema = z
|
|
78
|
+
.string()
|
|
79
|
+
.transform((val) => {
|
|
80
|
+
if (!val) return val;
|
|
81
|
+
if (val.startsWith("http://") || val.startsWith("https://")) return val;
|
|
82
|
+
return `https://${val}`;
|
|
83
|
+
})
|
|
84
|
+
.pipe(z.url("Invalid URL").or(z.literal("")))
|
|
85
|
+
.optional();
|
package/src/schemas/creative.ts
CHANGED
|
@@ -3,200 +3,128 @@ import { EXPERIENCE_LEVELS, ExperienceLevel, LINK_TYPES } from "../constants";
|
|
|
3
3
|
import { ProfileIdentifierSchema } from "./common";
|
|
4
4
|
import { MinimalUserSchema } from "./user";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
/**
|
|
7
|
+
* --------------------------------
|
|
8
|
+
* SHAPE
|
|
9
|
+
* --------------------------------
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const CreativeShape = z.object({
|
|
13
|
+
bio: z.string().max(600).default(""),
|
|
14
|
+
role: z.string().default(""),
|
|
15
|
+
location: z.string().max(100).default(""),
|
|
16
|
+
experienceLevel: z.enum(
|
|
17
|
+
Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]],
|
|
18
|
+
),
|
|
19
|
+
disciplines: z.array(z.string()).default([]),
|
|
20
|
+
|
|
21
|
+
workExperience: z
|
|
22
|
+
.array(
|
|
23
|
+
z.object({
|
|
24
|
+
companyName: z.string(),
|
|
25
|
+
position: z.string(),
|
|
26
|
+
startDate: z.string().datetime().optional(),
|
|
27
|
+
endDate: z.string().datetime().optional(),
|
|
28
|
+
currentlyWorking: z.boolean().default(false),
|
|
29
|
+
description: z.string().default(""),
|
|
30
|
+
}),
|
|
23
31
|
)
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.array(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
.default([]),
|
|
33
|
+
|
|
34
|
+
links: z
|
|
35
|
+
.array(
|
|
36
|
+
z.object({
|
|
37
|
+
url: z.url(),
|
|
38
|
+
type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
|
|
39
|
+
}),
|
|
40
|
+
)
|
|
41
|
+
.default([]),
|
|
42
|
+
|
|
43
|
+
achievements: z
|
|
44
|
+
.array(
|
|
45
|
+
z.object({
|
|
46
|
+
title: z.string(),
|
|
47
|
+
link: z.url().optional(),
|
|
48
|
+
year: z.number().int().optional(),
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
51
|
+
.default([]),
|
|
32
52
|
});
|
|
33
53
|
|
|
34
|
-
export type
|
|
54
|
+
export type CreativeShapeType = z.infer<typeof CreativeShape>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* --------------------------------
|
|
58
|
+
* ENTITY (DTO)
|
|
59
|
+
* --------------------------------
|
|
60
|
+
*/
|
|
35
61
|
|
|
36
|
-
// -----------------------------------------------------------------------------
|
|
37
|
-
// Full Creative Entity
|
|
38
|
-
// -----------------------------------------------------------------------------
|
|
39
62
|
export const CreativeEntitySchema = z
|
|
40
63
|
.object({
|
|
41
|
-
id: z.cuid2()
|
|
42
|
-
userId: z.cuid2()
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
role: z.string().optional().openapi({ example: "Designer" }),
|
|
64
|
+
id: z.cuid2(),
|
|
65
|
+
userId: z.cuid2(),
|
|
66
|
+
...CreativeShape.shape,
|
|
67
|
+
createdAt: z.string().datetime(),
|
|
68
|
+
updatedAt: z.string().datetime(),
|
|
47
69
|
version: z.int(),
|
|
48
|
-
location: z.string().optional().openapi({ example: "London, UK" }),
|
|
49
|
-
experienceLevel: z
|
|
50
|
-
.enum(
|
|
51
|
-
Object.values(EXPERIENCE_LEVELS) as [
|
|
52
|
-
ExperienceLevel,
|
|
53
|
-
...ExperienceLevel[],
|
|
54
|
-
],
|
|
55
|
-
)
|
|
56
|
-
.optional()
|
|
57
|
-
.openapi({ example: EXPERIENCE_LEVELS.YEAR_0_1 }),
|
|
58
|
-
disciplines: z
|
|
59
|
-
.array(z.string())
|
|
60
|
-
.optional()
|
|
61
|
-
.openapi({ example: ["Design", "Art Direction"] }),
|
|
62
|
-
workExperience: z
|
|
63
|
-
.object({
|
|
64
|
-
companyName: z.string(),
|
|
65
|
-
position: z.string(),
|
|
66
|
-
startDate: z.coerce.date().optional(),
|
|
67
|
-
endDate: z.coerce.date().optional(),
|
|
68
|
-
currentlyWorking: z.boolean().optional(),
|
|
69
|
-
description: z.string(),
|
|
70
|
-
})
|
|
71
|
-
.array()
|
|
72
|
-
.optional(),
|
|
73
|
-
links: z
|
|
74
|
-
.object({
|
|
75
|
-
url: z.union([
|
|
76
|
-
z.url({ message: "Please enter a valid URL" }),
|
|
77
|
-
z.literal(""),
|
|
78
|
-
]),
|
|
79
|
-
type: z.enum(LINK_TYPES),
|
|
80
|
-
})
|
|
81
|
-
.array()
|
|
82
|
-
.optional(),
|
|
83
|
-
achievements: z
|
|
84
|
-
.object({
|
|
85
|
-
title: z.string(),
|
|
86
|
-
link: z.string().optional(),
|
|
87
|
-
year: z.coerce.number().int().optional(),
|
|
88
|
-
})
|
|
89
|
-
.array()
|
|
90
|
-
.optional(),
|
|
91
|
-
createdAt: z.coerce
|
|
92
|
-
.date()
|
|
93
|
-
.optional()
|
|
94
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
95
|
-
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
96
70
|
})
|
|
97
|
-
.openapi(
|
|
98
|
-
title: "CreativeEntitySchema",
|
|
99
|
-
description:
|
|
100
|
-
"Represents a creative profile, including bio, experience level, location, disciplines and timestamps.",
|
|
101
|
-
});
|
|
71
|
+
.openapi("Creative");
|
|
102
72
|
|
|
103
73
|
export type CreativeEntity = z.infer<typeof CreativeEntitySchema>;
|
|
104
74
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
75
|
+
export const MinimalCreativeEntitySchema = CreativeEntitySchema.pick({
|
|
76
|
+
id: true,
|
|
77
|
+
userId: true,
|
|
78
|
+
bio: true,
|
|
79
|
+
role: true,
|
|
80
|
+
location: true,
|
|
81
|
+
experienceLevel: true,
|
|
82
|
+
disciplines: true,
|
|
83
|
+
createdAt: true,
|
|
84
|
+
updatedAt: true,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export type MinimalCreativeEntity = z.infer<typeof MinimalCreativeEntitySchema>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* --------------------------------
|
|
91
|
+
* INPUT DTOs
|
|
92
|
+
* --------------------------------
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export const CreateCreativeProfileInputSchema = CreativeShape.pick({
|
|
96
|
+
experienceLevel: true,
|
|
97
|
+
role: true,
|
|
98
|
+
location: true,
|
|
99
|
+
}).extend({
|
|
100
|
+
disciplineSlugs: z
|
|
101
|
+
.array(z.string())
|
|
102
|
+
.min(1, "At least one discipline is required"),
|
|
103
|
+
});
|
|
131
104
|
|
|
132
105
|
export type CreateCreativeProfileInput = z.infer<
|
|
133
106
|
typeof CreateCreativeProfileInputSchema
|
|
134
107
|
>;
|
|
135
108
|
|
|
136
|
-
export const UpdateCreativeProfileInputSchema =
|
|
137
|
-
.
|
|
138
|
-
|
|
139
|
-
.enum(EXPERIENCE_LEVELS)
|
|
140
|
-
.optional()
|
|
141
|
-
.openapi({ example: EXPERIENCE_LEVELS.YEAR_3_5 }),
|
|
142
|
-
role: z.string().optional().openapi({ example: "Designer" }),
|
|
143
|
-
bio: z
|
|
144
|
-
.string()
|
|
145
|
-
.max(600)
|
|
146
|
-
.optional()
|
|
147
|
-
.openapi({ example: "I am a freelance UI/UX designer." }),
|
|
148
|
-
location: z
|
|
149
|
-
.string()
|
|
150
|
-
.max(100)
|
|
151
|
-
.optional()
|
|
152
|
-
.openapi({ example: "Lagos, Nigeria" }),
|
|
153
|
-
disciplineSlugs: z
|
|
154
|
-
.array(z.string())
|
|
155
|
-
.min(1, "At least one discipline is required")
|
|
156
|
-
.optional()
|
|
157
|
-
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
158
|
-
workExperience: z
|
|
159
|
-
.object({
|
|
160
|
-
companyName: z.string(),
|
|
161
|
-
position: z.string(),
|
|
162
|
-
startDate: z.string().optional(),
|
|
163
|
-
endDate: z.string().optional(),
|
|
164
|
-
currentlyWorking: z.boolean().default(false),
|
|
165
|
-
description: z.string().optional(),
|
|
166
|
-
})
|
|
167
|
-
.array()
|
|
168
|
-
.optional(),
|
|
169
|
-
links: z
|
|
170
|
-
.object({
|
|
171
|
-
url: z.union([
|
|
172
|
-
z.url({ message: "Please enter a valid URL" }),
|
|
173
|
-
z.literal(""),
|
|
174
|
-
]),
|
|
175
|
-
type: z.enum(LINK_TYPES),
|
|
176
|
-
})
|
|
177
|
-
.array()
|
|
178
|
-
.optional(),
|
|
109
|
+
export const UpdateCreativeProfileInputSchema = CreativeShape.partial()
|
|
110
|
+
.extend({
|
|
111
|
+
disciplineSlugs: z.array(z.string()).optional(),
|
|
179
112
|
version: z.int(),
|
|
180
|
-
achievements: z
|
|
181
|
-
.object({
|
|
182
|
-
title: z.string(),
|
|
183
|
-
link: z.string().optional(),
|
|
184
|
-
year: z.coerce.number().int().optional(),
|
|
185
|
-
})
|
|
186
|
-
.array()
|
|
187
|
-
.optional(),
|
|
188
113
|
})
|
|
189
|
-
.
|
|
190
|
-
|
|
114
|
+
.refine((d) => Object.values(d).some((v) => v !== undefined), {
|
|
115
|
+
message: "At least one field must be provided",
|
|
191
116
|
});
|
|
192
117
|
|
|
193
118
|
export type UpdateCreativeProfileInput = z.infer<
|
|
194
119
|
typeof UpdateCreativeProfileInputSchema
|
|
195
120
|
>;
|
|
196
121
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
122
|
+
/**
|
|
123
|
+
* --------------------------------
|
|
124
|
+
* GET
|
|
125
|
+
* --------------------------------
|
|
126
|
+
*/
|
|
127
|
+
|
|
200
128
|
export const GetCreativeInputSchema = z.object({
|
|
201
129
|
value: z.cuid2(),
|
|
202
130
|
by: ProfileIdentifierSchema.shape.by,
|
|
@@ -206,7 +134,12 @@ export type GetCreativeInput = z.infer<typeof GetCreativeInputSchema>;
|
|
|
206
134
|
|
|
207
135
|
export const GetCreativeQuerySchema = ProfileIdentifierSchema;
|
|
208
136
|
|
|
209
|
-
|
|
137
|
+
/**
|
|
138
|
+
* --------------------------------
|
|
139
|
+
* OUTPUT ALIASES
|
|
140
|
+
* --------------------------------
|
|
141
|
+
*/
|
|
142
|
+
|
|
210
143
|
export const CreateCreativeOutputSchema = CreativeEntitySchema;
|
|
211
144
|
export type CreateCreativeOutput = z.infer<typeof CreateCreativeOutputSchema>;
|
|
212
145
|
|
|
@@ -216,9 +149,12 @@ export type GetCreativeOutput = z.infer<typeof GetCreativeOutputSchema>;
|
|
|
216
149
|
export const UpdateCreativeOutputSchema = CreativeEntitySchema;
|
|
217
150
|
export type UpdateCreativeOutput = z.infer<typeof UpdateCreativeOutputSchema>;
|
|
218
151
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
152
|
+
/**
|
|
153
|
+
* --------------------------------
|
|
154
|
+
* ENTITY WITH USER
|
|
155
|
+
* --------------------------------
|
|
156
|
+
*/
|
|
157
|
+
|
|
222
158
|
export const CreativeWithUserEntitySchema = MinimalCreativeEntitySchema.extend({
|
|
223
159
|
user: MinimalUserSchema,
|
|
224
160
|
});
|
|
@@ -227,20 +163,15 @@ export type CreativeWithUserEntity = z.infer<
|
|
|
227
163
|
typeof CreativeWithUserEntitySchema
|
|
228
164
|
>;
|
|
229
165
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
166
|
+
/**
|
|
167
|
+
* --------------------------------
|
|
168
|
+
* SEARCH
|
|
169
|
+
* --------------------------------
|
|
170
|
+
*/
|
|
171
|
+
|
|
233
172
|
export const SearchCreativeInputSchema = z.object({
|
|
234
|
-
string: z
|
|
235
|
-
|
|
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),
|
|
173
|
+
string: z.string().min(1).max(200),
|
|
174
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
244
175
|
cursor: z.string().optional(),
|
|
245
176
|
});
|
|
246
177
|
|