@zyacreatives/shared 2.1.30 → 2.1.31

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.
@@ -15,3 +15,4 @@ export * from "./chat";
15
15
  export * from "./job";
16
16
  export * from "./job-application";
17
17
  export * from "./user-strike";
18
+ export * from "./notification";
@@ -31,3 +31,4 @@ __exportStar(require("./chat"), exports);
31
31
  __exportStar(require("./job"), exports);
32
32
  __exportStar(require("./job-application"), exports);
33
33
  __exportStar(require("./user-strike"), exports);
34
+ __exportStar(require("./notification"), exports);
@@ -1,4 +1,13 @@
1
1
  import { z } from "zod";
2
+ export declare const MinimalJobEntitySchema: z.ZodObject<{
3
+ id: z.ZodCUID2;
4
+ title: z.ZodString;
5
+ brandId: z.ZodCUID2;
6
+ jobType: z.ZodEnum<{
7
+ GIG: "GIG";
8
+ ROLE: "ROLE";
9
+ }>;
10
+ }, z.core.$strip>;
2
11
  export declare const BaseJobEntitySchema: z.ZodObject<{
3
12
  id: z.ZodCUID2;
4
13
  title: z.ZodString;
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetJobsOutputSchema = exports.GetJobsInputSchema = exports.GetCreatedJobsOutputSchema = exports.NormalizedJobSchema = exports.UpdateJobInputSchema = exports.UpdateGigJobInputSchema = exports.UpdateRoleJobInputSchema = exports.CreateGigJobInputSchema = exports.CreateRoleJobInputSchema = exports.CreateJobInputSchema = exports.JobWithRoleDetailsEntitySchema = exports.RoleJobEntitySchema = exports.JobWithGigDetailsEntitySchema = exports.GigJobEntitySchema = exports.JobEntitySchema = exports.JobIdSchema = exports.BaseJobEntitySchema = void 0;
3
+ exports.GetJobsOutputSchema = exports.GetJobsInputSchema = exports.GetCreatedJobsOutputSchema = exports.NormalizedJobSchema = exports.UpdateJobInputSchema = exports.UpdateGigJobInputSchema = exports.UpdateRoleJobInputSchema = exports.CreateGigJobInputSchema = exports.CreateRoleJobInputSchema = exports.CreateJobInputSchema = exports.JobWithRoleDetailsEntitySchema = exports.RoleJobEntitySchema = exports.JobWithGigDetailsEntitySchema = exports.GigJobEntitySchema = exports.JobEntitySchema = exports.JobIdSchema = exports.BaseJobEntitySchema = exports.MinimalJobEntitySchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../constants");
6
6
  const JobSectionEnum = zod_1.z.enum(Object.values(constants_1.JOB_SECTIONS));
7
+ exports.MinimalJobEntitySchema = zod_1.z.object({
8
+ id: zod_1.z.cuid2(),
9
+ title: zod_1.z.string(),
10
+ brandId: zod_1.z.cuid2(),
11
+ jobType: zod_1.z.enum(Object.values(constants_1.JOB_TYPE)),
12
+ });
7
13
  exports.BaseJobEntitySchema = zod_1.z.object({
8
14
  id: zod_1.z.cuid2(),
9
15
  title: zod_1.z.string(),
@@ -157,7 +163,9 @@ exports.CreateRoleJobInputSchema = zod_1.z
157
163
  .enum(Object.values(constants_1.WAGE_TYPES))
158
164
  .optional(),
159
165
  })
160
- .refine(({ wagesMin, wagesMax }) => wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin, {
166
+ .refine(({ wagesMin, wagesMax }) => wagesMin === undefined ||
167
+ wagesMax === undefined ||
168
+ wagesMax > wagesMin, {
161
169
  message: "wagesMax must be greater than wagesMin",
162
170
  path: ["wagesMax"],
163
171
  });
@@ -178,7 +186,9 @@ exports.CreateGigJobInputSchema = zod_1.z
178
186
  .enum(Object.values(constants_1.WAGE_TYPES))
179
187
  .optional(),
180
188
  })
181
- .refine(({ wagesMin, wagesMax }) => wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin, {
189
+ .refine(({ wagesMin, wagesMax }) => wagesMin === undefined ||
190
+ wagesMax === undefined ||
191
+ wagesMax > wagesMin, {
182
192
  message: "wagesMax must be greater than wagesMin",
183
193
  path: ["wagesMax"],
184
194
  });
@@ -0,0 +1,106 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ export declare const NotificationEntitySchema: z.ZodObject<{
3
+ id: z.ZodCUID2;
4
+ recipientId: z.ZodCUID2;
5
+ actorId: z.ZodCUID2;
6
+ type: z.ZodEnum<{
7
+ readonly FOLLOW: "Follow";
8
+ readonly LIKE: "Like";
9
+ readonly COMMENT: "Comment";
10
+ readonly REPLY: "Reply";
11
+ readonly MESSAGE: "Message";
12
+ readonly JOB_APPLICATION: "Job Application";
13
+ readonly APPLICATION_STATUS_CHANGE: "Application Status Change";
14
+ readonly SYSTEM_STRIKE: "System Strike";
15
+ readonly PROJECT_FEATURED: "Project Featured";
16
+ }>;
17
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
18
+ parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
19
+ [x: string]: string;
20
+ }>>>;
21
+ isRead: z.ZodDefault<z.ZodBoolean>;
22
+ createdAt: z.ZodCoercedDate<unknown>;
23
+ deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
24
+ }, z.core.$strip>;
25
+ export declare const MinimalNotificationEntitySchema: z.ZodObject<{
26
+ id: z.ZodCUID2;
27
+ recipientId: z.ZodCUID2;
28
+ actorId: z.ZodCUID2;
29
+ }, z.core.$strip>;
30
+ export declare const NotificationDetailsEntitySchema: z.ZodObject<{
31
+ id: z.ZodCUID2;
32
+ recipientId: z.ZodCUID2;
33
+ actorId: z.ZodCUID2;
34
+ type: z.ZodEnum<{
35
+ readonly FOLLOW: "Follow";
36
+ readonly LIKE: "Like";
37
+ readonly COMMENT: "Comment";
38
+ readonly REPLY: "Reply";
39
+ readonly MESSAGE: "Message";
40
+ readonly JOB_APPLICATION: "Job Application";
41
+ readonly APPLICATION_STATUS_CHANGE: "Application Status Change";
42
+ readonly SYSTEM_STRIKE: "System Strike";
43
+ readonly PROJECT_FEATURED: "Project Featured";
44
+ }>;
45
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
46
+ parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
47
+ [x: string]: string;
48
+ }>>>;
49
+ isRead: z.ZodDefault<z.ZodBoolean>;
50
+ createdAt: z.ZodCoercedDate<unknown>;
51
+ deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
52
+ itemTitle: z.ZodOptional<z.ZodString>;
53
+ itemContent: z.ZodOptional<z.ZodString>;
54
+ itemImgUrl: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>;
56
+ export declare const ListNotificationsInputSchema: z.ZodObject<{
57
+ type: z.ZodOptional<z.ZodEnum<{
58
+ readonly FOLLOW: "Follow";
59
+ readonly LIKE: "Like";
60
+ readonly COMMENT: "Comment";
61
+ readonly REPLY: "Reply";
62
+ readonly MESSAGE: "Message";
63
+ readonly JOB_APPLICATION: "Job Application";
64
+ readonly APPLICATION_STATUS_CHANGE: "Application Status Change";
65
+ readonly SYSTEM_STRIKE: "System Strike";
66
+ readonly PROJECT_FEATURED: "Project Featured";
67
+ }>>;
68
+ cursor: z.ZodOptional<z.ZodString>;
69
+ unreadOnly: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>>;
70
+ }, z.core.$strip>;
71
+ export declare const ListNotificationsOutputSchema: z.ZodObject<{
72
+ notifications: z.ZodArray<z.ZodObject<{
73
+ id: z.ZodCUID2;
74
+ recipientId: z.ZodCUID2;
75
+ actorId: z.ZodCUID2;
76
+ type: z.ZodEnum<{
77
+ readonly FOLLOW: "Follow";
78
+ readonly LIKE: "Like";
79
+ readonly COMMENT: "Comment";
80
+ readonly REPLY: "Reply";
81
+ readonly MESSAGE: "Message";
82
+ readonly JOB_APPLICATION: "Job Application";
83
+ readonly APPLICATION_STATUS_CHANGE: "Application Status Change";
84
+ readonly SYSTEM_STRIKE: "System Strike";
85
+ readonly PROJECT_FEATURED: "Project Featured";
86
+ }>;
87
+ parentId: z.ZodNullable<z.ZodOptional<z.ZodCUID2>>;
88
+ parentType: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
89
+ [x: string]: string;
90
+ }>>>;
91
+ isRead: z.ZodDefault<z.ZodBoolean>;
92
+ createdAt: z.ZodCoercedDate<unknown>;
93
+ deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
94
+ itemTitle: z.ZodOptional<z.ZodString>;
95
+ itemContent: z.ZodOptional<z.ZodString>;
96
+ itemImgUrl: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>>;
98
+ nextCursor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
99
+ unreadCount: z.ZodNumber;
100
+ }, z.core.$strip>;
101
+ export declare const MarkReadInputSchema: z.ZodObject<{
102
+ notificationIds: z.ZodArray<z.ZodCUID2>;
103
+ }, z.core.$strip>;
104
+ export declare const NotificationCountOutputSchema: z.ZodObject<{
105
+ unreadCount: z.ZodNumber;
106
+ }, z.core.$strip>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationCountOutputSchema = exports.MarkReadInputSchema = exports.ListNotificationsOutputSchema = exports.ListNotificationsInputSchema = exports.NotificationDetailsEntitySchema = exports.MinimalNotificationEntitySchema = exports.NotificationEntitySchema = void 0;
4
+ const zod_openapi_1 = require("@hono/zod-openapi");
5
+ const constants_1 = require("../constants");
6
+ exports.NotificationEntitySchema = zod_openapi_1.z
7
+ .object({
8
+ id: zod_openapi_1.z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
9
+ recipientId: zod_openapi_1.z.cuid2().openapi({ example: "user_recipient_123" }),
10
+ actorId: zod_openapi_1.z.cuid2().openapi({ example: "user_actor_456" }),
11
+ type: zod_openapi_1.z.enum(constants_1.NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
12
+ parentId: zod_openapi_1.z.cuid2().optional().nullable(),
13
+ parentType: zod_openapi_1.z
14
+ .enum(Object.values(constants_1.ACTIVITY_PARENT_TYPES))
15
+ .optional()
16
+ .nullable(),
17
+ isRead: zod_openapi_1.z.boolean().default(false).openapi({ example: false }),
18
+ createdAt: zod_openapi_1.z.coerce
19
+ .date()
20
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
21
+ deletedAt: zod_openapi_1.z.coerce.date().optional().nullable(),
22
+ })
23
+ .openapi("NotificationEntity");
24
+ exports.MinimalNotificationEntitySchema = zod_openapi_1.z.object({
25
+ id: zod_openapi_1.z.cuid2(),
26
+ recipientId: zod_openapi_1.z.cuid2(),
27
+ actorId: zod_openapi_1.z.cuid2(),
28
+ });
29
+ exports.NotificationDetailsEntitySchema = exports.NotificationEntitySchema.extend({
30
+ itemTitle: zod_openapi_1.z.string().optional(),
31
+ itemContent: zod_openapi_1.z.string().optional(),
32
+ itemImgUrl: zod_openapi_1.z.string().optional(),
33
+ });
34
+ exports.ListNotificationsInputSchema = zod_openapi_1.z
35
+ .object({
36
+ type: zod_openapi_1.z
37
+ .enum(constants_1.NOTIFICATION_TYPES)
38
+ .openapi({ example: "LIKE" })
39
+ .optional(),
40
+ cursor: zod_openapi_1.z.string().optional(),
41
+ unreadOnly: zod_openapi_1.z
42
+ .preprocess((val) => val === "true" || val === true, zod_openapi_1.z.boolean())
43
+ .optional()
44
+ .default(false),
45
+ })
46
+ .openapi("ListNotificationsInput");
47
+ exports.ListNotificationsOutputSchema = zod_openapi_1.z.object({
48
+ notifications: zod_openapi_1.z.array(exports.NotificationDetailsEntitySchema),
49
+ nextCursor: zod_openapi_1.z.string().optional().nullable(),
50
+ unreadCount: zod_openapi_1.z.number().int().openapi({ example: 5 }),
51
+ });
52
+ exports.MarkReadInputSchema = zod_openapi_1.z.object({
53
+ notificationIds: zod_openapi_1.z.array(zod_openapi_1.z.cuid2()).min(1),
54
+ });
55
+ exports.NotificationCountOutputSchema = zod_openapi_1.z.object({
56
+ unreadCount: zod_openapi_1.z.number().int().openapi({ example: 12 }),
57
+ });
@@ -16,3 +16,4 @@ export * from "./message";
16
16
  export * from "./chat";
17
17
  export * from "./job";
18
18
  export * from "./user-strike";
19
+ export * from "./notification";
@@ -32,3 +32,4 @@ __exportStar(require("./message"), exports);
32
32
  __exportStar(require("./chat"), exports);
33
33
  __exportStar(require("./job"), exports);
34
34
  __exportStar(require("./user-strike"), exports);
35
+ __exportStar(require("./notification"), exports);
@@ -0,0 +1,9 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import type { NotificationEntitySchema, MinimalNotificationEntitySchema, NotificationDetailsEntitySchema, ListNotificationsInputSchema, ListNotificationsOutputSchema, MarkReadInputSchema, NotificationCountOutputSchema } from "../schemas/notification";
3
+ export type NotificationEntity = z.infer<typeof NotificationEntitySchema>;
4
+ export type MinimalNotificationEntity = z.infer<typeof MinimalNotificationEntitySchema>;
5
+ export type NotificationDetailsEntity = z.infer<typeof NotificationDetailsEntitySchema>;
6
+ export type ListNotificationsInput = z.infer<typeof ListNotificationsInputSchema>;
7
+ export type ListNotificationsOutput = z.infer<typeof ListNotificationsOutputSchema>;
8
+ export type MarkReadInput = z.infer<typeof MarkReadInputSchema>;
9
+ export type NotificationCountOutput = z.infer<typeof NotificationCountOutputSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.1.30",
3
+ "version": "2.1.31",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,3 +15,4 @@ export * from "./chat";
15
15
  export * from "./job";
16
16
  export * from "./job-application";
17
17
  export * from "./user-strike";
18
+ export * from "./notification";
@@ -1,322 +1,364 @@
1
1
  import { z } from "zod";
2
2
  import {
3
- EMPLOYMENT_TYPE,
4
- EmploymentType,
5
- EXPERIENCE_LEVELS,
6
- ExperienceLevel,
7
- GIG_TYPE,
8
- GigType,
9
- JOB_LOCATIONS,
10
- JOB_SECTIONS,
11
- JOB_STATUS,
12
- JOB_TYPE,
13
- JobLocation,
14
- JobStatus,
15
- JobType,
16
- WAGE_TYPES,
17
- WAGES_CURRENCY,
18
- WagesCurrency,
19
- WageTypes,
20
- WORK_MODE,
21
- WorkMode,
3
+ EMPLOYMENT_TYPE,
4
+ EmploymentType,
5
+ EXPERIENCE_LEVELS,
6
+ ExperienceLevel,
7
+ GIG_TYPE,
8
+ GigType,
9
+ JOB_LOCATIONS,
10
+ JOB_SECTIONS,
11
+ JOB_STATUS,
12
+ JOB_TYPE,
13
+ JobLocation,
14
+ JobStatus,
15
+ JobType,
16
+ WAGE_TYPES,
17
+ WAGES_CURRENCY,
18
+ WagesCurrency,
19
+ WageTypes,
20
+ WORK_MODE,
21
+ WorkMode,
22
22
  } from "../constants";
23
23
 
24
24
  const JobSectionEnum = z.enum(
25
- Object.values(JOB_SECTIONS) as [string, ...string[]]
25
+ Object.values(JOB_SECTIONS) as [string, ...string[]],
26
26
  );
27
27
 
28
+ export const MinimalJobEntitySchema = z.object({
29
+ id: z.cuid2(),
30
+ title: z.string(),
31
+ brandId: z.cuid2(),
32
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
33
+ });
34
+
28
35
  export const BaseJobEntitySchema = z.object({
29
- id: z.cuid2(),
30
- title: z.string(),
31
- brandId: z.cuid2(),
32
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
33
- employmentType: z
34
- .enum(
35
- Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
36
- )
37
- .optional(),
38
- workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
39
- status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
40
- gigType: z
41
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
42
- .optional(),
43
- location: z.enum(
44
- Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]]
45
- ),
46
- jobSections: z
47
- .array(JobSectionEnum)
48
- .default([
49
- JOB_SECTIONS.PERSONAL_INFORMATION,
50
- JOB_SECTIONS.PROFESSIONAL_INFORMATION,
51
- JOB_SECTIONS.RESUME,
52
- JOB_SECTIONS.COVER_LETTER,
53
- ]),
54
- createdAt: z.date(),
55
- updatedAt: z.date(),
36
+ id: z.cuid2(),
37
+ title: z.string(),
38
+ brandId: z.cuid2(),
39
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
40
+ employmentType: z
41
+ .enum(
42
+ Object.values(EMPLOYMENT_TYPE) as [
43
+ EmploymentType,
44
+ ...EmploymentType[],
45
+ ],
46
+ )
47
+ .optional(),
48
+ workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
49
+ status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
50
+ gigType: z
51
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
52
+ .optional(),
53
+ location: z.enum(
54
+ Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
55
+ ),
56
+ jobSections: z
57
+ .array(JobSectionEnum)
58
+ .default([
59
+ JOB_SECTIONS.PERSONAL_INFORMATION,
60
+ JOB_SECTIONS.PROFESSIONAL_INFORMATION,
61
+ JOB_SECTIONS.RESUME,
62
+ JOB_SECTIONS.COVER_LETTER,
63
+ ]),
64
+ createdAt: z.date(),
65
+ updatedAt: z.date(),
56
66
  });
57
67
 
58
68
  export const JobIdSchema = z.object({
59
- jobId: z.cuid2(),
69
+ jobId: z.cuid2(),
60
70
  });
61
71
 
62
72
  export const JobEntitySchema = z.object({
63
- id: z.cuid2(),
64
- title: z.string(),
65
- brandId: z.cuid2(),
66
- brandName: z.cuid2(),
67
- brandImgUrl: z.cuid2().optional(),
68
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
69
- status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
70
- employmentType: z
71
- .enum(
72
- Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
73
- )
74
- .optional(),
75
- workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
76
- gigType: z
77
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
78
- .optional(),
79
- location: z.enum(
80
- Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]]
81
- ),
82
- jobSections: z
83
- .array(JobSectionEnum)
84
- .default([
85
- JOB_SECTIONS.PERSONAL_INFORMATION,
86
- JOB_SECTIONS.PROFESSIONAL_INFORMATION,
87
- JOB_SECTIONS.RESUME,
88
- JOB_SECTIONS.COVER_LETTER,
89
- ]),
90
- isBookmarked: z.boolean(),
91
- createdAt: z.date(),
92
- updatedAt: z.date(),
73
+ id: z.cuid2(),
74
+ title: z.string(),
75
+ brandId: z.cuid2(),
76
+ brandName: z.cuid2(),
77
+ brandImgUrl: z.cuid2().optional(),
78
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
79
+ status: z.enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]]),
80
+ employmentType: z
81
+ .enum(
82
+ Object.values(EMPLOYMENT_TYPE) as [
83
+ EmploymentType,
84
+ ...EmploymentType[],
85
+ ],
86
+ )
87
+ .optional(),
88
+ workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
89
+ gigType: z
90
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
91
+ .optional(),
92
+ location: z.enum(
93
+ Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]],
94
+ ),
95
+ jobSections: z
96
+ .array(JobSectionEnum)
97
+ .default([
98
+ JOB_SECTIONS.PERSONAL_INFORMATION,
99
+ JOB_SECTIONS.PROFESSIONAL_INFORMATION,
100
+ JOB_SECTIONS.RESUME,
101
+ JOB_SECTIONS.COVER_LETTER,
102
+ ]),
103
+ isBookmarked: z.boolean(),
104
+ createdAt: z.date(),
105
+ updatedAt: z.date(),
93
106
  });
