@zyacreatives/shared 2.5.23 → 2.5.25

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.
@@ -25,7 +25,9 @@ export declare const MinimalJobApplicationEntitySchema: z.ZodObject<{
25
25
  Offered: "Offered";
26
26
  Hired: "Hired";
27
27
  }>;
28
+ isApplied: z.ZodBoolean;
28
29
  }, z.core.$strip>;
30
+ export type MinimalJobApplicationEntity = z.infer<typeof MinimalJobApplicationEntitySchema>;
29
31
  export declare const BaseJobApplicationEntitySchema: z.ZodObject<{
30
32
  id: z.ZodString;
31
33
  createdAt: z.ZodCoercedDate<unknown>;
@@ -50,6 +52,7 @@ export declare const BaseJobApplicationEntitySchema: z.ZodObject<{
50
52
  phoneNumber: z.ZodNullable<z.ZodString>;
51
53
  currentRole: z.ZodString;
52
54
  resumeUrl: z.ZodURL;
55
+ isApplied: z.ZodBoolean;
53
56
  workSampleUrls: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
57
  url: z.ZodURL;
55
58
  name: z.ZodOptional<z.ZodString>;
@@ -77,6 +80,7 @@ export declare const BaseJobApplicationEntitySchema: z.ZodObject<{
77
80
  receiveEmailUpdates: z.ZodBoolean;
78
81
  wagesAmount: z.ZodNullable<z.ZodNumber>;
79
82
  }, z.core.$strip>;
83
+ export type BaseJobApplicationEntity = z.infer<typeof BaseJobApplicationEntitySchema>;
80
84
  export declare const JobApplicationEntitySchema: z.ZodObject<{
81
85
  id: z.ZodString;
82
86
  firstName: z.ZodOptional<z.ZodString>;
@@ -131,16 +135,18 @@ export declare const JobApplicationEntitySchema: z.ZodObject<{
131
135
  }, z.core.$strip>>>;
132
136
  coverLetter: z.ZodOptional<z.ZodString>;
133
137
  receiveEmailUpdates: z.ZodOptional<z.ZodBoolean>;
134
- wagesAmount: z.ZodOptional<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
138
+ wagesAmount: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
135
139
  availability: z.ZodOptional<z.ZodEnum<{
136
140
  "Immediate (Within 1 week)": "Immediate (Within 1 week)";
137
141
  "2 weeks notice": "2 weeks notice";
138
142
  "1 month notice": "1 month notice";
139
143
  Flexible: "Flexible";
140
144
  }>>;
145
+ isApplied: z.ZodBoolean;
141
146
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
142
147
  updatedAt: z.ZodCoercedDate<unknown>;
143
148
  }, z.core.$strip>;
149
+ export type JobApplicationEntity = z.infer<typeof JobApplicationEntitySchema>;
144
150
  export declare const CreateJobApplicationInputSchema: z.ZodObject<{
145
151
  jobId: z.ZodCUID2;
146
152
  applicantId: z.ZodCUID2;
@@ -191,6 +197,7 @@ export declare const CreateJobApplicationInputSchema: z.ZodObject<{
191
197
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
192
198
  }, z.core.$strip>>>;
193
199
  }, z.core.$strip>;
200
+ export type CreateJobApplicationInput = z.infer<typeof CreateJobApplicationInputSchema>;
194
201
  export declare const TrackedJobApplicationEntitySchema: z.ZodObject<{
195
202
  id: z.ZodCUID2;
196
203
  createdAt: z.ZodCoercedDate<unknown>;
@@ -412,6 +419,7 @@ export declare const TrackedJobApplicationEntitySchema: z.ZodObject<{
412
419
  }>>;
413
420
  }, z.core.$strip>]>;
414
421
  }, z.core.$strip>;
422
+ export type TrackedJobApplicationEntity = z.infer<typeof TrackedJobApplicationEntitySchema>;
415
423
  export declare const UpdateJobApplicationInputSchema: z.ZodObject<{
416
424
  jobId: z.ZodOptional<z.ZodCUID2>;
417
425
  applicantId: z.ZodOptional<z.ZodCUID2>;
@@ -471,6 +479,7 @@ export declare const UpdateJobApplicationInputSchema: z.ZodObject<{
471
479
  Hired: "Hired";
472
480
  }>>;
473
481
  }, z.core.$strip>;
