@dakkitor/api-contracts 1.1.131 → 1.1.133
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/abilities/abilities.contract.d.ts +19 -13
- package/dist/abilities/abilities.contract.js +33 -18
- package/dist/abilities/first-agent.abilities.json +68 -56
- package/dist/abilities/second-agent.abilities.json +3 -3
- package/dist/abilities/team-leads.json +3 -6
- package/dist/actives/actives.contract.d.ts +6313 -6313
- package/dist/actives/actives.contract.js +92 -92
- package/dist/agent-client-links/agent-client-links.contract.d.ts +511 -511
- package/dist/auth/auth.contract.d.ts +16 -16
- package/dist/bookings/bookings.contract.d.ts +23378 -23378
- package/dist/call-history/call-history.contract.d.ts +366 -366
- package/dist/call-history/call-history.contract.js +67 -67
- package/dist/client-contacts/client-contacts.contract.d.ts +159 -159
- package/dist/clients/clients.contract.d.ts +72 -72
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts +1330 -1330
- package/dist/collaborations/collaborations.contract.d.ts +1198 -1198
- package/dist/common/call-rating.schema.d.ts +12 -12
- package/dist/common/call-rating.schema.js +48 -40
- package/dist/common/common-schemas.d.ts +4 -4
- package/dist/common/common-schemas.d.ts.map +1 -1
- package/dist/common/common-schemas.js +1 -2
- package/dist/common/error-schemas.d.ts +11 -5
- package/dist/common/error-schemas.js +11 -8
- package/dist/common/openapi-metadata.d.ts +54 -44
- package/dist/common/openapi-metadata.js +135 -129
- package/dist/common/pagination-query.schema.d.ts +11 -5
- package/dist/common/pagination-query.schema.js +11 -8
- package/dist/companies/companies.contract.d.ts +40 -40
- package/dist/cron-executions/cron-executions.contract.d.ts +14 -14
- package/dist/curated-workers/curated-workers.contract.d.ts +211 -211
- package/dist/dashboards/agent-daily-metrics.contract.d.ts +798 -616
- package/dist/dashboards/agent-daily-metrics.contract.js +100 -89
- package/dist/dashboards/dashboard-widgets.contract.d.ts +75 -75
- package/dist/dashboards/dashboard-widgets.contract.js +89 -89
- package/dist/dashboards/dashboard.contract.d.ts +305 -215
- package/dist/files/files.contract.d.ts +1544 -1177
- package/dist/files/files.contract.js +177 -162
- package/dist/health/health.contract.d.ts +191 -144
- package/dist/health/health.contract.js +53 -40
- package/dist/index.d.ts +67 -67
- package/dist/jobs/jobs.contract.d.ts +2553 -2553
- package/dist/jobs/jobs.contract.js +150 -150
- package/dist/lead-assignments/lead-assignments.contract.d.ts +587 -587
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts +239 -239
- package/dist/lead-distribution/lead-distribution-config.contract.d.ts +25 -25
- package/dist/leads/leads.contract.d.ts +108 -108
- package/dist/leads/leads.contract.js +119 -119
- package/dist/locations/locations.contract.d.ts +7 -7
- package/dist/monitoring/monitoring.contract.d.ts +13 -13
- package/dist/monitoring/monitoring.contract.js +37 -37
- package/dist/own-research/own-research.contract.d.ts +535 -134
- package/dist/own-research/own-research.contract.d.ts.map +1 -1
- package/dist/own-research/own-research.contract.js +88 -56
- package/dist/postcodes/postcodes.contract.d.ts +24 -24
- package/dist/qualifications/qualifications.contract.d.ts +1898 -1387
- package/dist/qualifications/qualifications.contract.js +193 -171
- package/dist/trades/trades.contract.d.ts +991 -763
- package/dist/trades/trades.contract.js +111 -89
- package/dist/users/users.contract.d.ts +202 -202
- package/dist/users/users.contract.js +121 -121
- package/dist/workers/workers.contract.d.ts +710 -710
- package/dist/workers/workers.contract.js +150 -150
- package/package.json +1 -1
|
@@ -15,232 +15,232 @@ const curated_workers_contract_1 = require("../curated-workers/curated-workers.c
|
|
|
15
15
|
* Job Status Enum
|
|
16
16
|
*/
|
|
17
17
|
exports.JobStatusSchema = zod_1.z.enum([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
'CANCELED',
|
|
19
|
+
'FILLED',
|
|
20
|
+
'AVAILABLE',
|
|
21
|
+
'NOT_AVAILABLE',
|
|
22
|
+
'DRAFT',
|
|
23
23
|
]);
|
|
24
24
|
/**
|
|
25
25
|
* Job Sortable Fields Enum
|
|
26
26
|
*/
|
|
27
27
|
exports.JobSortableFieldsSchema = zod_1.z
|
|
28
28
|
.enum([
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
'description',
|
|
30
|
+
'numberOfPositions',
|
|
31
|
+
'status',
|
|
32
|
+
'createdAt',
|
|
33
|
+
'updatedAt',
|
|
34
34
|
])
|
|
35
|
-
.openapi({ title:
|
|
35
|
+
.openapi({ title: 'JobSortableFields' });
|
|
36
36
|
/**
|
|
37
37
|
* Pay Schema - Nested object for job payment details
|
|
38
38
|
*/
|
|
39
39
|
exports.PaySchema = zod_1.z
|
|
40
40
|
.object({
|
|
41
|
-
rateUnit: common_schemas_1.RateUnitSchema.describe(
|
|
41
|
+
rateUnit: common_schemas_1.RateUnitSchema.describe('The unit for the pay rate'),
|
|
42
42
|
isNegotiable: zod_1.z
|
|
43
43
|
.boolean()
|
|
44
44
|
.default(false)
|
|
45
|
-
.describe(
|
|
45
|
+
.describe('Whether the rate is negotiable'),
|
|
46
46
|
rate: zod_1.z.coerce
|
|
47
47
|
.number()
|
|
48
48
|
.min(1)
|
|
49
49
|
.nullable()
|
|
50
50
|
.optional()
|
|
51
|
-
.describe(
|
|
51
|
+
.describe('The pay rate'),
|
|
52
52
|
rateMax: zod_1.z.coerce
|
|
53
53
|
.number()
|
|
54
54
|
.min(1)
|
|
55
55
|
.nullable()
|
|
56
56
|
.optional()
|
|
57
|
-
.describe(
|
|
57
|
+
.describe('The maximum pay rate (for a range)'),
|
|
58
58
|
receivedRate: zod_1.z.coerce
|
|
59
59
|
.number()
|
|
60
60
|
.min(1)
|
|
61
61
|
.nullable()
|
|
62
62
|
.optional()
|
|
63
|
-
.describe(
|
|
63
|
+
.describe('The received pay rate'),
|
|
64
64
|
})
|
|
65
|
-
.openapi({ title:
|
|
65
|
+
.openapi({ title: 'Pay' });
|
|
66
66
|
exports.CreatePaySchema = zod_1.z
|
|
67
67
|
.object({
|
|
68
|
-
rateUnit: common_schemas_1.RateUnitSchema.default(
|
|
68
|
+
rateUnit: common_schemas_1.RateUnitSchema.default('HOURLY').describe('The unit for the pay rate'),
|
|
69
69
|
isNegotiable: zod_1.z
|
|
70
70
|
.boolean()
|
|
71
71
|
.default(false)
|
|
72
|
-
.describe(
|
|
73
|
-
rate: zod_1.z.number().min(1).nullable().optional().describe(
|
|
72
|
+
.describe('Whether the rate is negotiable'),
|
|
73
|
+
rate: zod_1.z.number().min(1).nullable().optional().describe('The pay rate'),
|
|
74
74
|
rateMax: zod_1.z
|
|
75
75
|
.number()
|
|
76
76
|
.min(1)
|
|
77
77
|
.optional()
|
|
78
78
|
.nullable()
|
|
79
|
-
.describe(
|
|
79
|
+
.describe('The maximum pay rate (for a range)'),
|
|
80
80
|
receivedRate: zod_1.z
|
|
81
81
|
.number()
|
|
82
82
|
.min(1)
|
|
83
83
|
.nullable()
|
|
84
84
|
.optional()
|
|
85
|
-
.describe(
|
|
85
|
+
.describe('The received pay rate'),
|
|
86
86
|
})
|
|
87
87
|
.superRefine((data, ctx) => {
|
|
88
88
|
if (!data.isNegotiable) {
|
|
89
89
|
if (!data.rate) {
|
|
90
90
|
ctx.addIssue({
|
|
91
91
|
code: zod_1.z.ZodIssueCode.custom,
|
|
92
|
-
message:
|
|
93
|
-
path: [
|
|
92
|
+
message: 'Rate is required when not negotiable',
|
|
93
|
+
path: ['rate'],
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
if (!data.receivedRate) {
|
|
97
97
|
ctx.addIssue({
|
|
98
98
|
code: zod_1.z.ZodIssueCode.custom,
|
|
99
|
-
message:
|
|
100
|
-
path: [
|
|
99
|
+
message: 'Received rate is required when not negotiable',
|
|
100
|
+
path: ['receivedRate'],
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
if (data.rate && data.rateMax && data.rateMax < data.rate) {
|
|
105
105
|
ctx.addIssue({
|
|
106
106
|
code: zod_1.z.ZodIssueCode.custom,
|
|
107
|
-
message:
|
|
108
|
-
path: [
|
|
107
|
+
message: 'Maximum rate must be greater than or equal to the rate',
|
|
108
|
+
path: ['rateMax'],
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
})
|
|
112
|
-
.openapi({ title:
|
|
112
|
+
.openapi({ title: 'CreatePay' });
|
|
113
113
|
/**
|
|
114
114
|
* Job Qualification Schemas
|
|
115
115
|
*/
|
|
116
116
|
exports.JobQualificationSchema = zod_1.z
|
|
117
117
|
.object({
|
|
118
|
-
id: zod_1.z.string().uuid().describe(
|
|
119
|
-
qualificationId: zod_1.z.string().uuid().describe(
|
|
118
|
+
id: zod_1.z.string().uuid().describe('The ID of the job qualification'),
|
|
119
|
+
qualificationId: zod_1.z.string().uuid().describe('The ID of the qualification'),
|
|
120
120
|
qualificationTypeId: zod_1.z
|
|
121
121
|
.string()
|
|
122
122
|
.uuid()
|
|
123
123
|
.optional()
|
|
124
124
|
.nullable()
|
|
125
|
-
.describe(
|
|
125
|
+
.describe('The ID of the qualification type'),
|
|
126
126
|
})
|
|
127
|
-
.openapi({ title:
|
|
127
|
+
.openapi({ title: 'JobQualification' });
|
|
128
128
|
exports.CreateJobQualificationSchema = zod_1.z
|
|
129
129
|
.object({
|
|
130
|
-
qualificationId: zod_1.z.string().uuid().describe(
|
|
130
|
+
qualificationId: zod_1.z.string().uuid().describe('The ID of the qualification'),
|
|
131
131
|
qualificationTypeId: zod_1.z
|
|
132
132
|
.union([zod_1.z.string().uuid(), zod_1.z.null()])
|
|
133
133
|
.optional()
|
|
134
|
-
.describe(
|
|
134
|
+
.describe('The ID of the qualification type'),
|
|
135
135
|
})
|
|
136
|
-
.openapi({ title:
|
|
136
|
+
.openapi({ title: 'CreateJobQualification' });
|
|
137
137
|
/**
|
|
138
138
|
* Main Job Schema
|
|
139
139
|
*/
|
|
140
140
|
exports.JobSchema = zod_1.z
|
|
141
141
|
.object({
|
|
142
|
-
id: zod_1.z.string().uuid().describe(
|
|
143
|
-
description: zod_1.z.string().describe(
|
|
142
|
+
id: zod_1.z.string().uuid().describe('Job ID'),
|
|
143
|
+
description: zod_1.z.string().describe('Job Description'),
|
|
144
144
|
numberOfPositions: zod_1.z
|
|
145
145
|
.number()
|
|
146
146
|
.int()
|
|
147
147
|
.min(1)
|
|
148
|
-
.describe(
|
|
148
|
+
.describe('Number of Positions Available'),
|
|
149
149
|
workHours: zod_1.z.coerce
|
|
150
150
|
.number()
|
|
151
151
|
.min(0.01)
|
|
152
152
|
.max(60)
|
|
153
153
|
.optional()
|
|
154
154
|
.nullable()
|
|
155
|
-
.describe(
|
|
156
|
-
status: exports.JobStatusSchema.describe(
|
|
157
|
-
pay: exports.PaySchema.describe(
|
|
155
|
+
.describe('Number of Work Hours'),
|
|
156
|
+
status: exports.JobStatusSchema.describe('Job Status'),
|
|
157
|
+
pay: exports.PaySchema.describe('Payment Details'),
|
|
158
158
|
location: common_schemas_1.LocationDetailsSchema.optional()
|
|
159
159
|
.nullable()
|
|
160
|
-
.describe(
|
|
160
|
+
.describe('Job Location'),
|
|
161
161
|
tradeId: zod_1.z
|
|
162
162
|
.string()
|
|
163
|
-
.min(1, { message:
|
|
163
|
+
.min(1, { message: 'Trade is required' })
|
|
164
164
|
.pipe(zod_1.z.string().uuid())
|
|
165
|
-
.describe(
|
|
165
|
+
.describe('Trade ID'),
|
|
166
166
|
jobQualifications: zod_1.z
|
|
167
167
|
.array(exports.JobQualificationSchema)
|
|
168
168
|
.optional()
|
|
169
169
|
.default([])
|
|
170
|
-
.describe(
|
|
170
|
+
.describe('Job Qualifications'),
|
|
171
171
|
currentCollaboration: collaborations_contract_1.CollaborationSchema.nullable()
|
|
172
172
|
.optional()
|
|
173
|
-
.describe(
|
|
173
|
+
.describe('Current Collaboration'),
|
|
174
174
|
createdAt: zod_1.z
|
|
175
175
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
176
176
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
177
|
-
.describe(
|
|
177
|
+
.describe('Creation Date'),
|
|
178
178
|
updatedAt: zod_1.z
|
|
179
179
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
180
180
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
181
|
-
.describe(
|
|
181
|
+
.describe('Last Update Date'),
|
|
182
182
|
createdById: zod_1.z
|
|
183
183
|
.string()
|
|
184
184
|
.uuid()
|
|
185
185
|
.nullable()
|
|
186
186
|
.optional()
|
|
187
|
-
.describe(
|
|
187
|
+
.describe('User ID who created the job'),
|
|
188
188
|
})
|
|
189
|
-
.openapi({ title:
|
|
189
|
+
.openapi({ title: 'Job' });
|
|
190
190
|
/**
|
|
191
191
|
* Create Job Schema
|
|
192
192
|
*/
|
|
193
193
|
exports.CreateJobSchema = zod_1.z
|
|
194
194
|
.object({
|
|
195
|
-
description: zod_1.z.string().min(10).describe(
|
|
195
|
+
description: zod_1.z.string().min(10).describe('Job Description'),
|
|
196
196
|
location: common_schemas_1.CreateLocationSchema.optional()
|
|
197
197
|
.nullable()
|
|
198
|
-
.describe(
|
|
198
|
+
.describe('Job Location'),
|
|
199
199
|
numberOfPositions: zod_1.z
|
|
200
200
|
.number()
|
|
201
201
|
.int()
|
|
202
202
|
.min(1)
|
|
203
203
|
.max(100)
|
|
204
|
-
.describe(
|
|
204
|
+
.describe('Number of Positions'),
|
|
205
205
|
workHours: zod_1.z
|
|
206
206
|
.number()
|
|
207
207
|
.min(0.01)
|
|
208
208
|
.max(60)
|
|
209
209
|
.default(8)
|
|
210
|
-
.describe(
|
|
211
|
-
pay: exports.CreatePaySchema.describe(
|
|
210
|
+
.describe('Number of Work Hours'),
|
|
211
|
+
pay: exports.CreatePaySchema.describe('Payment Details'),
|
|
212
212
|
tradeId: zod_1.z
|
|
213
213
|
.string()
|
|
214
|
-
.min(1, { message:
|
|
214
|
+
.min(1, { message: 'Trade is required' })
|
|
215
215
|
.pipe(zod_1.z.string().uuid())
|
|
216
|
-
.describe(
|
|
216
|
+
.describe('Trade'),
|
|
217
217
|
currentCollaboration: zod_1.z
|
|
218
218
|
.object({
|
|
219
219
|
id: zod_1.z
|
|
220
220
|
.string()
|
|
221
|
-
.min(1, { message:
|
|
221
|
+
.min(1, { message: 'Collaboration is required' })
|
|
222
222
|
.pipe(zod_1.z.string().uuid())
|
|
223
|
-
.describe(
|
|
223
|
+
.describe('Search Collaboration by Client'),
|
|
224
224
|
})
|
|
225
225
|
.optional()
|
|
226
226
|
.nullable()
|
|
227
|
-
.describe(
|
|
227
|
+
.describe('Current Collaboration'),
|
|
228
228
|
jobQualifications: zod_1.z
|
|
229
229
|
.array(exports.CreateJobQualificationSchema)
|
|
230
230
|
.optional()
|
|
231
|
-
.describe(
|
|
232
|
-
status: exports.JobStatusSchema.optional().describe(
|
|
231
|
+
.describe('Job Qualifications'),
|
|
232
|
+
status: exports.JobStatusSchema.optional().describe('Job Status'),
|
|
233
233
|
})
|
|
234
234
|
.superRefine((data, ctx) => {
|
|
235
235
|
// If no collaboration is provided, status must be DRAFT (or will default to DRAFT)
|
|
236
236
|
const hasCollaboration = data.currentCollaboration && data.currentCollaboration.id;
|
|
237
237
|
if (!hasCollaboration) {
|
|
238
238
|
// If status is explicitly set to non-DRAFT, fail validation
|
|
239
|
-
if (data.status !== undefined && data.status !==
|
|
239
|
+
if (data.status !== undefined && data.status !== 'DRAFT') {
|
|
240
240
|
ctx.addIssue({
|
|
241
241
|
code: zod_1.z.ZodIssueCode.custom,
|
|
242
|
-
message:
|
|
243
|
-
path: [
|
|
242
|
+
message: 'A collaboration is required when creating a job with non-draft status.',
|
|
243
|
+
path: ['currentCollaboration'],
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -250,100 +250,100 @@ exports.CreateJobSchema = zod_1.z
|
|
|
250
250
|
const hasCollaboration = data.currentCollaboration && data.currentCollaboration.id;
|
|
251
251
|
return {
|
|
252
252
|
...data,
|
|
253
|
-
status: hasCollaboration ? (data.status ??
|
|
253
|
+
status: hasCollaboration ? (data.status ?? 'AVAILABLE') : 'DRAFT',
|
|
254
254
|
};
|
|
255
255
|
})
|
|
256
|
-
.openapi({ title:
|
|
256
|
+
.openapi({ title: 'CreateJob' });
|
|
257
257
|
/**
|
|
258
258
|
* Create Draft Job Schema - For bot-created jobs without collaboration
|
|
259
259
|
*/
|
|
260
260
|
exports.CreateDraftJobSchema = zod_1.z
|
|
261
261
|
.object({
|
|
262
|
-
description: zod_1.z.string().min(10).describe(
|
|
262
|
+
description: zod_1.z.string().min(10).describe('Job Description'),
|
|
263
263
|
location: common_schemas_1.CreateLocationSchema.optional()
|
|
264
264
|
.nullable()
|
|
265
|
-
.describe(
|
|
265
|
+
.describe('Job Location'),
|
|
266
266
|
numberOfPositions: zod_1.z
|
|
267
267
|
.number()
|
|
268
268
|
.int()
|
|
269
269
|
.min(1)
|
|
270
270
|
.max(100)
|
|
271
|
-
.describe(
|
|
271
|
+
.describe('Number of Positions'),
|
|
272
272
|
workHours: zod_1.z
|
|
273
273
|
.number()
|
|
274
274
|
.min(0.01)
|
|
275
275
|
.max(60)
|
|
276
276
|
.default(8)
|
|
277
|
-
.describe(
|
|
278
|
-
pay: exports.CreatePaySchema.describe(
|
|
277
|
+
.describe('Number of Work Hours'),
|
|
278
|
+
pay: exports.CreatePaySchema.describe('Payment Details'),
|
|
279
279
|
tradeId: zod_1.z
|
|
280
280
|
.string()
|
|
281
|
-
.min(1, { message:
|
|
281
|
+
.min(1, { message: 'Trade is required' })
|
|
282
282
|
.pipe(zod_1.z.string().uuid())
|
|
283
|
-
.describe(
|
|
283
|
+
.describe('Trade'),
|
|
284
284
|
jobQualifications: zod_1.z
|
|
285
285
|
.array(exports.CreateJobQualificationSchema)
|
|
286
286
|
.optional()
|
|
287
|
-
.describe(
|
|
287
|
+
.describe('Job Qualifications'),
|
|
288
288
|
})
|
|
289
|
-
.openapi({ title:
|
|
289
|
+
.openapi({ title: 'CreateDraftJob' });
|
|
290
290
|
/**
|
|
291
291
|
* Update Job Schema
|
|
292
292
|
*/
|
|
293
293
|
exports.UpdateJobSchema = zod_1.z
|
|
294
294
|
.object({
|
|
295
|
-
description: zod_1.z.string().min(10).optional().describe(
|
|
295
|
+
description: zod_1.z.string().min(10).optional().describe('Job Description'),
|
|
296
296
|
location: common_schemas_1.CreateLocationSchema.optional()
|
|
297
297
|
.nullable()
|
|
298
|
-
.describe(
|
|
298
|
+
.describe('Job Location'),
|
|
299
299
|
numberOfPositions: zod_1.z
|
|
300
300
|
.number()
|
|
301
301
|
.int()
|
|
302
302
|
.min(1)
|
|
303
303
|
.max(100)
|
|
304
304
|
.optional()
|
|
305
|
-
.describe(
|
|
305
|
+
.describe('Number of Positions'),
|
|
306
306
|
workHours: zod_1.z
|
|
307
307
|
.number()
|
|
308
308
|
.min(0.01)
|
|
309
309
|
.max(60)
|
|
310
310
|
.optional()
|
|
311
|
-
.describe(
|
|
312
|
-
pay: exports.CreatePaySchema.optional().describe(
|
|
311
|
+
.describe('Number of Work Hours'),
|
|
312
|
+
pay: exports.CreatePaySchema.optional().describe('Payment Details'),
|
|
313
313
|
tradeId: zod_1.z
|
|
314
314
|
.string()
|
|
315
|
-
.min(1, { message:
|
|
315
|
+
.min(1, { message: 'Trade is required' })
|
|
316
316
|
.pipe(zod_1.z.string().uuid())
|
|
317
317
|
.optional()
|
|
318
|
-
.describe(
|
|
318
|
+
.describe('Trade'),
|
|
319
319
|
currentCollaboration: zod_1.z
|
|
320
|
-
.preprocess((val) => (val ===
|
|
320
|
+
.preprocess((val) => (val === '' ? null : val), zod_1.z
|
|
321
321
|
.object({
|
|
322
322
|
id: zod_1.z
|
|
323
|
-
.preprocess((val) => (val ===
|
|
323
|
+
.preprocess((val) => (val === '' ? undefined : val), zod_1.z
|
|
324
324
|
.string()
|
|
325
|
-
.min(1, { message:
|
|
325
|
+
.min(1, { message: 'Collaboration is required' })
|
|
326
326
|
.pipe(zod_1.z.string().uuid())
|
|
327
327
|
.optional())
|
|
328
|
-
.describe(
|
|
328
|
+
.describe('Search Collaboration by Client'),
|
|
329
329
|
})
|
|
330
330
|
.optional()
|
|
331
331
|
.nullable())
|
|
332
332
|
.transform((val) => {
|
|
333
333
|
// If val is an object (and not null) but has no keys or id is missing/undefined, return null
|
|
334
334
|
if (val &&
|
|
335
|
-
typeof val ===
|
|
335
|
+
typeof val === 'object' &&
|
|
336
336
|
(Object.keys(val).length === 0 || !val.id)) {
|
|
337
337
|
return null;
|
|
338
338
|
}
|
|
339
339
|
return val;
|
|
340
340
|
})
|
|
341
|
-
.describe(
|
|
341
|
+
.describe('Current Collaboration'),
|
|
342
342
|
jobQualifications: zod_1.z
|
|
343
343
|
.array(exports.CreateJobQualificationSchema)
|
|
344
344
|
.optional()
|
|
345
|
-
.describe(
|
|
346
|
-
status: exports.JobStatusSchema.optional().describe(
|
|
345
|
+
.describe('Job Qualifications'),
|
|
346
|
+
status: exports.JobStatusSchema.optional().describe('Job Status'),
|
|
347
347
|
})
|
|
348
348
|
.superRefine((data, ctx) => {
|
|
349
349
|
// If status is being set to something other than DRAFT,
|
|
@@ -356,58 +356,58 @@ exports.UpdateJobSchema = zod_1.z
|
|
|
356
356
|
(data.currentCollaboration !== undefined &&
|
|
357
357
|
!data.currentCollaboration.id);
|
|
358
358
|
if (data.status !== undefined &&
|
|
359
|
-
data.status !==
|
|
359
|
+
data.status !== 'DRAFT' &&
|
|
360
360
|
hasNoCollaboration) {
|
|
361
361
|
ctx.addIssue({
|
|
362
362
|
code: zod_1.z.ZodIssueCode.custom,
|
|
363
|
-
message:
|
|
364
|
-
path: [
|
|
363
|
+
message: 'A collaboration is required when setting status to a non-draft value.',
|
|
364
|
+
path: ['currentCollaboration'],
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
})
|
|
368
|
-
.openapi({ title:
|
|
368
|
+
.openapi({ title: 'UpdateJob' });
|
|
369
369
|
/**
|
|
370
370
|
* Filter Job Schema
|
|
371
371
|
*/
|
|
372
372
|
exports.FilterJobSchema = pagination_query_schema_1.PaginationQuerySchema.extend({
|
|
373
|
-
tradeId: zod_1.z.string().uuid().optional().nullable().describe(
|
|
373
|
+
tradeId: zod_1.z.string().uuid().optional().nullable().describe('Filter by trade'),
|
|
374
374
|
createdAt: common_schemas_1.DateRangeSchema.optional()
|
|
375
375
|
.nullable()
|
|
376
|
-
.describe(
|
|
376
|
+
.describe('Filter by created date range'),
|
|
377
377
|
updatedAt: common_schemas_1.DateRangeSchema.optional()
|
|
378
378
|
.nullable()
|
|
379
|
-
.describe(
|
|
379
|
+
.describe('Filter by updated date range'),
|
|
380
380
|
qualificationFilters: zod_1.z
|
|
381
381
|
.array(curated_workers_contract_1.QualificationFilterSchema)
|
|
382
382
|
.optional()
|
|
383
|
-
.describe(
|
|
383
|
+
.describe('Filter by qualifications'),
|
|
384
384
|
status: exports.JobStatusSchema.optional()
|
|
385
385
|
.nullable()
|
|
386
|
-
.describe(
|
|
386
|
+
.describe('Filter by job status'),
|
|
387
387
|
userId: zod_1.z
|
|
388
388
|
.string()
|
|
389
389
|
.uuid()
|
|
390
390
|
.optional()
|
|
391
391
|
.nullable()
|
|
392
|
-
.describe(
|
|
393
|
-
clientId: zod_1.z.string().uuid().optional().nullable().describe(
|
|
394
|
-
companyId: zod_1.z.string().uuid().optional().nullable().describe(
|
|
392
|
+
.describe('Search First Agent'),
|
|
393
|
+
clientId: zod_1.z.string().uuid().optional().nullable().describe('Search Client'),
|
|
394
|
+
companyId: zod_1.z.string().uuid().optional().nullable().describe('Search Company'),
|
|
395
395
|
location: common_schemas_1.LocationFilterSchema.optional()
|
|
396
396
|
.nullable()
|
|
397
|
-
.describe(
|
|
397
|
+
.describe('Filter by location'),
|
|
398
398
|
pay: common_schemas_1.PayRangeSchema.optional()
|
|
399
399
|
.nullable()
|
|
400
|
-
.describe(
|
|
400
|
+
.describe('Filter by pay rate range'),
|
|
401
401
|
sortBy: exports.JobSortableFieldsSchema.optional()
|
|
402
402
|
.nullable()
|
|
403
|
-
.describe(
|
|
403
|
+
.describe('The field to sort the results by'),
|
|
404
404
|
sortOrder: common_schemas_1.SortOrderSchema.optional()
|
|
405
405
|
.nullable()
|
|
406
|
-
.describe(
|
|
406
|
+
.describe('The order to sort the results by'),
|
|
407
407
|
});
|
|
408
408
|
exports.PaginatedJobResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.JobSchema)
|
|
409
|
-
.describe(
|
|
410
|
-
.openapi({ title:
|
|
409
|
+
.describe('Jobs retrieved successfully')
|
|
410
|
+
.openapi({ title: 'JobsPaginatedResponse' });
|
|
411
411
|
/**
|
|
412
412
|
* Search Job Schema - For trigram-based duplicate detection
|
|
413
413
|
*/
|
|
@@ -416,115 +416,115 @@ exports.SearchJobQuerySchema = zod_1.z
|
|
|
416
416
|
description: zod_1.z
|
|
417
417
|
.string()
|
|
418
418
|
.min(10)
|
|
419
|
-
.describe(
|
|
419
|
+
.describe('Job description to search for similar jobs'),
|
|
420
420
|
userId: zod_1.z
|
|
421
421
|
.string()
|
|
422
422
|
.uuid()
|
|
423
423
|
.optional()
|
|
424
|
-
.describe(
|
|
424
|
+
.describe('Filter by user who created the job'),
|
|
425
425
|
threshold: zod_1.z.coerce
|
|
426
426
|
.number()
|
|
427
427
|
.min(0.1)
|
|
428
428
|
.max(1)
|
|
429
429
|
.default(0.3)
|
|
430
|
-
.describe(
|
|
431
|
-
limit: zod_1.z.coerce.number().min(1).max(10).default(5).describe(
|
|
430
|
+
.describe('Similarity threshold (0.1-1.0, higher = stricter)'),
|
|
431
|
+
limit: zod_1.z.coerce.number().min(1).max(10).default(5).describe('Max results'),
|
|
432
432
|
})
|
|
433
|
-
.openapi({ title:
|
|
433
|
+
.openapi({ title: 'SearchJobQuery' });
|
|
434
434
|
exports.SearchJobResultSchema = zod_1.z
|
|
435
435
|
.object({
|
|
436
|
-
similarity: zod_1.z.number().describe(
|
|
437
|
-
job: exports.JobSchema.describe(
|
|
436
|
+
similarity: zod_1.z.number().describe('Similarity score (0-1)'),
|
|
437
|
+
job: exports.JobSchema.describe('The matching job'),
|
|
438
438
|
})
|
|
439
|
-
.openapi({ title:
|
|
439
|
+
.openapi({ title: 'SearchJobResult' });
|
|
440
440
|
exports.SearchJobResponseSchema = zod_1.z
|
|
441
441
|
.array(exports.SearchJobResultSchema)
|
|
442
|
-
.openapi({ title:
|
|
442
|
+
.openapi({ title: 'SearchJobResponse' });
|
|
443
443
|
const c = (0, core_1.initContract)();
|
|
444
444
|
exports.jobsContractRouter = c.router({
|
|
445
445
|
create: {
|
|
446
|
-
method:
|
|
447
|
-
path:
|
|
446
|
+
method: 'POST',
|
|
447
|
+
path: '/v2/jobs',
|
|
448
448
|
responses: {
|
|
449
449
|
201: exports.JobSchema,
|
|
450
450
|
409: error_schemas_1.ErrorResponseSchema,
|
|
451
451
|
},
|
|
452
452
|
body: exports.CreateJobSchema,
|
|
453
|
-
summary:
|
|
454
|
-
metadata: { tags: [
|
|
453
|
+
summary: 'Create a new job',
|
|
454
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'createJob' } },
|
|
455
455
|
},
|
|
456
456
|
createDraft: {
|
|
457
|
-
method:
|
|
458
|
-
path:
|
|
457
|
+
method: 'POST',
|
|
458
|
+
path: '/v2/jobs/draft',
|
|
459
459
|
responses: {
|
|
460
460
|
201: exports.JobSchema,
|
|
461
461
|
409: error_schemas_1.ErrorResponseSchema,
|
|
462
462
|
},
|
|
463
463
|
body: exports.CreateDraftJobSchema,
|
|
464
|
-
summary:
|
|
465
|
-
metadata: { tags: [
|
|
464
|
+
summary: 'Create a draft job (without collaboration)',
|
|
465
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'createDraftJob' } },
|
|
466
466
|
},
|
|
467
467
|
findAll: {
|
|
468
|
-
method:
|
|
469
|
-
path:
|
|
468
|
+
method: 'GET',
|
|
469
|
+
path: '/v2/jobs',
|
|
470
470
|
responses: {
|
|
471
471
|
200: exports.PaginatedJobResponseSchema,
|
|
472
472
|
},
|
|
473
473
|
query: exports.FilterJobSchema,
|
|
474
|
-
summary:
|
|
475
|
-
metadata: { tags: [
|
|
474
|
+
summary: 'Get all jobs',
|
|
475
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'findAllJobs' } },
|
|
476
476
|
},
|
|
477
477
|
search: {
|
|
478
|
-
method:
|
|
479
|
-
path:
|
|
478
|
+
method: 'GET',
|
|
479
|
+
path: '/v2/jobs/search',
|
|
480
480
|
responses: {
|
|
481
481
|
200: exports.SearchJobResponseSchema,
|
|
482
482
|
},
|
|
483
483
|
query: exports.SearchJobQuerySchema,
|
|
484
|
-
summary:
|
|
485
|
-
metadata: { tags: [
|
|
484
|
+
summary: 'Search for similar jobs using trigram similarity',
|
|
485
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'searchJobs' } },
|
|
486
486
|
},
|
|
487
487
|
findOne: {
|
|
488
|
-
method:
|
|
489
|
-
path:
|
|
488
|
+
method: 'GET',
|
|
489
|
+
path: '/v2/jobs/:id',
|
|
490
490
|
responses: {
|
|
491
491
|
200: exports.JobSchema,
|
|
492
492
|
404: error_schemas_1.ErrorResponseSchema,
|
|
493
493
|
},
|
|
494
494
|
pathParams: zod_1.z.object({
|
|
495
|
-
id: zod_1.z.string().uuid().describe(
|
|
495
|
+
id: zod_1.z.string().uuid().describe('Job ID'),
|
|
496
496
|
}),
|
|
497
|
-
summary:
|
|
498
|
-
metadata: { tags: [
|
|
497
|
+
summary: 'Get a job by ID',
|
|
498
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'findJobById' } },
|
|
499
499
|
},
|
|
500
500
|
update: {
|
|
501
|
-
method:
|
|
502
|
-
path:
|
|
501
|
+
method: 'PATCH',
|
|
502
|
+
path: '/v2/jobs/:id',
|
|
503
503
|
responses: {
|
|
504
504
|
200: exports.JobSchema,
|
|
505
505
|
404: error_schemas_1.ErrorResponseSchema,
|
|
506
506
|
409: error_schemas_1.ErrorResponseSchema,
|
|
507
507
|
},
|
|
508
508
|
pathParams: zod_1.z.object({
|
|
509
|
-
id: zod_1.z.string().uuid().describe(
|
|
509
|
+
id: zod_1.z.string().uuid().describe('Job ID'),
|
|
510
510
|
}),
|
|
511
511
|
body: exports.UpdateJobSchema,
|
|
512
|
-
summary:
|
|
513
|
-
metadata: { tags: [
|
|
512
|
+
summary: 'Update a job',
|
|
513
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'updateJob' } },
|
|
514
514
|
},
|
|
515
515
|
remove: {
|
|
516
|
-
method:
|
|
517
|
-
path:
|
|
516
|
+
method: 'DELETE',
|
|
517
|
+
path: '/v2/jobs/:id',
|
|
518
518
|
responses: {
|
|
519
519
|
204: zod_1.z.undefined(),
|
|
520
520
|
404: error_schemas_1.ErrorResponseSchema,
|
|
521
521
|
},
|
|
522
522
|
pathParams: zod_1.z.object({
|
|
523
|
-
id: zod_1.z.string().uuid().describe(
|
|
523
|
+
id: zod_1.z.string().uuid().describe('Job ID'),
|
|
524
524
|
}),
|
|
525
525
|
body: c.noBody(),
|
|
526
|
-
summary:
|
|
527
|
-
metadata: { tags: [
|
|
526
|
+
summary: 'Delete a job',
|
|
527
|
+
metadata: { tags: ['Jobs'], openApi: { operationId: 'deleteJob' } },
|
|
528
528
|
},
|
|
529
529
|
}, {
|
|
530
530
|
commonResponses: {
|