94
107
 
95
108
  export const GigJobEntitySchema = z.object({
96
- id: z.cuid2(),
97
- jobType: z.literal(JOB_TYPE.GIG),
98
- overview: z.string(),
99
- deliverables: z.string(),
100
- employeeRequirements: z.string().optional(),
101
- aboutCompany: z.string().optional(),
102
- requiredSkills: z.array(z.string()),
103
- wagesMin: z.number().optional(),
104
- wagesMax: z.number().optional(),
105
- wagesCurrency: z
106
- .enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
107
- .optional(),
108
- wagesType: z
109
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
110
- .optional(),
109
+ id: z.cuid2(),
110
+ jobType: z.literal(JOB_TYPE.GIG),
111
+ overview: z.string(),
112
+ deliverables: z.string(),
113
+ employeeRequirements: z.string().optional(),
114
+ aboutCompany: z.string().optional(),
115
+ requiredSkills: z.array(z.string()),
116
+ wagesMin: z.number().optional(),
117
+ wagesMax: z.number().optional(),
118
+ wagesCurrency: z
119
+ .enum(
120
+ Object.values(WAGES_CURRENCY) as [
121
+ WagesCurrency,
122
+ ...WagesCurrency[],
123
+ ],
124
+ )
125
+ .optional(),
126
+ wagesType: z
127
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
128
+ .optional(),
111
129
  });
