@zyacreatives/shared 2.1.85 → 2.1.87
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/constants.d.ts +5 -2
- package/dist/constants.js +5 -2
- package/package.json +1 -1
- package/src/constants.ts +487 -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 -279
- 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 -63
- 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/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./types/index";
|
|
2
|
-
export * from "./constants";
|
|
3
|
-
export * from "./schemas/index";
|
|
4
|
-
export * from "./utils/slugify";
|
|
1
|
+
export * from "./types/index";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./schemas/index";
|
|
4
|
+
export * from "./utils/slugify";
|
package/src/schemas/activity.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
import { ACTIVITY_TYPES } from "../constants";
|
|
3
|
-
|
|
4
|
-
export const ActivitySchema = z.object({
|
|
5
|
-
id: z.cuid2().openapi({
|
|
6
|
-
description: "Unique identifier for the bookmarked entity.",
|
|
7
|
-
title: "Entity ID",
|
|
8
|
-
}),
|
|
9
|
-
type: z.enum(ACTIVITY_TYPES),
|
|
10
|
-
actorName: z.string(),
|
|
11
|
-
actorId: z.string(),
|
|
12
|
-
actorUsername: z.string(),
|
|
13
|
-
actorImageUrl: z.url().optional(),
|
|
14
|
-
});
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { ACTIVITY_TYPES } from "../constants";
|
|
3
|
+
|
|
4
|
+
export const ActivitySchema = z.object({
|
|
5
|
+
id: z.cuid2().openapi({
|
|
6
|
+
description: "Unique identifier for the bookmarked entity.",
|
|
7
|
+
title: "Entity ID",
|
|
8
|
+
}),
|
|
9
|
+
type: z.enum(ACTIVITY_TYPES),
|
|
10
|
+
actorName: z.string(),
|
|
11
|
+
actorId: z.string(),
|
|
12
|
+
actorUsername: z.string(),
|
|
13
|
+
actorImageUrl: z.url().optional(),
|
|
14
|
+
});
|
package/src/schemas/auth.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import z from "zod";
|
|
2
|
-
|
|
3
|
-
export const RegisterSchema = z.object({
|
|
4
|
-
firstName: z.string().max(255, { message: "First name is too long" }),
|
|
5
|
-
lastName: z.string().max(255, { message: "Last name is too long" }),
|
|
6
|
-
email: z
|
|
7
|
-
.email({ message: "Enter a valid email address" })
|
|
8
|
-
.max(255, { message: "Email is too long" }),
|
|
9
|
-
username: z
|
|
10
|
-
.string()
|
|
11
|
-
.min(3, { message: "Username is too short" })
|
|
12
|
-
.max(32, { message: "Username must be at most 32 characters" })
|
|
13
|
-
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
14
|
-
error: "Username can only contain letters, numbers, and underscores",
|
|
15
|
-
}),
|
|
16
|
-
password: z
|
|
17
|
-
.string()
|
|
18
|
-
.min(8, { message: "Password must be at least 8 characters" })
|
|
19
|
-
.max(100, { message: "Password must be at most 100 characters" }),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const LoginSchema = z.object({
|
|
23
|
-
identifier: z
|
|
24
|
-
.string()
|
|
25
|
-
.trim()
|
|
26
|
-
.min(1, { message: "Email or username is required" })
|
|
27
|
-
.refine(
|
|
28
|
-
(val) => {
|
|
29
|
-
const isEmail = z.email().safeParse(val).success;
|
|
30
|
-
const isUsername = /^[a-zA-Z0-9_]{3,20}$/.test(val);
|
|
31
|
-
return isEmail || isUsername;
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
message:
|
|
35
|
-
"Enter a valid email or a username (3–20 characters, letters/numbers/underscore)",
|
|
36
|
-
}
|
|
37
|
-
),
|
|
38
|
-
password: z
|
|
39
|
-
.string()
|
|
40
|
-
.min(8, { message: "Password must be at least 8 characters" })
|
|
41
|
-
.max(100, { message: "Password must be at most 100 characters" }),
|
|
42
|
-
rememberMe: z.boolean(),
|
|
43
|
-
});
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const RegisterSchema = z.object({
|
|
4
|
+
firstName: z.string().max(255, { message: "First name is too long" }),
|
|
5
|
+
lastName: z.string().max(255, { message: "Last name is too long" }),
|
|
6
|
+
email: z
|
|
7
|
+
.email({ message: "Enter a valid email address" })
|
|
8
|
+
.max(255, { message: "Email is too long" }),
|
|
9
|
+
username: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(3, { message: "Username is too short" })
|
|
12
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
13
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
14
|
+
error: "Username can only contain letters, numbers, and underscores",
|
|
15
|
+
}),
|
|
16
|
+
password: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
19
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const LoginSchema = z.object({
|
|
23
|
+
identifier: z
|
|
24
|
+
.string()
|
|
25
|
+
.trim()
|
|
26
|
+
.min(1, { message: "Email or username is required" })
|
|
27
|
+
.refine(
|
|
28
|
+
(val) => {
|
|
29
|
+
const isEmail = z.email().safeParse(val).success;
|
|
30
|
+
const isUsername = /^[a-zA-Z0-9_]{3,20}$/.test(val);
|
|
31
|
+
return isEmail || isUsername;
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
message:
|
|
35
|
+
"Enter a valid email or a username (3–20 characters, letters/numbers/underscore)",
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
password: z
|
|
39
|
+
.string()
|
|
40
|
+
.min(8, { message: "Password must be at least 8 characters" })
|
|
41
|
+
.max(100, { message: "Password must be at most 100 characters" }),
|
|
42
|
+
rememberMe: z.boolean(),
|
|
43
|
+
});
|
package/src/schemas/bookmark.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
-
|
|
4
|
-
export const BookmarkEntitySchema = z
|
|
5
|
-
.object({
|
|
6
|
-
id: z.cuid2().openapi({
|
|
7
|
-
description: "Unique identifier for the bookmark.",
|
|
8
|
-
title: "Bookmark ID",
|
|
9
|
-
}),
|
|
10
|
-
createdAt: z.coerce.date().optional().openapi({
|
|
11
|
-
description: "Timestamp when the bookmark was created.",
|
|
12
|
-
title: "Created At",
|
|
13
|
-
}),
|
|
14
|
-
userId: z.cuid2().openapi({
|
|
15
|
-
description: "Identifier of the user who created the bookmark.",
|
|
16
|
-
title: "User ID",
|
|
17
|
-
}),
|
|
18
|
-
parentId: z.cuid2().openapi({
|
|
19
|
-
description: "Identifier of the parent entity that was bookmarked.",
|
|
20
|
-
title: "Parent ID",
|
|
21
|
-
}),
|
|
22
|
-
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
23
|
-
description: "Type of the parent entity this statistic belongs to.",
|
|
24
|
-
title: "Parent Type",
|
|
25
|
-
}),
|
|
26
|
-
})
|
|
27
|
-
.openapi({
|
|
28
|
-
title: "Bookmark",
|
|
29
|
-
description: "Represents a user bookmark on a specific parent entity.",
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const BookmarkInputSchema = z.object({
|
|
33
|
-
parentId: z.string(),
|
|
34
|
-
parentType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
35
|
-
userId: z.string(),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const BookmarkOutputSchema = BookmarkEntitySchema;
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { ACTIVITY_PARENT_TYPES } from "../constants";
|
|
3
|
+
|
|
4
|
+
export const BookmarkEntitySchema = z
|
|
5
|
+
.object({
|
|
6
|
+
id: z.cuid2().openapi({
|
|
7
|
+
description: "Unique identifier for the bookmark.",
|
|
8
|
+
title: "Bookmark ID",
|
|
9
|
+
}),
|
|
10
|
+
createdAt: z.coerce.date().optional().openapi({
|
|
11
|
+
description: "Timestamp when the bookmark was created.",
|
|
12
|
+
title: "Created At",
|
|
13
|
+
}),
|
|
14
|
+
userId: z.cuid2().openapi({
|
|
15
|
+
description: "Identifier of the user who created the bookmark.",
|
|
16
|
+
title: "User ID",
|
|
17
|
+
}),
|
|
18
|
+
parentId: z.cuid2().openapi({
|
|
19
|
+
description: "Identifier of the parent entity that was bookmarked.",
|
|
20
|
+
title: "Parent ID",
|
|
21
|
+
}),
|
|
22
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).openapi({
|
|
23
|
+
description: "Type of the parent entity this statistic belongs to.",
|
|
24
|
+
title: "Parent Type",
|
|
25
|
+
}),
|
|
26
|
+
})
|
|
27
|
+
.openapi({
|
|
28
|
+
title: "Bookmark",
|
|
29
|
+
description: "Represents a user bookmark on a specific parent entity.",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const BookmarkInputSchema = z.object({
|
|
33
|
+
parentId: z.string(),
|
|
34
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES),
|
|
35
|
+
userId: z.string(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const BookmarkOutputSchema = BookmarkEntitySchema;
|
package/src/schemas/brand.ts
CHANGED
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
import { ProfileIdentifierSchema } from "./common";
|
|
3
|
-
import { LINK_TYPES } from "../constants";
|
|
4
|
-
import { MinimalUserSchema } from "./user";
|
|
5
|
-
|
|
6
|
-
export const MinimalBrandEntitySchema = z.object({
|
|
7
|
-
id: z.cuid2().openapi({ example: "brd_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
8
|
-
userId: z.cuid2().openapi({ example: "user_owner_123" }),
|
|
9
|
-
brandName: z.string().openapi({ example: "TechInnovate Inc." }),
|
|
10
|
-
bio: z.string().optional().openapi({
|
|
11
|
-
example: "Leading software development firm focused on AI.",
|
|
12
|
-
}),
|
|
13
|
-
|
|
14
|
-
disciplines: z
|
|
15
|
-
.array(z.string())
|
|
16
|
-
.optional()
|
|
17
|
-
.openapi({ example: ["Marketing", "Product Development"] }),
|
|
18
|
-
createdAt: z.coerce
|
|
19
|
-
.date()
|
|
20
|
-
.optional()
|
|
21
|
-
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
22
|
-
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const BrandEntitySchema = z
|
|
26
|
-
.object({
|
|
27
|
-
id: z.cuid2().openapi({ example: "brd_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
28
|
-
userId: z.cuid2().openapi({ example: "user_owner_123" }),
|
|
29
|
-
brandName: z.string().openapi({ example: "TechInnovate Inc." }),
|
|
30
|
-
bio: z.string().optional().openapi({
|
|
31
|
-
example: "Leading software development firm focused on AI.",
|
|
32
|
-
}),
|
|
33
|
-
disciplines: z
|
|
34
|
-
.array(z.string())
|
|
35
|
-
.optional()
|
|
36
|
-
.openapi({ example: ["Marketing", "Product Development"] }),
|
|
37
|
-
|
|
38
|
-
links: z
|
|
39
|
-
.object({
|
|
40
|
-
url: z.url(),
|
|
41
|
-
type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
|
|
42
|
-
})
|
|
43
|
-
.array()
|
|
44
|
-
.optional(),
|
|
45
|
-
achievements: z
|
|
46
|
-
.object({
|
|
47
|
-
title: z.string(),
|
|
48
|
-
link: z.url().optional(),
|
|
49
|
-
year: z.number().int().optional(),
|
|
50
|
-
})
|
|
51
|
-
.array()
|
|
52
|
-
.optional(),
|
|
53
|
-
createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
54
|
-
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
55
|
-
version: z.int(),
|
|
56
|
-
})
|
|
57
|
-
.openapi("BrandEntitySchema");
|
|
58
|
-
|
|
59
|
-
export const CreateBrandProfileInputSchema = z
|
|
60
|
-
.object({
|
|
61
|
-
brandName: z
|
|
62
|
-
.string()
|
|
63
|
-
.min(1, "Brand name is required")
|
|
64
|
-
.openapi({ example: "Acme Creative Studio" }),
|
|
65
|
-
disciplineSlugs: z
|
|
66
|
-
.array(z.string())
|
|
67
|
-
.min(1, "At least one discipline is required")
|
|
68
|
-
.default([])
|
|
69
|
-
.openapi({ example: ["ui-ux", "frontend"] }),
|
|
70
|
-
})
|
|
71
|
-
.openapi({
|
|
72
|
-
title: "create brand profile",
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
export const UpdateBrandProfileInputSchema = z
|
|
76
|
-
.object({
|
|
77
|
-
brandName: z.string().min(1).optional().openapi({ example: "Acme Studio" }),
|
|
78
|
-
links: z
|
|
79
|
-
.object({
|
|
80
|
-
url: z.union([
|
|
81
|
-
z.url({ message: "Please enter a valid URL" }),
|
|
82
|
-
z.literal(""),
|
|
83
|
-
]),
|
|
84
|
-
type: z.enum(LINK_TYPES),
|
|
85
|
-
})
|
|
86
|
-
.array()
|
|
87
|
-
.optional(),
|
|
88
|
-
achievements: z
|
|
89
|
-
.object({
|
|
90
|
-
title: z.string(),
|
|
91
|
-
link: z.url().optional(),
|
|
92
|
-
year: z.number().int().optional(),
|
|
93
|
-
})
|
|
94
|
-
.array()
|
|
95
|
-
.optional(),
|
|
96
|
-
bio: z
|
|
97
|
-
.string()
|
|
98
|
-
.max(600)
|
|
99
|
-
.optional()
|
|
100
|
-
.openapi({ example: "Updated bio for our creative agency." }),
|
|
101
|
-
disciplineSlugs: z
|
|
102
|
-
.array(z.string())
|
|
103
|
-
.min(1, "At least one discipline is required")
|
|
104
|
-
.optional()
|
|
105
|
-
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
106
|
-
version: z.int(),
|
|
107
|
-
})
|
|
108
|
-
.openapi({
|
|
109
|
-
title: "update brand profile",
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
export const GetBrandInputSchema = z.object({
|
|
113
|
-
value: z.cuid2(),
|
|
114
|
-
by: ProfileIdentifierSchema.shape.by,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
export const GetBrandQuerySchema = ProfileIdentifierSchema;
|
|
118
|
-
|
|
119
|
-
export const CreateBrandOutputSchema = BrandEntitySchema;
|
|
120
|
-
|
|
121
|
-
export const GetBrandOutputSchema = BrandEntitySchema;
|
|
122
|
-
|
|
123
|
-
export const UpdateBrandOutputSchema = BrandEntitySchema;
|
|
124
|
-
|
|
125
|
-
export const BrandWithUserEntitySchema = MinimalBrandEntitySchema.extend({
|
|
126
|
-
user: MinimalUserSchema,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
export const SearchBrandInputSchema = z.object({
|
|
130
|
-
string: z
|
|
131
|
-
.string()
|
|
132
|
-
.min(1, { message: "Search string cannot be empty" })
|
|
133
|
-
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
134
|
-
limit: z.coerce
|
|
135
|
-
.number()
|
|
136
|
-
.int({ message: "Limit must be an integer" })
|
|
137
|
-
.min(1, { message: "Limit must be at least 1" })
|
|
138
|
-
.max(100, { message: "Limit cannot exceed 100" })
|
|
139
|
-
.default(20),
|
|
140
|
-
cursor: z.string().optional(),
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
export const SearchBrandOutputSchema = z.object({
|
|
144
|
-
brands: z.array(BrandWithUserEntitySchema),
|
|
145
|
-
nextCursor: z.string().optional().nullable(),
|
|
146
|
-
});
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { ProfileIdentifierSchema } from "./common";
|
|
3
|
+
import { LINK_TYPES } from "../constants";
|
|
4
|
+
import { MinimalUserSchema } from "./user";
|
|
5
|
+
|
|
6
|
+
export const MinimalBrandEntitySchema = z.object({
|
|
7
|
+
id: z.cuid2().openapi({ example: "brd_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
8
|
+
userId: z.cuid2().openapi({ example: "user_owner_123" }),
|
|
9
|
+
brandName: z.string().openapi({ example: "TechInnovate Inc." }),
|
|
10
|
+
bio: z.string().optional().openapi({
|
|
11
|
+
example: "Leading software development firm focused on AI.",
|
|
12
|
+
}),
|
|
13
|
+
|
|
14
|
+
disciplines: z
|
|
15
|
+
.array(z.string())
|
|
16
|
+
.optional()
|
|
17
|
+
.openapi({ example: ["Marketing", "Product Development"] }),
|
|
18
|
+
createdAt: z.coerce
|
|
19
|
+
.date()
|
|
20
|
+
.optional()
|
|
21
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
22
|
+
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const BrandEntitySchema = z
|
|
26
|
+
.object({
|
|
27
|
+
id: z.cuid2().openapi({ example: "brd_cksd0v6q0000s9a5y8z7p3x9" }),
|
|
28
|
+
userId: z.cuid2().openapi({ example: "user_owner_123" }),
|
|
29
|
+
brandName: z.string().openapi({ example: "TechInnovate Inc." }),
|
|
30
|
+
bio: z.string().optional().openapi({
|
|
31
|
+
example: "Leading software development firm focused on AI.",
|
|
32
|
+
}),
|
|
33
|
+
disciplines: z
|
|
34
|
+
.array(z.string())
|
|
35
|
+
.optional()
|
|
36
|
+
.openapi({ example: ["Marketing", "Product Development"] }),
|
|
37
|
+
|
|
38
|
+
links: z
|
|
39
|
+
.object({
|
|
40
|
+
url: z.url(),
|
|
41
|
+
type: z.enum(LINK_TYPES).default(LINK_TYPES.GENERIC_WEBSITE),
|
|
42
|
+
})
|
|
43
|
+
.array()
|
|
44
|
+
.optional(),
|
|
45
|
+
achievements: z
|
|
46
|
+
.object({
|
|
47
|
+
title: z.string(),
|
|
48
|
+
link: z.url().optional(),
|
|
49
|
+
year: z.number().int().optional(),
|
|
50
|
+
})
|
|
51
|
+
.array()
|
|
52
|
+
.optional(),
|
|
53
|
+
createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
54
|
+
updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
55
|
+
version: z.int(),
|
|
56
|
+
})
|
|
57
|
+
.openapi("BrandEntitySchema");
|
|
58
|
+
|
|
59
|
+
export const CreateBrandProfileInputSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
brandName: z
|
|
62
|
+
.string()
|
|
63
|
+
.min(1, "Brand name is required")
|
|
64
|
+
.openapi({ example: "Acme Creative Studio" }),
|
|
65
|
+
disciplineSlugs: z
|
|
66
|
+
.array(z.string())
|
|
67
|
+
.min(1, "At least one discipline is required")
|
|
68
|
+
.default([])
|
|
69
|
+
.openapi({ example: ["ui-ux", "frontend"] }),
|
|
70
|
+
})
|
|
71
|
+
.openapi({
|
|
72
|
+
title: "create brand profile",
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const UpdateBrandProfileInputSchema = z
|
|
76
|
+
.object({
|
|
77
|
+
brandName: z.string().min(1).optional().openapi({ example: "Acme Studio" }),
|
|
78
|
+
links: z
|
|
79
|
+
.object({
|
|
80
|
+
url: z.union([
|
|
81
|
+
z.url({ message: "Please enter a valid URL" }),
|
|
82
|
+
z.literal(""),
|
|
83
|
+
]),
|
|
84
|
+
type: z.enum(LINK_TYPES),
|
|
85
|
+
})
|
|
86
|
+
.array()
|
|
87
|
+
.optional(),
|
|
88
|
+
achievements: z
|
|
89
|
+
.object({
|
|
90
|
+
title: z.string(),
|
|
91
|
+
link: z.url().optional(),
|
|
92
|
+
year: z.number().int().optional(),
|
|
93
|
+
})
|
|
94
|
+
.array()
|
|
95
|
+
.optional(),
|
|
96
|
+
bio: z
|
|
97
|
+
.string()
|
|
98
|
+
.max(600)
|
|
99
|
+
.optional()
|
|
100
|
+
.openapi({ example: "Updated bio for our creative agency." }),
|
|
101
|
+
disciplineSlugs: z
|
|
102
|
+
.array(z.string())
|
|
103
|
+
.min(1, "At least one discipline is required")
|
|
104
|
+
.optional()
|
|
105
|
+
.openapi({ example: ["frontend", "ui-ux"] }),
|
|
106
|
+
version: z.int(),
|
|
107
|
+
})
|
|
108
|
+
.openapi({
|
|
109
|
+
title: "update brand profile",
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export const GetBrandInputSchema = z.object({
|
|
113
|
+
value: z.cuid2(),
|
|
114
|
+
by: ProfileIdentifierSchema.shape.by,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export const GetBrandQuerySchema = ProfileIdentifierSchema;
|
|
118
|
+
|
|
119
|
+
export const CreateBrandOutputSchema = BrandEntitySchema;
|
|
120
|
+
|
|
121
|
+
export const GetBrandOutputSchema = BrandEntitySchema;
|
|
122
|
+
|
|
123
|
+
export const UpdateBrandOutputSchema = BrandEntitySchema;
|
|
124
|
+
|
|
125
|
+
export const BrandWithUserEntitySchema = MinimalBrandEntitySchema.extend({
|
|
126
|
+
user: MinimalUserSchema,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export const SearchBrandInputSchema = z.object({
|
|
130
|
+
string: z
|
|
131
|
+
.string()
|
|
132
|
+
.min(1, { message: "Search string cannot be empty" })
|
|
133
|
+
.max(200, { message: "Search string cannot exceed 200 characters" }),
|
|
134
|
+
limit: z.coerce
|
|
135
|
+
.number()
|
|
136
|
+
.int({ message: "Limit must be an integer" })
|
|
137
|
+
.min(1, { message: "Limit must be at least 1" })
|
|
138
|
+
.max(100, { message: "Limit cannot exceed 100" })
|
|
139
|
+
.default(20),
|
|
140
|
+
cursor: z.string().optional(),
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
export const SearchBrandOutputSchema = z.object({
|
|
144
|
+
brands: z.array(BrandWithUserEntitySchema),
|
|
145
|
+
nextCursor: z.string().optional().nullable(),
|
|
146
|
+
});
|
package/src/schemas/chat.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { z } from "@hono/zod-openapi";
|
|
2
|
-
|
|
3
|
-
export const BaseChatEntitySchema = z.object({
|
|
4
|
-
id: z.cuid2(),
|
|
5
|
-
senderId: z.cuid2(),
|
|
6
|
-
receiverId: z.cuid2(),
|
|
7
|
-
createdAt: z.coerce.date(),
|
|
8
|
-
updatedAt: z.coerce.date(),
|
|
9
|
-
deletedAt: z.coerce.date(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const ChatEntitySchema = BaseChatEntitySchema.extend({
|
|
13
|
-
senderImgUrl: z.string().optional(),
|
|
14
|
-
senderName: z.string(),
|
|
15
|
-
receiverImgUrl: z.string().optional(),
|
|
16
|
-
receiverName: z.string(),
|
|
17
|
-
lastMessageSent: z.string().optional(),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const CreateChatInputSchema = z.object({
|
|
21
|
-
senderId: z.cuid2(),
|
|
22
|
-
receiverId: z.cuid2(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const CreateChatOutputSchema = BaseChatEntitySchema;
|
|
26
|
-
|
|
27
|
-
export const ChatIdSchema = z.object({
|
|
28
|
-
chatId: z.cuid2(),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const GetChatsOutputSchema = z.array(ChatEntitySchema);
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const BaseChatEntitySchema = z.object({
|
|
4
|
+
id: z.cuid2(),
|
|
5
|
+
senderId: z.cuid2(),
|
|
6
|
+
receiverId: z.cuid2(),
|
|
7
|
+
createdAt: z.coerce.date(),
|
|
8
|
+
updatedAt: z.coerce.date(),
|
|
9
|
+
deletedAt: z.coerce.date(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const ChatEntitySchema = BaseChatEntitySchema.extend({
|
|
13
|
+
senderImgUrl: z.string().optional(),
|
|
14
|
+
senderName: z.string(),
|
|
15
|
+
receiverImgUrl: z.string().optional(),
|
|
16
|
+
receiverName: z.string(),
|
|
17
|
+
lastMessageSent: z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const CreateChatInputSchema = z.object({
|
|
21
|
+
senderId: z.cuid2(),
|
|
22
|
+
receiverId: z.cuid2(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const CreateChatOutputSchema = BaseChatEntitySchema;
|
|
26
|
+
|
|
27
|
+
export const ChatIdSchema = z.object({
|
|
28
|
+
chatId: z.cuid2(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const GetChatsOutputSchema = z.array(ChatEntitySchema);
|