@zyacreatives/shared 2.5.69 → 2.5.71

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,37 +1,30 @@
1
1
  "use strict";
2
+ // job.schemas.ts
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetCreatedJobsOutputSchema = exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema = exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema = exports.BaseJobEntitySchema = exports.JobIdSchema = exports.JobSearchDocumentSchema = exports.GetJobsOutputSchema = exports.GetJobsInputSchema = exports.UpdateJobInputSchema = exports.CreateJobInputSchema = exports.NormalizedJobSchema = exports.JobWithRoleDetailsEntitySchema = exports.JobWithGigDetailsEntitySchema = exports.RoleJobEntitySchema = exports.GigJobEntitySchema = exports.RoleDetailsSchema = exports.GigDetailsSchema = exports.JobEntitySchema = exports.JobShape = exports.JobSectionSchema = exports.WageTypeSchema = exports.WageCurrencySchema = exports.ExperienceLevelSchema = exports.JobLocationSchema = exports.GigTypeSchema = exports.JobStatusSchema = exports.WorkModeSchema = exports.EmploymentTypeSchema = exports.JobTypeSchema = void 0;
4
+ exports.JobSearchDocumentSchema = exports.GetCreatedJobsOutputSchema = exports.GetJobsOutputSchema = exports.GetJobsInputSchema = exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema = exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema = exports.UpdateJobInputSchema = exports.CreateJobInputSchema = exports.JobIdSchema = exports.NormalizedJobSchema = exports.JobWithRoleDetailsEntitySchema = exports.JobWithGigDetailsEntitySchema = exports.RoleJobEntitySchema = exports.GigJobEntitySchema = exports.RoleDetailsSchema = exports.GigDetailsSchema = exports.BaseJobEntitySchema = exports.JobEntitySchema = exports.JobShape = exports.JobCleanupSchema = void 0;
4
5
  const zod_openapi_1 = require("@hono/zod-openapi");
5
6
  const constants_1 = require("../constants");
6
- /**
7
- * --------------------------------
8
- * ENUMS
9
- * --------------------------------
10
- */
11
- exports.JobTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_TYPE));
12
- exports.EmploymentTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.EMPLOYMENT_TYPE));
13
- exports.WorkModeSchema = zod_openapi_1.z.enum(Object.values(constants_1.WORK_MODE));
14
- exports.JobStatusSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_STATUS));
15
- exports.GigTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.GIG_TYPE));
16
- exports.JobLocationSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_LOCATIONS));
17
- exports.ExperienceLevelSchema = zod_openapi_1.z.enum(Object.values(constants_1.EXPERIENCE_LEVELS));
18
- exports.WageCurrencySchema = zod_openapi_1.z.enum(Object.values(constants_1.WAGES_CURRENCY));
19
- exports.WageTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.WAGE_TYPES));
20
- exports.JobSectionSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_SECTIONS));
21
7
  /**
22
8
  * --------------------------------
23
9
  * SHAPE
24
10
  * --------------------------------
25
11
  */
12
+ exports.JobCleanupSchema = zod_openapi_1.z.object({
13
+ maxApplications: zod_openapi_1.z.number().int().positive().nullable().optional(),
14
+ maxHires: zod_openapi_1.z.number().int().positive().nullable().optional(),
15
+ applicationDeadline: zod_openapi_1.z.iso.datetime().nullable().optional(),
16
+ autoArchiveWhenFilled: zod_openapi_1.z.boolean().default(true).optional(),
17
+ });
26
18
  exports.JobShape = zod_openapi_1.z.object({
27
19
  title: zod_openapi_1.z.string().min(3).max(255),
28
20
  brandId: zod_openapi_1.z.cuid2(),
29
- jobType: exports.JobTypeSchema,
30
- employmentType: exports.EmploymentTypeSchema.optional(),
31
- workMode: exports.WorkModeSchema,
32
- gigType: exports.GigTypeSchema.optional(),
33
- location: exports.JobLocationSchema,
34
- jobSections: zod_openapi_1.z.array(exports.JobSectionSchema),
21
+ jobType: zod_openapi_1.z.enum(constants_1.JOB_TYPE),
22
+ employmentType: zod_openapi_1.z.enum(constants_1.EMPLOYMENT_TYPE).optional(),
23
+ workMode: zod_openapi_1.z.enum(constants_1.WORK_MODE),
24
+ gigType: zod_openapi_1.z.enum(constants_1.GIG_TYPE).optional(),
25
+ location: zod_openapi_1.z.enum(constants_1.JOB_LOCATIONS),
26
+ jobSections: zod_openapi_1.z.array(zod_openapi_1.z.enum(constants_1.JOB_SECTIONS)),
27
+ ...exports.JobCleanupSchema.shape,
35
28
  });