112
130
 
113
131
  export const JobWithGigDetailsEntitySchema = JobEntitySchema.extend(
114
- GigJobEntitySchema.shape
132
+ GigJobEntitySchema.shape,
115
133
  );
116
134
 
117
135
  export const RoleJobEntitySchema = z.object({
118
- id: z.cuid2(),
119
- jobType: z.literal(JOB_TYPE.ROLE),
120
- experienceLevel: z.enum(
121
- Object.values(EXPERIENCE_LEVELS) as [ExperienceLevel, ...ExperienceLevel[]]
122
- ),
123
- overview: z.string(),
124
- keyResponsibilities: z.string(),
125
- requiredSkills: z.array(z.string()),
126
- employeeRequirements: z.string().optional(),
127
- companyBenefits: z.string().optional(),
128
- wagesMin: z.number().optional(),
129
- wagesMax: z.number().optional(),
130
- wagesCurrency: z
131
- .enum(Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]])
132
- .optional(),
133
- wagesType: z
134
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
135
- .optional(),
136
+ id: z.cuid2(),
137
+ jobType: z.literal(JOB_TYPE.ROLE),
138
+ experienceLevel: z.enum(
139
+ Object.values(EXPERIENCE_LEVELS) as [
140
+ ExperienceLevel,
141
+ ...ExperienceLevel[],
142
+ ],
143
+ ),
144
+ overview: z.string(),
145
+ keyResponsibilities: z.string(),
146
+ requiredSkills: z.array(z.string()),
147
+ employeeRequirements: z.string().optional(),
148
+ companyBenefits: z.string().optional(),
149
+ wagesMin: z.number().optional(),
150
+ wagesMax: z.number().optional(),
151
+ wagesCurrency: z
152
+ .enum(
153
+ Object.values(WAGES_CURRENCY) as [
154
+ WagesCurrency,
155
+ ...WagesCurrency[],
156
+ ],
157
+ )
158
+ .optional(),
159
+ wagesType: z
160
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
161
+ .optional(),
136
162
  });