482
+ export type UpdateJobApplicationInput = z.infer<typeof UpdateJobApplicationInputSchema>;
474
483
  export declare const GetTrackedJobApplicationsInputSchema: z.ZodObject<{
475
484
  query: z.ZodOptional<z.ZodString>;
476
485
  status: z.ZodOptional<z.ZodEnum<{
@@ -488,6 +497,7 @@ export declare const GetTrackedJobApplicationsInputSchema: z.ZodObject<{
488
497
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
489
498
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
490
499
  }, z.core.$strip>;
500
+ export type GetTrackedJobApplicationsInput = z.infer<typeof GetTrackedJobApplicationsInputSchema>;
491
501
  export declare const GetTrackedJobApplicationsOutputSchema: z.ZodObject<{
492
502
  applications: z.ZodArray<z.ZodObject<{
493
503
  id: z.ZodCUID2;
@@ -716,3 +726,4 @@ export declare const GetTrackedJobApplicationsOutputSchema: z.ZodObject<{
716
726
  hasNextPage: z.ZodBoolean;
717
727
  hasPrevPage: z.ZodBoolean;
718
728
  }, z.core.$strip>;
729
+ export type GetTrackedJobApplicationsOutput = z.infer<typeof GetTrackedJobApplicationsOutputSchema>;
@@ -5,13 +5,17 @@ const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  const user_1 = require("./user");
7
7
  const job_1 = require("./job");
8
+ const ApplicationStatusSchema = zod_openapi_1.z.enum(Object.values(constants_1.APPLICATION_STATUS));
9
+ const ExperienceLevelSchema = zod_openapi_1.z.enum(Object.values(constants_1.EXPERIENCE_LEVELS));
10
+ const JobAvailabilitySchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_AVAILABILITY_TYPES));
8
11
  exports.MinimalJobApplicationEntitySchema = zod_openapi_1.z.object({
9
12
  user: user_1.MinimalUserSchema,
10
13
  jobId: zod_openapi_1.z.cuid2(),
11
14
  id: zod_openapi_1.z.cuid2(),
12
15
  coverLetter: zod_openapi_1.z.string(),
13
16
  createdAt: zod_openapi_1.z.coerce.date(),
14
- applicationStatus: zod_openapi_1.z.enum(Object.values(constants_1.APPLICATION_STATUS)),
17
+ applicationStatus: ApplicationStatusSchema,
18
+ isApplied: zod_openapi_1.z.boolean(),
15
19
  });
16
20
  exports.BaseJobApplicationEntitySchema = zod_openapi_1.z.object({
17
21
  id: zod_openapi_1.z.string(),
@@ -27,6 +31,7 @@ exports.BaseJobApplicationEntitySchema = zod_openapi_1.z.object({
27
31
  phoneNumber: zod_openapi_1.z.string().nullable(),
28
32
  currentRole: zod_openapi_1.z.string(),
29
33
  resumeUrl: zod_openapi_1.z.url(),
34
+ isApplied: zod_openapi_1.z.boolean(),
30
35
  workSampleUrls: zod_openapi_1.z
31
36
  .array(zod_openapi_1.z.object({
32
37
  url: zod_openapi_1.z.url(),
@@ -42,7 +47,7 @@ exports.BaseJobApplicationEntitySchema = zod_openapi_1.z.object({
42
47
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
43
48
  }))
44
49
  .optional(),
45
- applicationStatus: zod_openapi_1.z.enum(Object.values(constants_1.APPLICATION_STATUS)),
50
+ applicationStatus: ApplicationStatusSchema,
46
51
  linkUrls: zod_openapi_1.z
47
52
  .array(zod_openapi_1.z.object({
48
53
  url: zod_openapi_1.z.url(),
@@ -62,9 +67,7 @@ exports.JobApplicationEntitySchema = zod_openapi_1.z.object({
62
67
  emailAddress: zod_openapi_1.z.email().optional(),
63
68
  phoneNumber: zod_openapi_1.z.string().optional(),
64
69
  currentRole: zod_openapi_1.z.string().optional(),
65
- experienceLevel: zod_openapi_1.z
66
- .enum(Object.values(constants_1.EXPERIENCE_LEVELS))
67
- .optional(),
70
+ experienceLevel: ExperienceLevelSchema.optional(),
68
71
  resumeUrl: zod_openapi_1.z.url(),
69
72
  workSampleUrls: zod_openapi_1.z
70
73
  .array(zod_openapi_1.z.object({
@@ -81,19 +84,16 @@ exports.JobApplicationEntitySchema = zod_openapi_1.z.object({
81
84
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
82
85
  }))
83
86
  .optional(),
84
- applicationStatus: zod_openapi_1.z
85
- .enum(Object.values(constants_1.APPLICATION_STATUS))
86
- .default("Application Sent"),
87
+ applicationStatus: ApplicationStatusSchema.default("Application Sent"),
87
88
  applicantId: zod_openapi_1.z.cuid2(),
88
89
  linkUrls: zod_openapi_1.z
89
90
  .array(zod_openapi_1.z.object({ url: zod_openapi_1.z.url(), isPortfolioUrl: zod_openapi_1.z.boolean().default(false) }))
90
91
  .optional(),
91
92
  coverLetter: zod_openapi_1.z.string().optional(),
92
93
  receiveEmailUpdates: zod_openapi_1.z.boolean().optional(),
93
- wagesAmount: zod_openapi_1.z.coerce.number().optional().optional(),
94
- availability: zod_openapi_1.z
95
- .enum(Object.values(constants_1.JOB_AVAILABILITY_TYPES))
96
- .optional(),
94
+ wagesAmount: zod_openapi_1.z.coerce.number().optional(),
95
+ availability: JobAvailabilitySchema.optional(),
96
+ isApplied: zod_openapi_1.z.boolean(),
97
97
  createdAt: zod_openapi_1.z.coerce
98
98
  .date()
99
99
  .optional()
@@ -109,9 +109,7 @@ exports.CreateJobApplicationInputSchema = zod_openapi_1.z.object({
109
109
  emailAddress: zod_openapi_1.z.email().optional(),
110
110
  phoneNumber: zod_openapi_1.z.string().optional(),
111
111
  currentRole: zod_openapi_1.z.string().optional(),
112
- experienceLevel: zod_openapi_1.z
113
- .enum(Object.values(constants_1.EXPERIENCE_LEVELS))
114
- .optional(),
112
+ experienceLevel: ExperienceLevelSchema.optional(),
115
113
  resumeUrl: zod_openapi_1.z.url().optional(),
116
114
  coverLetter: zod_openapi_1.z.string().optional(),
117
115
  availability: zod_openapi_1.z.enum(constants_1.JOB_AVAILABILITY_TYPES).optional(),
@@ -139,20 +137,16 @@ exports.CreateJobApplicationInputSchema = zod_openapi_1.z.object({
139
137
  exports.TrackedJobApplicationEntitySchema = zod_openapi_1.z.object({
140
138
  id: zod_openapi_1.z.cuid2(),
141
139
  createdAt: zod_openapi_1.z.coerce.date(),
142
- applicationStatus: zod_openapi_1.z.enum(Object.values(constants_1.APPLICATION_STATUS)),
140
+ applicationStatus: ApplicationStatusSchema,
143
141
  job: job_1.NormalizedJobSchema,
144
142
  });
145
143
  exports.UpdateJobApplicationInputSchema = exports.CreateJobApplicationInputSchema.partial().extend({
146
144
  id: zod_openapi_1.z.cuid2(),
147
- applicationStatus: zod_openapi_1.z
148
- .enum(Object.values(constants_1.APPLICATION_STATUS))
149
- .optional(),
145
+ applicationStatus: ApplicationStatusSchema.optional(),
150
146
  });
151
147
  exports.GetTrackedJobApplicationsInputSchema = zod_openapi_1.z.object({
152
148
  query: zod_openapi_1.z.string().optional(),
153
- status: zod_openapi_1.z
154
- .enum(Object.values(constants_1.APPLICATION_STATUS))
155
- .optional(),
149
+ status: ApplicationStatusSchema.optional(),
156
150
  jobType: zod_openapi_1.z
157
151
  .enum(Object.values(constants_1.JOB_TYPE))
158
152
  .optional(),
@@ -184,7 +184,7 @@ export declare const UpdateProjectInputSchema: z.ZodObject<{
184
184
  title: z.ZodOptional<z.ZodString>;
185
185
  description: z.ZodOptional<z.ZodString>;
186
186
  overview: z.ZodOptional<z.ZodString>;
187
- url: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodLiteral<"">]>>;
187
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>>;
188
188
  imagePlaceholderUrl: z.ZodOptional<z.ZodURL>;
189
189
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
190
190
  projectCreatorType: z.ZodOptional<z.ZodEnum<{
@@ -193,7 +193,7 @@ export declare const UpdateProjectInputSchema: z.ZodObject<{
193
193
  readonly INVESTOR: "INVESTOR";
194
194
  readonly ADMIN: "ADMIN";
195
195
  }>>;
196
- clientId: z.ZodOptional<z.ZodCUID2>;
196
+ clientId: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodString>>;
197
197
  clientType: z.ZodOptional<z.ZodEnum<{
198
198
  readonly CREATIVE: "CREATIVE";
199
199
  readonly BRAND: "BRAND";
@@ -72,23 +72,51 @@ exports.UpdateProjectInputSchema = zod_openapi_1.z
72
72
  .object({
73
73
  id: zod_openapi_1.z.cuid2(),
74
74
  title: zod_openapi_1.z.string().optional(),
75
- description: zod_openapi_1.z.string().optional(),
75
+ description: zod_openapi_1.z
76
+ .string()
77
+ .min(10, "Add a bit more detail to your description.")
78
+ .optional(),
76
79
  overview: zod_openapi_1.z.string().optional(),
77
- url: zod_openapi_1.z.url().or(zod_openapi_1.z.literal("")).optional(),
80
+ url: zod_openapi_1.z
81
+ .string()
82
+ .transform((val) => {
83
+ if (!val)
84
+ return val;
85
+ if (val.startsWith("http://") || val.startsWith("https://"))
86
+ return val;
87
+ return `https://${val}`;
88
+ })
89
+ .pipe(zod_openapi_1.z.string().url("Check your link.").or(zod_openapi_1.z.literal("")))
90
+ .optional(),
78
91
  imagePlaceholderUrl: zod_openapi_1.z.url().optional(),
79
92
  tags: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
80
93
  projectCreatorType: zod_openapi_1.z.enum(constants_1.ROLES).optional(),
81
- clientId: zod_openapi_1.z.cuid2().optional(),
94
+ clientId: zod_openapi_1.z
95
+ .string()
96
+ .transform((val) => (val === "" ? undefined : val))
97
+ .pipe(zod_openapi_1.z.string().cuid2().optional()),
82
98
  clientType: zod_openapi_1.z.enum(constants_1.CLIENT_TYPES).optional(),
83
99
  clientName: zod_openapi_1.z.string().optional(),
84
100
  isFeatured: zod_openapi_1.z.boolean().optional(),
85
101
  status: zod_openapi_1.z.enum(constants_1.PROJECT_STATUS).optional(),
86
- problemBeingSolved: zod_openapi_1.z.string().max(600).optional(),
87
- whoItsFor: zod_openapi_1.z.string().max(600).optional(),
102
+ problemBeingSolved: zod_openapi_1.z
103
+ .string()
104
+ .min(20, "Describe the problem you're solving.")
105
+ .max(600)
106
+ .optional(),
107
+ whoItsFor: zod_openapi_1.z
108
+ .string()
109
+ .min(5, "Tell us who this is for.")
110
+ .max(600)
111
+ .optional(),
88
112
  ventureStage: zod_openapi_1.z.enum(constants_1.VENTURE_STAGES).optional(),
89
113
  capitalLookingToRaise: zod_openapi_1.z.number().optional(),
90
114
  capitalLookingToRaiseCurrency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY).optional(),
91
- currentTraction: zod_openapi_1.z.string().max(600).optional(),
115
+ currentTraction: zod_openapi_1.z
116
+ .string()
117
+ .min(10, "Share your current traction.")
118
+ .max(600)
119
+ .optional(),
92
120
  isOpenToInvestment: zod_openapi_1.z.boolean().default(false),
93
121
  startDate: zod_openapi_1.z.coerce.date().optional(),
94
122
  endDate: zod_openapi_1.z.coerce.date().optional(),
@@ -101,14 +129,14 @@ exports.UpdateProjectInputSchema = zod_openapi_1.z
101
129
  ctx.addIssue({
102
130
  path: ["startDate"],
103
131
  code: "custom",
104
- message: "Start date cannot be in the future",
132
+ message: "Start date cannot be in the future.",
105
133
  });
106
134
  }
107
135
  if (startDate && endDate && startDate > endDate) {
108
136
  ctx.addIssue({
109
- path: ["startDate"],
137
+ path: ["endDate"],
110
138
  code: "custom",
111
- message: "Start date cannot be after end date",
139
+ message: "End date must follow the start date.",
112
140
  });
113
141
  }
114
142
  })
@@ -8,7 +8,6 @@ export * from "./username";
8
8
  export * from "./entity-stats";
9
9
  export * from "./feed";
10
10
  export * from "./activity";
11
- export * from "./job-application";
12
11
  export * from "./message";
13
12
  export * from "./chat";
14
13
  export * from "./job";
@@ -24,7 +24,6 @@ __exportStar(require("./username"), exports);
24
24
  __exportStar(require("./entity-stats"), exports);
25
25
  __exportStar(require("./feed"), exports);
26
26
  __exportStar(require("./activity"), exports);
27
- __exportStar(require("./job-application"), exports);
28
27
  __exportStar(require("./message"), exports);
29
28
  __exportStar(require("./chat"), exports);
30
29
  __exportStar(require("./job"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.5.23",
3
+ "version": "2.5.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,48 +13,62 @@ import {
13
13
  import { MinimalUserSchema } from "./user";
14
14
  import { NormalizedJobSchema } from "./job";
15
15
 
16
+ const ApplicationStatusSchema = z.enum(
17
+ Object.values(APPLICATION_STATUS) as [
18
+ ApplicationStatus,
19
+ ...ApplicationStatus[],
20
+ ],
21
+ );
22
+
23
+ const ExperienceLevelSchema = z.enum(
24
+ Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]],
25
+ );
26
+
27
+ const JobAvailabilitySchema = z.enum(
28
+ Object.values(JOB_AVAILABILITY_TYPES) as [
29
+ JobAvailabilityTypes,
30
+ ...JobAvailabilityTypes[],
31
+ ],
32
+ );
33
+
16
34
  export const MinimalJobApplicationEntitySchema = z.object({
17
35
  user: MinimalUserSchema,
18
36
  jobId: z.cuid2(),
19
37
  id: z.cuid2(),
20
38
  coverLetter: z.string(),
21
39
  createdAt: z.coerce.date(),
22
- applicationStatus: z.enum(
23
- Object.values(APPLICATION_STATUS) as [
24
- ApplicationStatus,
25
- ...ApplicationStatus[]
26
- ]
27
- ),
40
+ applicationStatus: ApplicationStatusSchema,
41
+ isApplied: z.boolean(),
28
42
  });
29
43
 
44
+ export type MinimalJobApplicationEntity = z.infer<
45
+ typeof MinimalJobApplicationEntitySchema
46
+ >;
47
+
30
48
  export const BaseJobApplicationEntitySchema = z.object({
31
49
  id: z.string(),
32
50
  createdAt: z.coerce.date(),
33
51
  updatedAt: z.coerce.date(),
34
52
  availability: z.enum(JOB_AVAILABILITY_TYPES).optional(),
35
53
  experienceLevel: z.enum(EXPERIENCE_LEVELS).optional(),
36
-
37
54
  jobId: z.string(),
38
55
  applicantId: z.string(),
39
-
40
56
  firstName: z.string().optional(),
41
57
  lastName: z.string().optional(),
42
58
  emailAddress: z.string().optional(),
43
59
  phoneNumber: z.string().nullable(),
44
-
45
60
  currentRole: z.string(),
46
61
  resumeUrl: z.url(),
47
-
62
+ isApplied: z.boolean(),
48
63
  workSampleUrls: z
49
64
  .array(
50
65
  z.object({
51
66
  url: z.url(),
52
67
  name: z.string().optional(),
53
68
  mimeType: z.string().optional(),
54
- })
69
+ }),
55
70
  )
56
71
  .optional(),
57
-
58
72
  zyaProjects: z
59
73
  .array(
60
74
  z.object({
@@ -62,31 +76,27 @@ export const BaseJobApplicationEntitySchema = z.object({
62
76
  projectImgUrl: z.url().optional(),
63
77
  projectId: z.string(),
64
78
  tags: z.array(z.string()).optional(),
65
- })
79
+ }),
66
80
  )
67
81
  .optional(),
68
-
69
- applicationStatus: z.enum(
70
- Object.values(APPLICATION_STATUS) as [
71
- ApplicationStatus,
72
- ...ApplicationStatus[]
73
- ]
74
- ),
75
-
82
+ applicationStatus: ApplicationStatusSchema,
76
83
  linkUrls: z
77
84
  .array(
78
85
  z.object({
79
86
  url: z.url(),
80
87
  isPortfolioUrl: z.boolean().optional(),
81
- })
88
+ }),
82
89
  )
83
90
  .optional(),
84
-
85
91
  coverLetter: z.string().nullable(),
86
92
  receiveEmailUpdates: z.boolean(),
87
93
  wagesAmount: z.number().nullable(),
88
94
  });
89
95
 
96
+ export type BaseJobApplicationEntity = z.infer<
97
+ typeof BaseJobApplicationEntitySchema
98
+ >;
99
+
90
100
  export const JobApplicationEntitySchema = z.object({
91
101
  id: z.string(),
92
102
  firstName: z.string().optional(),
@@ -96,14 +106,7 @@ export const JobApplicationEntitySchema = z.object({
96
106
  emailAddress: z.email().optional(),
97
107
  phoneNumber: z.string().optional(),
98
108
  currentRole: z.string().optional(),
99
- experienceLevel: z
100
- .enum(
101
- Object.values(EXPERIENCE_LEVELS) as [
102
- ExperienceLevel,
103
- ...ExperienceLevel[]
104
- ]
105
- )
106
- .optional(),
109
+ experienceLevel: ExperienceLevelSchema.optional(),
107
110
  resumeUrl: z.url(),
108
111
  workSampleUrls: z
109
112
  .array(
@@ -111,7 +114,7 @@ export const JobApplicationEntitySchema = z.object({
111
114
  url: z.url(),
112
115
  name: z.string().optional(),
113
116
  mimeType: z.string().optional(),
114
- })
117
+ }),
115
118
  )
116
119
  .optional(),
117
120
  zyaProjects: z
@@ -121,34 +124,21 @@ export const JobApplicationEntitySchema = z.object({
121
124
  projectImgUrl: z.url(),
122
125
  projectId: z.cuid2(),
123
126
  tags: z.array(z.string()).optional(),
124
- })
127
+ }),
125
128
  )
126
129
  .optional(),
127
- applicationStatus: z
128
- .enum(
129
- Object.values(APPLICATION_STATUS) as [
130
- ApplicationStatus,
131
- ...ApplicationStatus[]
132
- ]
133
- )
134
- .default("Application Sent"),
130
+ applicationStatus: ApplicationStatusSchema.default("Application Sent"),
135
131
  applicantId: z.cuid2(),
136
132
  linkUrls: z
137
133
  .array(
138
- z.object({ url: z.url(), isPortfolioUrl: z.boolean().default(false) })
134
+ z.object({ url: z.url(), isPortfolioUrl: z.boolean().default(false) }),
139
135
  )
140
136
  .optional(),
141
137
  coverLetter: z.string().optional(),
142
138
  receiveEmailUpdates: z.boolean().optional(),
143
- wagesAmount: z.coerce.number().optional().optional(),
144
- availability: z
145
- .enum(
146
- Object.values(JOB_AVAILABILITY_TYPES) as [
147
- JobAvailabilityTypes,
148
- ...JobAvailabilityTypes[]
149
- ]
150
- )
151
- .optional(),
139
+ wagesAmount: z.coerce.number().optional(),
140
+ availability: JobAvailabilitySchema.optional(),
141
+ isApplied: z.boolean(),
152
142
  createdAt: z.coerce
153
143
  .date()
154
144
  .optional()
@@ -156,6 +146,8 @@ export const JobApplicationEntitySchema = z.object({
156
146
  updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
157
147
  });
158
148
 
149
+ export type JobApplicationEntity = z.infer<typeof JobApplicationEntitySchema>;
150
+
159
151
  export const CreateJobApplicationInputSchema = z.object({
160
152
  jobId: z.cuid2(),
161
153
  applicantId: z.cuid2(),
@@ -165,29 +157,19 @@ export const CreateJobApplicationInputSchema = z.object({
165
157
  emailAddress: z.email().optional(),
166
158
  phoneNumber: z.string().optional(),
167
159
  currentRole: z.string().optional(),
168
- experienceLevel: z
169
- .enum(
170
- Object.values(EXPERIENCE_LEVELS) as [
171
- ExperienceLevel,
172
- ...ExperienceLevel[]
173
- ]
174
- )
175
- .optional(),
176
-
160
+ experienceLevel: ExperienceLevelSchema.optional(),
177
161
  resumeUrl: z.url().optional(),
178
162
  coverLetter: z.string().optional(),
179
-
180
163
  availability: z.enum(JOB_AVAILABILITY_TYPES).optional(),
181
164
  wagesAmount: z.coerce.number().optional(),
182
165
  receiveEmailUpdates: z.boolean().optional(),
183
-
184
166
  workSampleUrls: z
185
167
  .array(
186
168
  z.object({
187
169
  url: z.url(),
188
170
  name: z.string().optional(),
189
171
  mimeType: z.string().optional(),
190
- })
172
+ }),
191
173
  )
192
174
  .optional(),
193
175
  linkUrls: z
@@ -200,46 +182,39 @@ export const CreateJobApplicationInputSchema = z.object({
200
182
  projectId: z.cuid2(),
201
183
  projectImgUrl: z.url(),
202
184
  tags: z.array(z.string()).optional(),
203
- })
185
+ }),
204
186
  )
205
187
  .optional(),
206
188
  });
207
189
 
190
+ export type CreateJobApplicationInput = z.infer<
191
+ typeof CreateJobApplicationInputSchema
192
+ >;
193
+
208
194
  export const TrackedJobApplicationEntitySchema = z.object({
209
195
  id: z.cuid2(),
210
196
  createdAt: z.coerce.date(),
211
- applicationStatus: z.enum(
212
- Object.values(APPLICATION_STATUS) as [
213
- ApplicationStatus,
214
- ...ApplicationStatus[]
215
- ]
216
- ),
197
+ applicationStatus: ApplicationStatusSchema,
217
198
  job: NormalizedJobSchema,
218
199
  });
219
200
 
201
+ export type TrackedJobApplicationEntity = z.infer<
202
+ typeof TrackedJobApplicationEntitySchema
203
+ >;
204
+
220
205
  export const UpdateJobApplicationInputSchema =
221
206
  CreateJobApplicationInputSchema.partial().extend({
222
207
  id: z.cuid2(),
223
- applicationStatus: z
224
- .enum(
225
- Object.values(APPLICATION_STATUS) as [
226
- ApplicationStatus,
227
- ...ApplicationStatus[]
228
- ]
229
- )
230
- .optional(),
208
+ applicationStatus: ApplicationStatusSchema.optional(),
231
209
  });
232
210
 
211
+ export type UpdateJobApplicationInput = z.infer<
212
+ typeof UpdateJobApplicationInputSchema
213
+ >;
214
+
233
215
  export const GetTrackedJobApplicationsInputSchema = z.object({
234
216
  query: z.string().optional(),
235
- status: z
236
- .enum(
237
- Object.values(APPLICATION_STATUS) as [
238
- ApplicationStatus,
239
- ...ApplicationStatus[]
240
- ]
241
- )
242
- .optional(),
217
+ status: ApplicationStatusSchema.optional(),
243
218
  jobType: z
244
219
  .enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
245
220
  .optional(),
@@ -247,6 +222,10 @@ export const GetTrackedJobApplicationsInputSchema = z.object({
247
222
  limit: z.coerce.number().min(1).max(100).default(20),
248
223
  });
249
224
 
225
+ export type GetTrackedJobApplicationsInput = z.infer<
226
+ typeof GetTrackedJobApplicationsInputSchema
227
+ >;
228
+
250
229
  export const GetTrackedJobApplicationsOutputSchema = z.object({
251
230
  applications: z.array(TrackedJobApplicationEntitySchema),
252
231
  total: z.number(),
@@ -255,3 +234,7 @@ export const GetTrackedJobApplicationsOutputSchema = z.object({
255
234
  hasNextPage: z.boolean(),
256
235
  hasPrevPage: z.boolean(),
257
236
  });
237
+
238
+ export type GetTrackedJobApplicationsOutput = z.infer<
239
+ typeof GetTrackedJobApplicationsOutputSchema
240
+ >;
@@ -92,23 +92,49 @@ export const UpdateProjectInputSchema = z
92
92
  .object({
93
93
  id: z.cuid2(),
94
94
  title: z.string().optional(),
95
- description: z.string().optional(),
95
+ description: z
96
+ .string()
97
+ .min(10, "Add a bit more detail to your description.")
98
+ .optional(),
96
99
  overview: z.string().optional(),
97
- url: z.url().or(z.literal("")).optional(),
100
+ url: z
101
+ .string()
102
+ .transform((val) => {
103
+ if (!val) return val;
104
+ if (val.startsWith("http://") || val.startsWith("https://")) return val;
105
+ return `https://${val}`;
106
+ })
107
+ .pipe(z.string().url("Check your link.").or(z.literal("")))
108
+ .optional(),
98
109
  imagePlaceholderUrl: z.url().optional(),
99
110
  tags: z.array(z.string()).optional(),
100
111
  projectCreatorType: z.enum(ROLES).optional(),
101
- clientId: z.cuid2().optional(),
112
+ clientId: z
113
+ .string()
114
+ .transform((val) => (val === "" ? undefined : val))
115
+ .pipe(z.string().cuid2().optional()),
102
116
  clientType: z.enum(CLIENT_TYPES).optional(),
103
117
  clientName: z.string().optional(),
104
118
  isFeatured: z.boolean().optional(),
105
119
  status: z.enum(PROJECT_STATUS).optional(),
106
- problemBeingSolved: z.string().max(600).optional(),
107
- whoItsFor: z.string().max(600).optional(),
120
+ problemBeingSolved: z
121
+ .string()
122
+ .min(20, "Describe the problem you're solving.")
123
+ .max(600)
124
+ .optional(),
125
+ whoItsFor: z
126
+ .string()
127
+ .min(5, "Tell us who this is for.")
128
+ .max(600)
129
+ .optional(),
108
130
  ventureStage: z.enum(VENTURE_STAGES).optional(),
109
131
  capitalLookingToRaise: z.number().optional(),
110
132
  capitalLookingToRaiseCurrency: z.enum(WAGES_CURRENCY).optional(),
111
- currentTraction: z.string().max(600).optional(),
133
+ currentTraction: z
134
+ .string()
135
+ .min(10, "Share your current traction.")
136
+ .max(600)
137
+ .optional(),
112
138
  isOpenToInvestment: z.boolean().default(false),
113
139
  startDate: z.coerce.date().optional(),
114
140
  endDate: z.coerce.date().optional(),
@@ -121,19 +147,19 @@ export const UpdateProjectInputSchema = z
121
147
  ctx.addIssue({
122
148
  path: ["startDate"],
123
149
  code: "custom",
124
- message: "Start date cannot be in the future",
150
+ message: "Start date cannot be in the future.",
125
151
  });
126
152
  }
127
153
  if (startDate && endDate && startDate > endDate) {
128
154
  ctx.addIssue({
129
- path: ["startDate"],
155
+ path: ["endDate"],
130
156
  code: "custom",
131
- message: "Start date cannot be after end date",
157
+ message: "End date must follow the start date.",
132
158
  });
133
159
  }
134
160
  })
135
161
  .openapi("UpdateProjectInput");
136
-
162
+
137
163
  export type UpdateProjectInput = z.infer<typeof UpdateProjectInputSchema>;
138
164
 
139
165
  export const CommentOnProjectInputSchema = CommentEntitySchema;
@@ -8,7 +8,6 @@ export * from "./username";
8
8
  export * from "./entity-stats";
9
9
  export * from "./feed";
10
10
  export * from "./activity";
11
- export * from "./job-application";
12
11
  export * from "./message";
13
12
  export * from "./chat";
14
13
  export * from "./job";
@@ -1,41 +0,0 @@
1
- import z from "zod";
2
- import {
3
- JobApplicationEntitySchema,
4
- CreateJobApplicationInputSchema,
5
- UpdateJobApplicationInputSchema,
6
- MinimalJobApplicationEntitySchema,
7
- BaseJobApplicationEntitySchema,
8
- TrackedJobApplicationEntitySchema,
9
- GetTrackedJobApplicationsInputSchema,
10
- GetTrackedJobApplicationsOutputSchema,
11
- } from "../schemas/job-application";
12
-
13
- export type CreateJobApplicationInput = z.infer<
14
- typeof CreateJobApplicationInputSchema
15
- >;
16
-
17
- export type UpdateJobApplicationInput = z.infer<
18
- typeof UpdateJobApplicationInputSchema
19
- >;
20
-
21
- export type JobApplicationEntity = z.infer<typeof JobApplicationEntitySchema>;
22
-
23
- export type MinimalJobApplicationEntity = z.infer<
24
- typeof MinimalJobApplicationEntitySchema
25
- >;
26
-
27
- export type BaseJobApplicationEntity = z.infer<
28
- typeof BaseJobApplicationEntitySchema
29
- >;
30
-
31
- export type TrackedJobApplicationEntity = z.infer<
32
- typeof TrackedJobApplicationEntitySchema
33
- >;
34
-
35
- export type GetTrackedJobApplicationsInput = z.infer<
36
- typeof GetTrackedJobApplicationsInputSchema
37
- >;
38
-
39
- export type GetTrackedJobApplicationsOutput = z.infer<
40
- typeof GetTrackedJobApplicationsOutputSchema
41
- >;