@zyacreatives/shared 1.0.0 → 1.1.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.
- package/dist/constants.d.ts +277 -0
- package/dist/constants.js +268 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/schemas/brand.d.ts +84 -0
- package/dist/schemas/brand.js +68 -0
- package/dist/schemas/common.d.ts +33 -0
- package/dist/schemas/common.js +58 -0
- package/dist/schemas/creative.d.ts +113 -0
- package/dist/schemas/creative.js +102 -0
- package/dist/schemas/user.d.ts +179 -0
- package/dist/schemas/user.js +93 -0
- package/dist/types/brand.d.ts +24 -0
- package/dist/types/brand.js +2 -0
- package/dist/types/common.d.ts +10 -0
- package/dist/types/common.js +2 -0
- package/dist/types/creative.d.ts +28 -0
- package/dist/types/creative.js +2 -0
- package/dist/types/discipline.d.ts +8 -0
- package/dist/types/discipline.js +2 -0
- package/dist/types/enums.d.ts +97 -0
- package/dist/types/enums.js +110 -0
- package/dist/types/file.d.ts +12 -0
- package/dist/types/file.js +2 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +24 -0
- package/dist/types/investor.d.ts +30 -0
- package/dist/types/investor.js +2 -0
- package/dist/types/project.d.ts +79 -0
- package/dist/types/project.js +2 -0
- package/dist/types/user.d.ts +42 -0
- package/dist/types/user.js +2 -0
- package/package.json +8 -3
- package/src/constants.ts +300 -0
- package/src/index.ts +1 -1
- package/src/schemas/brand.ts +91 -0
- package/src/schemas/common.ts +67 -0
- package/src/schemas/creative.ts +125 -0
- package/src/schemas/user.ts +125 -0
- package/src/types/brand.ts +27 -0
- package/src/types/common.ts +11 -0
- package/src/types/creative.ts +32 -0
- package/src/types/discipline.ts +9 -0
- package/src/types/file.ts +13 -0
- package/src/types/index.ts +8 -0
- package/src/types/investor.ts +38 -0
- package/src/types/project.ts +101 -0
- package/src/types/user.ts +60 -0
- package/tsconfig.json +5 -2
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ROLES,
|
|
5
|
+
USER_STATUSES,
|
|
6
|
+
ONBOARDING_PAGES,
|
|
7
|
+
EXPERIENCE_LEVELS,
|
|
8
|
+
INVESTOR_TYPES,
|
|
9
|
+
INVESTMENT_SIZES,
|
|
10
|
+
GEOGRAPHIC_FOCUS,
|
|
11
|
+
} from "../constants";
|
|
12
|
+
import type {
|
|
13
|
+
Role,
|
|
14
|
+
UserStatus,
|
|
15
|
+
OnboardingPage,
|
|
16
|
+
ExperienceLevel,
|
|
17
|
+
InvestorType,
|
|
18
|
+
InvestmentSize,
|
|
19
|
+
GeographicFocus,
|
|
20
|
+
} from "../constants";
|
|
21
|
+
import { UserSocialGraphEntitySchema } from "./common";
|
|
22
|
+
|
|
23
|
+
export const BaseUserEntitySchema = z
|
|
24
|
+
.object({
|
|
25
|
+
id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
|
|
26
|
+
email: z.email().openapi({ example: "user@example.com" }),
|
|
27
|
+
emailVerified: z.boolean().openapi({ example: true }),
|
|
28
|
+
name: z.string().optional().openapi({ example: "John Doe" }),
|
|
29
|
+
image: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.openapi({ example: "https://example.com/avatar.png" }),
|
|
33
|
+
username: z.string().optional().openapi({ example: "johndoe" }),
|
|
34
|
+
displayUsername: z.string().optional().openapi({ example: "@johndoe" }),
|
|
35
|
+
role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).openapi({
|
|
36
|
+
example: "CREATIVE",
|
|
37
|
+
}),
|
|
38
|
+
status: z
|
|
39
|
+
.enum(Object.values(USER_STATUSES) as [UserStatus, ...UserStatus[]])
|
|
40
|
+
.openapi({
|
|
41
|
+
example: "ACTIVE",
|
|
42
|
+
}),
|
|
43
|
+
onboardingPage: z
|
|
44
|
+
.enum(
|
|
45
|
+
Object.values(ONBOARDING_PAGES) as [OnboardingPage, ...OnboardingPage[]]
|
|
46
|
+
)
|
|
47
|
+
.openapi({
|
|
48
|
+
example: "DONE",
|
|
49
|
+
}),
|
|
50
|
+
createdAt: z.iso
|
|
51
|
+
.datetime()
|
|
52
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
53
|
+
updatedAt: z.iso
|
|
54
|
+
.datetime()
|
|
55
|
+
.openapi({ example: "2025-10-13T09:00:00.000Z" }),
|
|
56
|
+
})
|
|
57
|
+
.openapi("BaseUserEntity");
|
|
58
|
+
|
|
59
|
+
export const MinimalUserSchema = BaseUserEntitySchema.pick({
|
|
60
|
+
id: true,
|
|
61
|
+
name: true,
|
|
62
|
+
email: true,
|
|
63
|
+
image: true,
|
|
64
|
+
username: true,
|
|
65
|
+
role: true,
|
|
66
|
+
}).openapi("MinimalUser");
|
|
67
|
+
|
|
68
|
+
export const UserEntitySchema = BaseUserEntitySchema.merge(
|
|
69
|
+
UserSocialGraphEntitySchema
|
|
70
|
+
).openapi("UserEntity");
|
|
71
|
+
|
|
72
|
+
export const UserProfileEntitySchema = UserEntitySchema.extend({
|
|
73
|
+
profileType: z.enum(["creative", "brand", "investor"]).optional().openapi({
|
|
74
|
+
example: "creative",
|
|
75
|
+
}),
|
|
76
|
+
bio: z.string().optional().openapi({
|
|
77
|
+
example: "Passionate digital artist focusing on UI/UX.",
|
|
78
|
+
}),
|
|
79
|
+
location: z.string().optional().openapi({
|
|
80
|
+
example: "Lagos, Nigeria",
|
|
81
|
+
}),
|
|
82
|
+
experienceLevel: z
|
|
83
|
+
.enum(
|
|
84
|
+
Object.values(EXPERIENCE_LEVELS) as [
|
|
85
|
+
ExperienceLevel,
|
|
86
|
+
...ExperienceLevel[]
|
|
87
|
+
]
|
|
88
|
+
)
|
|
89
|
+
.optional()
|
|
90
|
+
.openapi({ example: EXPERIENCE_LEVELS.YEAR_1_3 }),
|
|
91
|
+
disciplines: z
|
|
92
|
+
.array(z.string())
|
|
93
|
+
.optional()
|
|
94
|
+
.openapi({
|
|
95
|
+
example: ["ui-ux", "frontend"],
|
|
96
|
+
}),
|
|
97
|
+
tags: z
|
|
98
|
+
.array(z.string())
|
|
99
|
+
.optional()
|
|
100
|
+
.openapi({
|
|
101
|
+
example: ["react", "design", "product"],
|
|
102
|
+
}),
|
|
103
|
+
brandName: z.string().optional().openapi({
|
|
104
|
+
example: "Acme Creative Studio",
|
|
105
|
+
}),
|
|
106
|
+
websiteURL: z.string().optional().openapi({
|
|
107
|
+
example: "https://acme-creative.com",
|
|
108
|
+
}),
|
|
109
|
+
investorType: z
|
|
110
|
+
.enum(Object.values(INVESTOR_TYPES) as [InvestorType, ...InvestorType[]])
|
|
111
|
+
.optional()
|
|
112
|
+
.openapi({ example: INVESTOR_TYPES.ANGEL_INVESTOR }),
|
|
113
|
+
investmentSize: z
|
|
114
|
+
.enum(
|
|
115
|
+
Object.values(INVESTMENT_SIZES) as [InvestmentSize, ...InvestmentSize[]]
|
|
116
|
+
)
|
|
117
|
+
.optional()
|
|
118
|
+
.openapi({ example: INVESTMENT_SIZES.BETWEEN_25K_100K }),
|
|
119
|
+
geographicFocus: z
|
|
120
|
+
.enum(
|
|
121
|
+
Object.values(GEOGRAPHIC_FOCUS) as [GeographicFocus, ...GeographicFocus[]]
|
|
122
|
+
)
|
|
123
|
+
.optional()
|
|
124
|
+
.openapi({ example: GEOGRAPHIC_FOCUS.AFRICA }),
|
|
125
|
+
}).openapi("UserProfileEntity");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MinimalUser } from "./user";
|
|
2
|
+
|
|
3
|
+
export type BrandEntity = {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
brandName: string;
|
|
7
|
+
searchVector?: string;
|
|
8
|
+
bio?: string;
|
|
9
|
+
tags?: string[];
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type BrandWithUserEntity = BrandEntity & {
|
|
15
|
+
user: MinimalUser;
|
|
16
|
+
disciplines: string[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ListBrandsInput = {
|
|
20
|
+
query?: string;
|
|
21
|
+
disciplines?: string[];
|
|
22
|
+
experienceLevels?: string[];
|
|
23
|
+
location?: string;
|
|
24
|
+
tags?: string[];
|
|
25
|
+
page?: number;
|
|
26
|
+
perPage?: number;
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExperienceLevel } from "../constants";
|
|
2
|
+
import type { MinimalUser } from "./user";
|
|
3
|
+
|
|
4
|
+
export type BaseCreativeEntity = {
|
|
5
|
+
id: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
bio?: string;
|
|
8
|
+
location?: string;
|
|
9
|
+
experienceLevel?: ExperienceLevel;
|
|
10
|
+
tags?: string[];
|
|
11
|
+
disciplines?: string[];
|
|
12
|
+
user?: any;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type CreativeEntity = BaseCreativeEntity;
|
|
18
|
+
|
|
19
|
+
export type CreativeWithUserEntity = CreativeEntity & {
|
|
20
|
+
user: MinimalUser;
|
|
21
|
+
disciplines: string[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type ListCreativesInput = {
|
|
25
|
+
query?: string;
|
|
26
|
+
disciplines?: string[];
|
|
27
|
+
experienceLevels?: string[];
|
|
28
|
+
location?: string;
|
|
29
|
+
tags?: string[];
|
|
30
|
+
page?: number;
|
|
31
|
+
perPage?: number;
|
|
32
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExperienceLevel,
|
|
3
|
+
GeographicFocus,
|
|
4
|
+
InvestmentSize,
|
|
5
|
+
InvestorType,
|
|
6
|
+
} from "../constants";
|
|
7
|
+
import type { MinimalUser } from "./user";
|
|
8
|
+
|
|
9
|
+
export type InvestorEntity = {
|
|
10
|
+
id: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
bio?: string;
|
|
13
|
+
location?: string;
|
|
14
|
+
experienceLevel?: ExperienceLevel;
|
|
15
|
+
geographicFocus?: GeographicFocus;
|
|
16
|
+
investmentSize?: InvestmentSize;
|
|
17
|
+
investorType?: InvestorType;
|
|
18
|
+
websiteURL?: string;
|
|
19
|
+
disciplines?: string[];
|
|
20
|
+
user?: any;
|
|
21
|
+
createdAt: Date;
|
|
22
|
+
updatedAt: Date;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type InvestorWithUserEntity = InvestorEntity & {
|
|
26
|
+
user: MinimalUser;
|
|
27
|
+
disciplines: string[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ListInvestorsInput = {
|
|
31
|
+
query?: string;
|
|
32
|
+
disciplines?: string[];
|
|
33
|
+
experienceLevels?: string[];
|
|
34
|
+
location?: string;
|
|
35
|
+
tags?: string[];
|
|
36
|
+
page?: number;
|
|
37
|
+
perPage?: number;
|
|
38
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ClientType, CommentStatus, Role } from "../constants";
|
|
2
|
+
import type { ProjectSocialGraphEntity } from "./common";
|
|
3
|
+
import type { BaseUserEntity, MinimalUser } from "./user";
|
|
4
|
+
|
|
5
|
+
export type ProjectFileEntity = {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
fileId: string;
|
|
9
|
+
order: number;
|
|
10
|
+
isPlaceholder: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ProjectEntity = {
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
userId: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
overview?: string;
|
|
21
|
+
url?: string;
|
|
22
|
+
clientId?: string;
|
|
23
|
+
clientType?: ClientType;
|
|
24
|
+
clientName?: string;
|
|
25
|
+
projectCreatorType: Role;
|
|
26
|
+
tags?: string[];
|
|
27
|
+
isFeatured?: boolean;
|
|
28
|
+
startDate?: Date | null;
|
|
29
|
+
imagePlaceholderUrl?: string;
|
|
30
|
+
endDate?: Date | null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type ProjectWithFilesEntity = ProjectEntity &
|
|
34
|
+
ProjectSocialGraphEntity & {
|
|
35
|
+
projectFiles?: ProjectFileEntity[];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type ProjectViewEntity = {
|
|
39
|
+
id: string;
|
|
40
|
+
userId?: string;
|
|
41
|
+
ipAddress?: string;
|
|
42
|
+
userAgent?: string;
|
|
43
|
+
projectId: string;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
viewedAt: Date;
|
|
46
|
+
viewDate: Date;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type ProjectLikeEntity = {
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
userId: string;
|
|
52
|
+
projectId: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type ProjectCommentEntity = {
|
|
56
|
+
id: string;
|
|
57
|
+
status: CommentStatus;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
userId: string;
|
|
60
|
+
projectId: string;
|
|
61
|
+
parentCommentId?: string;
|
|
62
|
+
content: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type ProjectBookmarkEntity = {
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
userId: string;
|
|
68
|
+
projectId: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type MinimalProject = Pick<
|
|
72
|
+
ProjectEntity,
|
|
73
|
+
| "id"
|
|
74
|
+
| "title"
|
|
75
|
+
| "description"
|
|
76
|
+
| "tags"
|
|
77
|
+
| "startDate"
|
|
78
|
+
| "endDate"
|
|
79
|
+
| "imagePlaceholderUrl"
|
|
80
|
+
>;
|
|
81
|
+
|
|
82
|
+
export type ProjectWithClientEntity = MinimalProject & {
|
|
83
|
+
client: MinimalUser;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type ProjectWithUserEntity = MinimalProject & {
|
|
87
|
+
user: Pick<
|
|
88
|
+
BaseUserEntity,
|
|
89
|
+
"id" | "name" | "email" | "image" | "username" | "role"
|
|
90
|
+
>;
|
|
91
|
+
projectFiles: (ProjectFileEntity & { fileUrl: string })[];
|
|
92
|
+
} & Partial<ProjectSocialGraphEntity>;
|
|
93
|
+
|
|
94
|
+
export type ListProjectsDto = {
|
|
95
|
+
query?: string;
|
|
96
|
+
tags?: string[];
|
|
97
|
+
clientName?: string;
|
|
98
|
+
userId?: string;
|
|
99
|
+
page?: number;
|
|
100
|
+
perPage?: number;
|
|
101
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { OnboardingPage, Role, UserStatus } from "../constants";
|
|
2
|
+
import type { UserSocialGraphEntity } from "./common";
|
|
3
|
+
import type { ProjectBookmarkEntity, ProjectEntity } from "./project";
|
|
4
|
+
|
|
5
|
+
export type BaseUserEntity = {
|
|
6
|
+
id: string;
|
|
7
|
+
email: string;
|
|
8
|
+
emailVerified: boolean;
|
|
9
|
+
name?: string;
|
|
10
|
+
image?: string;
|
|
11
|
+
username?: string;
|
|
12
|
+
displayUsername?: string;
|
|
13
|
+
role: Role;
|
|
14
|
+
status: UserStatus;
|
|
15
|
+
onboardingPage: OnboardingPage;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type MinimalUser = Pick<
|
|
21
|
+
BaseUserEntity,
|
|
22
|
+
"id" | "name" | "email" | "image" | "username" | "role"
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export type UserEntity = BaseUserEntity & UserSocialGraphEntity;
|
|
26
|
+
|
|
27
|
+
export type UserProfileEntity = UserEntity & {
|
|
28
|
+
profileType?: "creative" | "brand" | "investor";
|
|
29
|
+
bio?: string;
|
|
30
|
+
location?: string;
|
|
31
|
+
experienceLevel?: string;
|
|
32
|
+
disciplines?: any[];
|
|
33
|
+
tags?: any[];
|
|
34
|
+
brandName?: string;
|
|
35
|
+
websiteURL?: string;
|
|
36
|
+
investorType?: string;
|
|
37
|
+
investmentSize?: string;
|
|
38
|
+
geographicFocus?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type UserWithProjectsEntity = {
|
|
42
|
+
userId: string;
|
|
43
|
+
projects: Omit<ProjectEntity, "overview">[];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type UserWithProjectBookmarksEntity = {
|
|
47
|
+
userId: string;
|
|
48
|
+
projectBookmarks: (ProjectBookmarkEntity & {
|
|
49
|
+
project: Pick<
|
|
50
|
+
ProjectEntity,
|
|
51
|
+
| "id"
|
|
52
|
+
| "title"
|
|
53
|
+
| "description"
|
|
54
|
+
| "tags"
|
|
55
|
+
| "startDate"
|
|
56
|
+
| "endDate"
|
|
57
|
+
| "imagePlaceholderUrl"
|
|
58
|
+
>;
|
|
59
|
+
})[];
|
|
60
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ESNext",
|
|
4
|
-
"module": "
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
5
6
|
"declaration": true,
|
|
6
7
|
"outDir": "dist",
|
|
7
|
-
"strict": true
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true
|
|
8
11
|
},
|
|
9
12
|
"include": ["src"]
|
|
10
13
|
}
|