137
163
 
138
164
  export const JobWithRoleDetailsEntitySchema = JobEntitySchema.extend(
139
- RoleJobEntitySchema.shape
165
+ RoleJobEntitySchema.shape,
140
166
  );
141
167
 
142
168
  const CreateJobInputBaseSchema = z.object({
143
- title: z.string(),
144
- brandId: z.cuid2(),
145
- jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
169
+ title: z.string(),
170
+ brandId: z.cuid2(),
171
+ jobType: z.enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]]),
146
172
 
147
- employmentType: z
148
- .enum(
149
- Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
150
- )
151
- .optional(),
173
+ employmentType: z
174
+ .enum(
175
+ Object.values(EMPLOYMENT_TYPE) as [
176
+ EmploymentType,
177
+ ...EmploymentType[],
178
+ ],
179
+ )
180
+ .optional(),
152
181
 
153
- workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
182
+ workMode: z.enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]]),
154
183
 
155
- gigType: z
156
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
157
- .optional(),
184
+ gigType: z
185
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
186
+ .optional(),
158
187
 
159
- location: z
160
- .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
161
- .default(JOB_LOCATIONS.REMOTE),
188
+ location: z
189
+ .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
190
+ .default(JOB_LOCATIONS.REMOTE),
162
191
 
163
- jobSections: z
164
- .array(JobSectionEnum)
165
- .min(1, { message: "At least one job section must be provided." }),
192
+ jobSections: z
193
+ .array(JobSectionEnum)
194
+ .min(1, { message: "At least one job section must be provided." }),
166
195
  });