36
29
  /**
37
30
  * --------------------------------
@@ -42,7 +35,7 @@ exports.JobEntitySchema = zod_openapi_1.z
42
35
  .object({
43
36
  id: zod_openapi_1.z.cuid2(),
44
37
  ...exports.JobShape.shape,
45
- status: exports.JobStatusSchema,
38
+ status: zod_openapi_1.z.enum(constants_1.JOB_STATUS),
46
39
  brandName: zod_openapi_1.z.string(),
47
40
  brandImgUrl: zod_openapi_1.z.string().nullable().optional(),
48
41
  isApplied: zod_openapi_1.z.boolean().default(false),
@@ -52,6 +45,7 @@ exports.JobEntitySchema = zod_openapi_1.z
52
45
  version: zod_openapi_1.z.int(),
53
46
  })
54
47
  .openapi("Job");
48
+ exports.BaseJobEntitySchema = exports.JobEntitySchema;
55
49
  /**
56
50
  * --------------------------------
57
51
  * ROLE / GIG DETAILS
@@ -65,11 +59,11 @@ exports.GigDetailsSchema = zod_openapi_1.z.object({
65
59
  requiredSkills: zod_openapi_1.z.array(zod_openapi_1.z.string()),
66
60
  wagesMin: zod_openapi_1.z.number().nullable().optional(),
67
61
  wagesMax: zod_openapi_1.z.number().nullable().optional(),
68
- wagesCurrency: exports.WageCurrencySchema.optional(),
69
- wagesType: exports.WageTypeSchema.optional(),
62
+ wagesCurrency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY).optional(),
63
+ wagesType: zod_openapi_1.z.enum(constants_1.WAGE_TYPES).optional(),
70
64
  });
71
65
  exports.RoleDetailsSchema = zod_openapi_1.z.object({
72
- experienceLevel: exports.ExperienceLevelSchema,
66
+ experienceLevel: zod_openapi_1.z.enum(constants_1.EXPERIENCE_LEVELS),
73
67
  overview: zod_openapi_1.z.string(),
74
68
  keyResponsibilities: zod_openapi_1.z.string(),
75
69
  requiredSkills: zod_openapi_1.z.array(zod_openapi_1.z.string()),
@@ -77,8 +71,8 @@ exports.RoleDetailsSchema = zod_openapi_1.z.object({
77
71
  companyBenefits: zod_openapi_1.z.string().optional(),
78
72
  wagesMin: zod_openapi_1.z.number().nullable().optional(),
79
73
  wagesMax: zod_openapi_1.z.number().nullable().optional(),
80
- wagesCurrency: exports.WageCurrencySchema.optional(),
81
- wagesType: exports.WageTypeSchema.optional(),
74
+ wagesCurrency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY).optional(),
75
+ wagesType: zod_openapi_1.z.enum(constants_1.WAGE_TYPES).optional(),
82
76
  });
83
77
  /**
84
78
  * --------------------------------
@@ -87,14 +81,14 @@ exports.RoleDetailsSchema = zod_openapi_1.z.object({
87
81
  */