167
196
 
168
197
  export const CreateJobInputSchema = CreateJobInputBaseSchema.superRefine(
169
- (data, ctx) => {
170
- if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
171
- ctx.addIssue({
172
- path: ["employmentType"],
173
- code: "custom",
174
- message: "employmentType is required for ROLE jobs",
175
- });
176
- }
198
+ (data, ctx) => {
199
+ if (data.jobType === JOB_TYPE.ROLE && !data.employmentType) {
200
+ ctx.addIssue({
201
+ path: ["employmentType"],
202
+ code: "custom",
203
+ message: "employmentType is required for ROLE jobs",
204
+ });
205
+ }
177
206
 
178
- if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
179
- ctx.addIssue({
180
- path: ["gigType"],
181
- code: "custom",
182
- message: "gigType is required for GIG jobs",
183
- });
184
- }
185
- }
207
+ if (data.jobType === JOB_TYPE.GIG && !data.gigType) {
208
+ ctx.addIssue({
209
+ path: ["gigType"],
210
+ code: "custom",
211
+ message: "gigType is required for GIG jobs",
212
+ });
213
+ }
214
+ },
186
215
  ).transform((data) => {
187
- if (data.jobType === JOB_TYPE.ROLE) {
188
- return { ...data, gigType: undefined };
189
- }
216
+ if (data.jobType === JOB_TYPE.ROLE) {
217
+ return { ...data, gigType: undefined };
218
+ }
190
219
 
191
- if (data.jobType === JOB_TYPE.GIG) {
192
- return { ...data, employmentType: undefined };
193
- }
220
+ if (data.jobType === JOB_TYPE.GIG) {
221
+ return { ...data, employmentType: undefined };
222
+ }
194
223
 
195
- return data;
224
+ return data;
196
225
  });
197
226
 
198
227
  export const CreateRoleJobInputSchema = z
199
- .object({
200
- id: z.cuid2(),
201
- experienceLevel: z.enum(
202
- Object.values(EXPERIENCE_LEVELS) as [
203
- ExperienceLevel,
204
- ...ExperienceLevel[]
205
- ]
206
- ),
207
- overview: z.string(),
208
- keyResponsibilities: z.string(),
209
- requiredSkills: z.array(z.string()),
210
- employeeRequirements: z.string().optional(),
211
- companyBenefits: z.string().optional(),
212
- wagesMin: z.number().optional(),
213
- wagesMax: z.number().optional(),
214
- wagesCurrency: z
215
- .enum(
216
- Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]]
217
- )
218
- .optional(),
219
- wagesType: z
220
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
221
- .optional(),
222
- })
223
- .refine(
224
- ({ wagesMin, wagesMax }) =>
225
- wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin,
226
- {
227
- message: "wagesMax must be greater than wagesMin",
228
- path: ["wagesMax"],
229
- }
230
- );
228
+ .object({
229
+ id: z.cuid2(),
230
+ experienceLevel: z.enum(
231
+ Object.values(EXPERIENCE_LEVELS) as [
232
+ ExperienceLevel,
233
+ ...ExperienceLevel[],
234
+ ],
235
+ ),
236
+ overview: z.string(),
237
+ keyResponsibilities: z.string(),
238
+ requiredSkills: z.array(z.string()),
239
+ employeeRequirements: z.string().optional(),
240
+ companyBenefits: z.string().optional(),
241
+ wagesMin: z.number().optional(),
242
+ wagesMax: z.number().optional(),
243
+ wagesCurrency: z
244
+ .enum(
245
+ Object.values(WAGES_CURRENCY) as [
246
+ WagesCurrency,
247
+ ...WagesCurrency[],
248
+ ],
249
+ )
250
+ .optional(),
251
+ wagesType: z
252
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
253
+ .optional(),
254
+ })
255
+ .refine(
256
+ ({ wagesMin, wagesMax }) =>
257
+ wagesMin === undefined ||
258
+ wagesMax === undefined ||
259
+ wagesMax > wagesMin,
260
+ {
261
+ message: "wagesMax must be greater than wagesMin",
262
+ path: ["wagesMax"],
263
+ },
264
+ );
231
265
 
232
266
  export const CreateGigJobInputSchema = z