88
82
  exports.GigJobEntitySchema = exports.JobEntitySchema.extend({
89
83
  jobType: zod_openapi_1.z.literal(constants_1.JOB_TYPE.GIG),
90
- gigType: exports.GigTypeSchema,
91
- employmentType: exports.EmploymentTypeSchema.optional(),
84
+ gigType: zod_openapi_1.z.enum(constants_1.GIG_TYPE),
85
+ employmentType: zod_openapi_1.z.enum(constants_1.EMPLOYMENT_TYPE).optional(),
92
86
  ...exports.GigDetailsSchema.shape,
93
87
  }).openapi("GigJob");
94
88
  exports.RoleJobEntitySchema = exports.JobEntitySchema.extend({
95
89
  jobType: zod_openapi_1.z.literal(constants_1.JOB_TYPE.ROLE),
96
- employmentType: exports.EmploymentTypeSchema,
97
- gigType: exports.GigTypeSchema.optional(),
90
+ employmentType: zod_openapi_1.z.enum(constants_1.EMPLOYMENT_TYPE),
91
+ gigType: zod_openapi_1.z.enum(constants_1.GIG_TYPE).optional(),
98
92
  ...exports.RoleDetailsSchema.shape,
99
93
  }).openapi("RoleJob");
100
94
  /**
@@ -104,10 +98,6 @@ exports.JobWithGigDetailsEntitySchema = exports.GigJobEntitySchema;
104
98
  exports.JobWithRoleDetailsEntitySchema = exports.RoleJobEntitySchema;
105
99
  /**
106
100
  * Keep this as a regular union.
107
- *
108
- * Do not use discriminatedUnion here because JobEntitySchema has jobType as
109
- * "GIG" | "ROLE", while GigJobEntitySchema and RoleJobEntitySchema use
110
- * literals. That makes the discriminator ambiguous.
111
101
  */