233
- .object({
234
- id: z.cuid2(),
235
- overview: z.string(),
236
- deliverables: z.string(),
237
- employeeRequirements: z.string().optional(),
238
- aboutCompany: z.string().optional(),
239
- requiredSkills: z.array(z.string()),
240
- wagesMin: z.number().optional(),
241
- wagesMax: z.number().optional(),
242
- wagesCurrency: z
243
- .enum(
244
- Object.values(WAGES_CURRENCY) as [WagesCurrency, ...WagesCurrency[]]
245
- )
246
- .optional(),
247
- wagesType: z
248
- .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
249
- .optional(),
250
- })
251
- .refine(
252
- ({ wagesMin, wagesMax }) =>
253
- wagesMin === undefined || wagesMax === undefined || wagesMax > wagesMin,
254
- {
255
- message: "wagesMax must be greater than wagesMin",
256
- path: ["wagesMax"],
257
- }
258
- );
267
+ .object({
268
+ id: z.cuid2(),
269
+ overview: z.string(),
270
+ deliverables: z.string(),
271
+ employeeRequirements: z.string().optional(),
272
+ aboutCompany: z.string().optional(),
273
+ requiredSkills: z.array(z.string()),
274
+ wagesMin: z.number().optional(),
275
+ wagesMax: z.number().optional(),
276
+ wagesCurrency: z
277
+ .enum(
278
+ Object.values(WAGES_CURRENCY) as [
279
+ WagesCurrency,
280
+ ...WagesCurrency[],
281
+ ],
282
+ )
283
+ .optional(),
284
+ wagesType: z
285
+ .enum(Object.values(WAGE_TYPES) as [WageTypes, ...WageTypes[]])
286
+ .optional(),
287
+ })
288
+ .refine(
289
+ ({ wagesMin, wagesMax }) =>
290
+ wagesMin === undefined ||
291
+ wagesMax === undefined ||
292
+ wagesMax > wagesMin,
293
+ {
294
+ message: "wagesMax must be greater than wagesMin",
295
+ path: ["wagesMax"],
296
+ },
297
+ );
259
298
 
260
299
  export const UpdateRoleJobInputSchema =
261
- CreateRoleJobInputSchema.partial().required({ id: true });
300
+ CreateRoleJobInputSchema.partial().required({ id: true });
262
301
 
263
302
  export const UpdateGigJobInputSchema =
264
- CreateGigJobInputSchema.partial().required({ id: true });
303
+ CreateGigJobInputSchema.partial().required({ id: true });
265
304
 
266
305
  export const UpdateJobInputSchema = CreateJobInputBaseSchema.partial().extend({
267
- id: z.cuid2(),
268
- status: z
269
- .enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
270
- .optional(),
306
+ id: z.cuid2(),
307
+ status: z
308
+ .enum(Object.values(JOB_STATUS) as [JobStatus, ...JobStatus[]])
309
+ .optional(),
271
310
  });
272
311
 
273
312
  export const NormalizedJobSchema = z.union([
274
- JobWithGigDetailsEntitySchema,
275
- JobEntitySchema,
276
- JobWithRoleDetailsEntitySchema,
313
+ JobWithGigDetailsEntitySchema,
314
+ JobEntitySchema,
315
+ JobWithRoleDetailsEntitySchema,
277
316
  ]);
278
317
 
279
318
  export const GetCreatedJobsOutputSchema = z.object({
280
- jobs: z.array(NormalizedJobSchema),
281
- noOfJobs: z.number(),
282
- noOfActiveJobs: z.number(),
283
- noOfArchivedJobs: z.number(),
319
+ jobs: z.array(NormalizedJobSchema),
320
+ noOfJobs: z.number(),
321
+ noOfActiveJobs: z.number(),
322
+ noOfArchivedJobs: z.number(),
284
323
  });
285
324
 
286
325
  export const GetJobsInputSchema = z.object({
287
- q: z.string().optional(),
288
- jobType: z
289
- .enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
290
- .optional(),
291
- workMode: z
292
- .enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
293
- .optional(),
294
- location: z
295
- .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
296
- .optional(),
297
- employmentType: z
298
- .enum(
299
- Object.values(EMPLOYMENT_TYPE) as [EmploymentType, ...EmploymentType[]]
300
- )
301
- .optional(),
302
- gigType: z
303
- .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
304
- .optional(),
305
- requiredSkills: z
306
- .string()
307
- .optional()
308
- .describe("Comma-separated: React,Node.js"),
326
+ q: z.string().optional(),
327
+ jobType: z
328
+ .enum(Object.values(JOB_TYPE) as [JobType, ...JobType[]])
329
+ .optional(),
330
+ workMode: z
331
+ .enum(Object.values(WORK_MODE) as [WorkMode, ...WorkMode[]])
332
+ .optional(),
333
+ location: z
334
+ .enum(Object.values(JOB_LOCATIONS) as [JobLocation, ...JobLocation[]])
335
+ .optional(),
336
+ employmentType: z
337
+ .enum(
338
+ Object.values(EMPLOYMENT_TYPE) as [
339
+ EmploymentType,
340
+ ...EmploymentType[],
341
+ ],
342
+ )
343
+ .optional(),
344
+ gigType: z
345
+ .enum(Object.values(GIG_TYPE) as [GigType, ...GigType[]])
346
+ .optional(),
347
+ requiredSkills: z
348
+ .string()
349
+ .optional()
350
+ .describe("Comma-separated: React,Node.js"),
309
351
 
310
- status: z.string().optional(),
311
- page: z.coerce.number().min(1).default(1),
312
- limit: z.coerce.number().min(1).max(100).default(20),
352
+ status: z.string().optional(),
353
+ page: z.coerce.number().min(1).default(1),
354
+ limit: z.coerce.number().min(1).max(100).default(20),
313
355
  });