112
102
  exports.NormalizedJobSchema = zod_openapi_1.z.union([
113
103
  exports.GigJobEntitySchema,
@@ -119,6 +109,9 @@ exports.NormalizedJobSchema = zod_openapi_1.z.union([
119
109
  * INPUTS
120
110
  * --------------------------------
121
111
  */
112
+ exports.JobIdSchema = zod_openapi_1.z.object({
113
+ jobId: zod_openapi_1.z.cuid2().openapi({ param: { name: "jobId", in: "path" } }),
114
+ });
122
115
  exports.CreateJobInputSchema = exports.JobShape.superRefine((data, ctx) => {
123
116
  if (data.jobType === constants_1.JOB_TYPE.ROLE && !data.employmentType) {
124
117
  ctx.addIssue({
@@ -137,12 +130,26 @@ exports.CreateJobInputSchema = exports.JobShape.superRefine((data, ctx) => {
137
130
  });
138
131
  exports.UpdateJobInputSchema = exports.CreateJobInputSchema.partial().extend({
139
132
  id: zod_openapi_1.z.cuid2(),
140
- status: exports.JobStatusSchema.optional(),
133
+ status: zod_openapi_1.z.enum(constants_1.JOB_STATUS).optional(),
141
134
  version: zod_openapi_1.z.int(),
142
135
  });
136
+ exports.CreateGigJobInputSchema = exports.GigDetailsSchema.extend({
137
+ id: zod_openapi_1.z.cuid2(),
138
+ });
139
+ exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial().extend({
140
+ id: zod_openapi_1.z.cuid2(),
141
+ version: zod_openapi_1.z.int().default(1),
142
+ });
143
+ exports.CreateRoleJobInputSchema = exports.RoleDetailsSchema.extend({
144
+ id: zod_openapi_1.z.cuid2(),
145
+ });
146
+ exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema.partial().extend({
147
+ id: zod_openapi_1.z.cuid2(),
148
+ version: zod_openapi_1.z.int().default(1),
149
+ });
143
150
  exports.GetJobsInputSchema = zod_openapi_1.z.object({
144
151
  q: zod_openapi_1.z.string().optional(),
145
- jobType: exports.JobTypeSchema.optional(),
152
+ jobType: zod_openapi_1.z.enum(constants_1.JOB_TYPE).optional(),
146
153
  page: zod_openapi_1.z.coerce.number().min(1).default(1),
147
154
  limit: zod_openapi_1.z.coerce.number().min(1).max(100).default(20),
148
155
  });
@@ -160,6 +167,12 @@ exports.GetJobsOutputSchema = zod_openapi_1.z.object({
160
167
  hasNextPage: zod_openapi_1.z.boolean(),
161
168
  hasPrevPage: zod_openapi_1.z.boolean(),
162
169
  });
170
+ exports.GetCreatedJobsOutputSchema = zod_openapi_1.z.object({
171
+ jobs: zod_openapi_1.z.array(exports.NormalizedJobSchema),
172
+ noOfJobs: zod_openapi_1.z.number(),
173
+ noOfArchivedJobs: zod_openapi_1.z.number(),
174
+ noOfActiveJobs: zod_openapi_1.z.number(),
175
+ });
163
176
  /**
164
177
  * --------------------------------
165
178
  * SEARCH DOCUMENT
@@ -173,43 +186,19 @@ exports.JobSearchDocumentSchema = zod_openapi_1.z
173
186
  brandId: zod_openapi_1.z.cuid2(),
174
187
  brandName: zod_openapi_1.z.string(),
175
188
  brandImgUrl: zod_openapi_1.z.string().nullable().optional(),
176
- jobType: zod_openapi_1.z.enum(["GIG", "ROLE"]),
177
- status: zod_openapi_1.z.string().optional(),
178
- employmentType: zod_openapi_1.z.string().nullable().optional(),
179
- workMode: zod_openapi_1.z.string(),
180
- gigType: zod_openapi_1.z.string().nullable().optional(),
181
- location: zod_openapi_1.z.string(),
189
+ jobType: zod_openapi_1.z.enum(constants_1.JOB_TYPE),
190
+ status: zod_openapi_1.z.enum(constants_1.JOB_STATUS).optional(),
191
+ employmentType: zod_openapi_1.z.enum(constants_1.EMPLOYMENT_TYPE).nullable().optional(),
192
+ workMode: zod_openapi_1.z.enum(constants_1.WORK_MODE),
193
+ gigType: zod_openapi_1.z.enum(constants_1.GIG_TYPE).nullable().optional(),
194
+ location: zod_openapi_1.z.enum(constants_1.JOB_LOCATIONS),
182
195
  overview: zod_openapi_1.z.string(),
183
196
  requiredSkills: zod_openapi_1.z.array(zod_openapi_1.z.string()),
184
197
  wagesMin: zod_openapi_1.z.number().nullable().optional(),
185
198
  wagesMax: zod_openapi_1.z.number().nullable().optional(),
186
- wagesCurrency: zod_openapi_1.z.string().nullable().optional(),
187
- wagesType: zod_openapi_1.z.string().nullable().optional(),
199
+ wagesCurrency: zod_openapi_1.z.enum(constants_1.WAGES_CURRENCY).nullable().optional(),
200
+ wagesType: zod_openapi_1.z.enum(constants_1.WAGE_TYPES).nullable().optional(),
188
201
  createdAt: zod_openapi_1.z.string(),
189
202
  updatedAt: zod_openapi_1.z.string(),
190
203
  })
191
204
  .openapi("JobSearchDocument");
192
- exports.JobIdSchema = zod_openapi_1.z.object({
193
- jobId: zod_openapi_1.z.cuid2().openapi({ param: { name: "jobId", in: "path" } }),
194
- });
195
- exports.BaseJobEntitySchema = exports.JobEntitySchema;
196
- exports.CreateGigJobInputSchema = exports.GigDetailsSchema.extend({
197
- id: zod_openapi_1.z.cuid2(),
198
- });
199
- exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial().extend({
200
- id: zod_openapi_1.z.cuid2(),
201
- version: zod_openapi_1.z.int().default(1),
202
- });
203
- exports.CreateRoleJobInputSchema = exports.RoleDetailsSchema.extend({
204
- id: zod_openapi_1.z.cuid2(),
205
- });
206
- exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema.partial().extend({
207
- id: zod_openapi_1.z.cuid2(),
208
- version: zod_openapi_1.z.int().default(1),
209
- });
210
- exports.GetCreatedJobsOutputSchema = zod_openapi_1.z.object({
211
- jobs: zod_openapi_1.z.array(exports.NormalizedJobSchema),
212
- noOfJobs: zod_openapi_1.z.number(),
213
- noOfArchivedJobs: zod_openapi_1.z.number(),
214
- noOfActiveJobs: zod_openapi_1.z.number(),
215
- });
@@ -509,20 +509,67 @@ export declare const UserWithJobBookmarksEntitySchema: z.ZodObject<{
509
509
  brandName: z.ZodString;
510
510
  brandImgUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
511
511
  jobType: z.ZodEnum<{
512
- GIG: "GIG";
513
- ROLE: "ROLE";
512
+ readonly GIG: "GIG";
513
+ readonly ROLE: "ROLE";
514
+ }>;
515
+ status: z.ZodOptional<z.ZodEnum<{
516
+ readonly ACTIVE: "ACTIVE";
517
+ readonly DRAFT: "DRAFT";
518
+ readonly ARCHIVED: "ARCHIVED";
519
+ readonly DELETED: "DELETED";
520
+ }>>;
521
+ employmentType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
522
+ readonly FULL_TIME: "Full Time";
523
+ readonly PART_TIME: "Part Time";
524
+ readonly FREELANCE: "Freelance";
525
+ readonly INTERNSHIP: "Internship";
526
+ }>>>;
527
+ workMode: z.ZodEnum<{
528
+ readonly REMOTE: "Remote";
529
+ readonly HYBRID: "Hybrid";
530
+ readonly ON_SITE: "On Site";
531
+ }>;
532
+ gigType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
533
+ readonly ONE_TIME: "One Time";
534
+ readonly RECURRING: "Recurring";
535
+ }>>>;
536
+ location: z.ZodEnum<{
537
+ readonly AFRICA: "Africa";
538
+ readonly REMOTE: "Remote";
539
+ readonly EUROPE: "Europe";
540
+ readonly ASIA: "Asia";
541
+ readonly NORTH_AMERICA: "North America";
542
+ readonly SOUTH_AMERICA: "South America";
543
+ readonly MIDDLE_EAST: "Middle East";
544
+ readonly OCEANIA: "Oceania";
545
+ readonly EMEA: "EMEA";
546
+ readonly ASIA_PACIFIC: "Asia Pacific";
547
+ readonly GLOBAL: "Global";
548
+ readonly OTHER: "Other";
514
549
  }>;
515
- status: z.ZodOptional<z.ZodString>;
516
- employmentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
517
- workMode: z.ZodString;
518
- gigType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
519
- location: z.ZodString;
520
550
  overview: z.ZodString;
521
551
  requiredSkills: z.ZodArray<z.ZodString>;
522
552
  wagesMin: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
523
553
  wagesMax: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
524
- wagesCurrency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
525
- wagesType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
554
+ wagesCurrency: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
555
+ readonly USD: "USD (United States Dollar)";
556
+ readonly EUR: "EUR (Euro)";
557
+ readonly GBP: "GBP (British Pound Sterling)";
558
+ readonly NGN: "NGN (Nigerian Naira)";
559
+ readonly CAD: "CAD (Canadian Dollar)";
560
+ readonly AUD: "AUD (Australian Dollar)";
561
+ readonly JPY: "JPY (Japanese Yen)";
562
+ readonly CHF: "CHF (Swiss Franc)";
563
+ readonly INR: "INR (Indian Rupee)";
564
+ readonly ZAR: "ZAR (South African Rand)";
565
+ }>>>;
566
+ wagesType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
567
+ readonly HOURLY: "Hourly";
568
+ readonly DAILY: "Daily";
569
+ readonly WEEKLY: "Weekly";
570
+ readonly MONTHLY: "Monthly";
571
+ readonly PROJECT_BASED: "Project Based";
572
+ }>>>;
526
573
  createdAt: z.ZodString;
527
574
  updatedAt: z.ZodString;
528
575
  isBookmarked: z.ZodDefault<z.ZodBoolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.5.69",
3
+ "version": "2.5.71",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -117,3 +117,18 @@ export const GetMessageRequestsForUserOutputSchema =
117
117
  export type GetMessageRequestsForUserOutput = z.infer<
118
118
  typeof GetMessageRequestsForUserOutputSchema
119
119
  >;
120
+
121
+ export const ReportChatInputSchema = z.object({
122
+ complaint: z.string().trim().min(10).max(1000),
123
+ messageId: z.cuid2().optional(),
124
+ });
125
+
126
+ export type ReportChatInput = z.infer<typeof ReportChatInputSchema>
127
+
128
+ export const ReportChatOutputSchema = z.object({
129
+ reported: z.boolean(),
130
+ chatId: z.string(),
131
+ messageId: z.string().nullable(),
132
+ });
133
+
134
+ export type ReportChatOutput = z.infer<typeof ReportChatOutputSchema>
@@ -1,51 +1,25 @@
1
+ // job-application.schemas.ts
2
+
1
3
  import { z } from "@hono/zod-openapi";
2
4
 
3
5
  import {
4
6
  APPLICATION_STATUS,
5
- ApplicationStatus,
6
7
  EXPERIENCE_LEVELS,
7
- ExperienceLevel,
8
8
  JOB_AVAILABILITY_TYPES,
9
9
  JOB_SECTIONS,
10
10
  JOB_TYPE,
11
- JobAvailabilityTypes,
12
- JobType,
13
11
  } from "../constants";
14
12
 
15
13
  import { NormalizedJobSchema } from "./job";
16
14
  import { MinimalUserSchema } from "./minimal-user";
17
15
 
18
- /**
19
- * --------------------------------
20
- * ENUMS
21
- * --------------------------------
22
- */
23
-
24
- const ApplicationStatusSchema = z.enum(
25
- Object.values(APPLICATION_STATUS) as [
26
- ApplicationStatus,
27
- ...ApplicationStatus[],
28
- ],
29
- );
30
-
31
- const ExperienceLevelSchema = z.enum(
32
- Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]],
33
- );
34
-
35
- const JobAvailabilitySchema = z.enum(
36
- Object.values(JOB_AVAILABILITY_TYPES) as [
37
- JobAvailabilityTypes,
38
- ...JobAvailabilityTypes[],
39
- ],
40
- );
41
-
42
16
  /**
43
17
  * --------------------------------
44
18
  * SHAPE
45
19
  * --------------------------------
46
20
  */
47
21
 
48
- const JobApplicationShape = z.object({
22
+ export const JobApplicationShape = z.object({
49
23
  jobId: z.cuid2(),
50
24
  firstName: z.string().optional(),
51
25
  lastName: z.string().optional(),
@@ -53,8 +27,8 @@ const JobApplicationShape = z.object({
53
27
  phoneNumber: z.string().nullable(),
54
28
  currentRole: z.string(),
55
29
  resumeUrl: z.url(),
56
- experienceLevel: ExperienceLevelSchema.optional(),
57
- availability: JobAvailabilitySchema.optional(),
30
+ experienceLevel: z.enum(EXPERIENCE_LEVELS).optional(),
31
+ availability: z.enum(JOB_AVAILABILITY_TYPES).optional(),
58
32
  coverLetter: z.string().nullable(),
59
33
  receiveEmailUpdates: z.boolean(),
60
34
  wagesAmount: z.number().nullable(),
@@ -92,6 +66,33 @@ const JobApplicationShape = z.object({
92
66
 
93
67
  export type JobApplicationShapeType = z.infer<typeof JobApplicationShape>;
94
68
 
69
+ /**
70
+ * --------------------------------
71
+ * RESPONSE / OFFER / STATUS TRACKING
72
+ * --------------------------------
73
+ */
74
+
75
+ export const JobApplicationResponseSchema = z.object({
76
+ brandResponseMessage: z.string().max(3000).nullable().optional(),
77
+ meetingLink: z.url().nullable().optional(),
78
+
79
+ offerAcceptedAt: z.iso.datetime().nullable().optional(),
80
+ offerDeclinedAt: z.iso.datetime().nullable().optional(),
81
+ hiredAt: z.iso.datetime().nullable().optional(),
82
+ rejectedAt: z.iso.datetime().nullable().optional(),
83
+
84
+ lastStatusChangedAt: z.iso.datetime().nullable().optional(),
85
+ lastStatusViewedByApplicantAt: z.iso.datetime().nullable().optional(),
86
+ lastStatusViewedByBrandAt: z.iso.datetime().nullable().optional(),
87
+ lastUpdatedByUserId: z.cuid2().nullable().optional(),
88
+
89
+ hasUnreadStatusUpdate: z.boolean().default(false).optional(),
90
+ });
91
+
92
+ export type JobApplicationResponse = z.infer<
93
+ typeof JobApplicationResponseSchema
94
+ >;
95
+
95
96
  /**
96
97
  * --------------------------------
97
98
  * BASE ENTITY
@@ -105,8 +106,9 @@ export const JobApplicationEntitySchema = z
105
106
  user: MinimalUserSchema,
106
107
 
107
108
  ...JobApplicationShape.shape,
109
+ ...JobApplicationResponseSchema.shape,
108
110
 
109
- applicationStatus: ApplicationStatusSchema,
111
+ applicationStatus: z.enum(APPLICATION_STATUS),
110
112
 
111
113
  createdAt: z.iso.datetime(),
112
114
  updatedAt: z.iso.datetime(),
@@ -115,6 +117,14 @@ export const JobApplicationEntitySchema = z
115
117
 
116
118
  export type JobApplicationEntity = z.infer<typeof JobApplicationEntitySchema>;
117
119
 
120
+ export const BaseJobApplicationEntitySchema = JobApplicationEntitySchema.omit({
121
+ user: true,
122
+ });
123
+
124
+ export type BaseJobApplicationEntity = z.infer<
125
+ typeof BaseJobApplicationEntitySchema
126
+ >;
127
+
118
128
  /**
119
129
  * --------------------------------
120
130
  * DERIVED ENTITIES
@@ -125,8 +135,18 @@ export const MinimalJobApplicationEntitySchema = z.object({
125
135
  id: z.cuid2(),
126
136
  jobId: z.cuid2(),
127
137
  user: MinimalUserSchema,
128
- coverLetter: z.string(),
129
- applicationStatus: ApplicationStatusSchema,
138
+ coverLetter: z.string().nullable(),
139
+ applicationStatus: z.enum(APPLICATION_STATUS),
140
+
141
+ brandResponseMessage: z.string().nullable().optional(),
142
+ meetingLink: z.url().nullable().optional(),
143
+
144
+ offerAcceptedAt: z.iso.datetime().nullable().optional(),
145
+ offerDeclinedAt: z.iso.datetime().nullable().optional(),
146
+
147
+ lastStatusChangedAt: z.iso.datetime().nullable().optional(),
148
+ hasUnreadStatusUpdate: z.boolean().default(false).optional(),
149
+
130
150
  createdAt: z.iso.datetime(),
131
151
  });
132
152
 
@@ -136,8 +156,20 @@ export type MinimalJobApplicationEntity = z.infer<
136
156
 
137
157
  export const TrackedJobApplicationEntitySchema = z.object({
138
158
  id: z.cuid2(),
139
- applicationStatus: ApplicationStatusSchema,
159
+ applicationStatus: z.enum(APPLICATION_STATUS),
160
+
161
+ brandResponseMessage: z.string().nullable().optional(),
162
+ meetingLink: z.url().nullable().optional(),
163
+
164
+ offerAcceptedAt: z.iso.datetime().nullable().optional(),
165
+ offerDeclinedAt: z.iso.datetime().nullable().optional(),
166
+
167
+ lastStatusChangedAt: z.iso.datetime().nullable().optional(),
168
+ hasUnreadStatusUpdate: z.boolean().default(false).optional(),
169
+
140
170
  createdAt: z.iso.datetime(),
171
+ updatedAt: z.iso.datetime().optional(),
172
+
141
173
  job: NormalizedJobSchema,
142
174
  });
143
175
 
@@ -151,6 +183,12 @@ export type TrackedJobApplicationEntity = z.infer<
151
183
  * --------------------------------
152
184
  */
153
185
 
186
+ export const ApplicationIdInputSchema = z.object({
187
+ id: z.cuid2(),
188
+ });
189
+
190
+ export type ApplicationIdInput = z.infer<typeof ApplicationIdInputSchema>;
191
+
154
192
  export const CreateJobApplicationInputSchema = JobApplicationShape.extend({
155
193
  jobSections: z.array(z.enum(JOB_SECTIONS)).optional(),
156
194
  });
@@ -162,7 +200,17 @@ export type CreateJobApplicationInput = z.infer<
162
200
  export const UpdateJobApplicationInputSchema =
163
201
  CreateJobApplicationInputSchema.partial().extend({
164
202
  id: z.cuid2(),
165
- applicationStatus: ApplicationStatusSchema.optional(),
203
+
204
+ applicationStatus: z.enum(APPLICATION_STATUS).optional(),
205
+
206
+ brandResponseMessage: z.string().max(3000).nullable().optional(),
207
+ meetingLink: z.url().nullable().optional(),
208
+
209
+ offerAcceptedAt: z.iso.datetime().nullable().optional(),
210
+ offerDeclinedAt: z.iso.datetime().nullable().optional(),
211
+
212
+ lastStatusViewedByApplicantAt: z.iso.datetime().nullable().optional(),
213
+ lastStatusViewedByBrandAt: z.iso.datetime().nullable().optional(),
166
214
  });
167
215
 
168
216
  export type UpdateJobApplicationInput = z.infer<
@@ -171,10 +219,8 @@ export type UpdateJobApplicationInput = z.infer<
171
219
 
172
220
  export const GetTrackedJobApplicationsInputSchema = z.object({
173
221
  query: z.string().optional(),
174
- status: ApplicationStatusSchema.optional(),
175
- jobType: z
176
- .enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
177
- .optional(),
222
+ status: z.enum(APPLICATION_STATUS).optional(),
223
+ jobType: z.enum(JOB_TYPE).optional(),
178
224
  page: z.coerce.number().min(1).default(1),
179
225
  limit: z.coerce.number().min(1).max(100).default(20),
180
226
  });
@@ -202,10 +248,18 @@ export type GetTrackedJobApplicationsOutput = z.infer<
202
248
  typeof GetTrackedJobApplicationsOutputSchema
203
249
  >;
204
250
 
205
- export const BaseJobApplicationEntitySchema = JobApplicationEntitySchema.omit({
206
- user: true,
251
+ export const GetApplicationStatusUpdatesCountOutputSchema = z.object({
252
+ unreadCount: z.number(),
207
253
  });
208
254
 
209
- export type BaseJobApplicationEntity = z.infer<
210
- typeof BaseJobApplicationEntitySchema
255
+ export type GetApplicationStatusUpdatesCountOutput = z.infer<
256
+ typeof GetApplicationStatusUpdatesCountOutputSchema
211
257
  >;
258
+
259
+ export const GetBrandUnansweredApplicationsOutputSchema = z.object({
260
+ unansweredCount: z.number(),
261
+ });
262
+
263
+ export type GetBrandUnansweredApplicationsOutput = z.infer<
264
+ typeof GetBrandUnansweredApplicationsOutputSchema
265
+ >;