314
356
 
315
357
  export const GetJobsOutputSchema = z.object({
316
- jobs: z.array(NormalizedJobSchema),
317
- total: z.number(),
318
- page: z.number(),
319
- totalPages: z.number(),
320
- hasNextPage: z.boolean(),
321
- hasPrevPage: z.boolean(),
358
+ jobs: z.array(NormalizedJobSchema),
359
+ total: z.number(),
360
+ page: z.number(),
361
+ totalPages: z.number(),
362
+ hasNextPage: z.boolean(),
363
+ hasPrevPage: z.boolean(),
322
364
  });
@@ -0,0 +1,61 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import { ACTIVITY_PARENT_TYPES, NOTIFICATION_TYPES } from "../constants";
3
+
4
+ export const NotificationEntitySchema = z
5
+ .object({
6
+ id: z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
7
+ recipientId: z.cuid2().openapi({ example: "user_recipient_123" }),
8
+ actorId: z.cuid2().openapi({ example: "user_actor_456" }),
9
+ type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
10
+ parentId: z.cuid2().optional().nullable(),
11
+ parentType: z
12
+ .enum(Object.values(ACTIVITY_PARENT_TYPES) as [string, ...string[]])
13
+ .optional()
14
+ .nullable(),
15
+ isRead: z.boolean().default(false).openapi({ example: false }),
16
+ createdAt: z.coerce
17
+ .date()
18
+ .openapi({ example: "2025-10-13T09:00:00.000Z" }),
19
+ deletedAt: z.coerce.date().optional().nullable(),
20
+ })
21
+ .openapi("NotificationEntity");
22
+
23
+ export const MinimalNotificationEntitySchema = z.object({
24
+ id: z.cuid2(),
25
+ recipientId: z.cuid2(),
26
+ actorId: z.cuid2(),
27
+ });
28
+
29
+ export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
30
+ itemTitle: z.string().optional(),
31
+ itemContent: z.string().optional(),
32
+ itemImgUrl: z.string().optional(),
33
+ });
34
+
35
+ export const ListNotificationsInputSchema = z
36
+ .object({
37
+ type: z
38
+ .enum(NOTIFICATION_TYPES)
39
+ .openapi({ example: "LIKE" })
40
+ .optional(),
41
+ cursor: z.string().optional(),
42
+ unreadOnly: z
43
+ .preprocess((val) => val === "true" || val === true, z.boolean())
44
+ .optional()
45
+ .default(false),
46
+ })
47
+ .openapi("ListNotificationsInput");
48
+
49
+ export const ListNotificationsOutputSchema = z.object({
50
+ notifications: z.array(NotificationDetailsEntitySchema),
51
+ nextCursor: z.string().optional().nullable(),
52
+ unreadCount: z.number().int().openapi({ example: 5 }),
53
+ });
54
+
55
+ export const MarkReadInputSchema = z.object({
56
+ notificationIds: z.array(z.cuid2()).min(1),
57
+ });
58
+
59
+ export const NotificationCountOutputSchema = z.object({
60
+ unreadCount: z.number().int().openapi({ example: 12 }),
61
+ });
@@ -16,3 +16,4 @@ export * from "./message";
16
16
  export * from "./chat";
17
17
  export * from "./job";
18
18
  export * from "./user-strike";
19
+ export * from "./notification";
@@ -0,0 +1,34 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import type {
3
+ NotificationEntitySchema,
4
+ MinimalNotificationEntitySchema,
5
+ NotificationDetailsEntitySchema,
6
+ ListNotificationsInputSchema,
7
+ ListNotificationsOutputSchema,
8
+ MarkReadInputSchema,
9
+ NotificationCountOutputSchema,
10
+ } from "../schemas/notification";
11
+
12
+ export type NotificationEntity = z.infer<typeof NotificationEntitySchema>;
13
+
14
+ export type MinimalNotificationEntity = z.infer<
15
+ typeof MinimalNotificationEntitySchema
16
+ >;
17
+
18
+ export type NotificationDetailsEntity = z.infer<
19
+ typeof NotificationDetailsEntitySchema
20
+ >;
21
+
22
+ export type ListNotificationsInput = z.infer<
23
+ typeof ListNotificationsInputSchema
24
+ >;
25
+
26
+ export type ListNotificationsOutput = z.infer<
27
+ typeof ListNotificationsOutputSchema
28
+ >;
29
+
30
+ export type MarkReadInput = z.infer<typeof MarkReadInputSchema>;
31
+
32
+ export type NotificationCountOutput = z.infer<
33
+ typeof NotificationCountOutputSchema
34
+ >;