@dakkitor/api-contracts 1.1.10 → 1.1.11
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/actives/actives.contract.d.ts +104 -104
- package/dist/actives/actives.contract.d.ts.map +1 -1
- package/dist/actives/actives.contract.js +3 -6
- package/dist/agent-client-links/agent-client-links.contract.d.ts +1905 -0
- package/dist/agent-client-links/agent-client-links.contract.d.ts.map +1 -0
- package/dist/agent-client-links/agent-client-links.contract.js +127 -0
- package/dist/auth/auth.contract.d.ts +319 -0
- package/dist/auth/auth.contract.d.ts.map +1 -0
- package/dist/auth/auth.contract.js +63 -0
- package/dist/bookings/bookings.contract.d.ts +273 -182
- package/dist/bookings/bookings.contract.d.ts.map +1 -1
- package/dist/bookings/bookings.contract.js +25 -33
- package/dist/call-history/call-history.contract.d.ts +1164 -0
- package/dist/call-history/call-history.contract.d.ts.map +1 -0
- package/dist/call-history/call-history.contract.js +254 -0
- package/dist/client-contacts/client-contacts.contract.d.ts +215 -268
- package/dist/client-contacts/client-contacts.contract.d.ts.map +1 -1
- package/dist/client-contacts/client-contacts.contract.js +21 -10
- package/dist/clients/clients.contract.d.ts +153 -125
- package/dist/clients/clients.contract.d.ts.map +1 -1
- package/dist/clients/clients.contract.js +44 -29
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts +3013 -0
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts.map +1 -0
- package/dist/collaboration-checkings/collaboration-checkings.contract.js +247 -0
- package/dist/collaborations/collaborations.contract.d.ts +2229 -0
- package/dist/collaborations/collaborations.contract.d.ts.map +1 -0
- package/dist/collaborations/collaborations.contract.js +284 -0
- package/dist/common/common-schemas.d.ts +100 -0
- package/dist/common/common-schemas.d.ts.map +1 -1
- package/dist/common/common-schemas.js +268 -1
- package/dist/common/openapi-metadata.d.ts +6 -0
- package/dist/common/openapi-metadata.d.ts.map +1 -1
- package/dist/companies/companies.contract.d.ts +1108 -0
- package/dist/companies/companies.contract.d.ts.map +1 -0
- package/dist/companies/companies.contract.js +164 -0
- package/dist/cron-executions/cron-executions.contract.d.ts +1643 -0
- package/dist/cron-executions/cron-executions.contract.d.ts.map +1 -0
- package/dist/cron-executions/cron-executions.contract.js +271 -0
- package/dist/curated-workers/curated-workers.contract.d.ts +3183 -0
- package/dist/curated-workers/curated-workers.contract.d.ts.map +1 -0
- package/dist/curated-workers/curated-workers.contract.js +444 -0
- package/dist/dashboards/agent-daily-metrics.contract.d.ts +639 -0
- package/dist/dashboards/agent-daily-metrics.contract.d.ts.map +1 -0
- package/dist/dashboards/agent-daily-metrics.contract.js +118 -0
- package/dist/files/files.contract.d.ts +1258 -0
- package/dist/files/files.contract.d.ts.map +1 -0
- package/dist/files/files.contract.js +205 -0
- package/dist/health/health.contract.d.ts +161 -0
- package/dist/health/health.contract.d.ts.map +1 -0
- package/dist/health/health.contract.js +52 -0
- package/dist/index.d.ts +27370 -3319
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -0
- package/dist/jobs/jobs.contract.d.ts +2303 -0
- package/dist/jobs/jobs.contract.d.ts.map +1 -0
- package/dist/jobs/jobs.contract.js +295 -0
- package/dist/lead-assignments/lead-assignments.contract.d.ts +1826 -0
- package/dist/lead-assignments/lead-assignments.contract.d.ts.map +1 -0
- package/dist/lead-assignments/lead-assignments.contract.js +187 -0
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts +1147 -0
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts.map +1 -0
- package/dist/lead-distribution/agent-lead-distribution.contract.js +154 -0
- package/dist/lead-distribution/lead-distribution-config.contract.d.ts +1085 -0
- package/dist/lead-distribution/lead-distribution-config.contract.d.ts.map +1 -0
- package/dist/lead-distribution/lead-distribution-config.contract.js +196 -0
- package/dist/leads/leads.contract.d.ts +1690 -0
- package/dist/leads/leads.contract.d.ts.map +1 -0
- package/dist/leads/leads.contract.js +328 -0
- package/dist/locations/locations.contract.d.ts +974 -0
- package/dist/locations/locations.contract.d.ts.map +1 -0
- package/dist/locations/locations.contract.js +154 -0
- package/dist/postcodes/postcodes.contract.d.ts +370 -0
- package/dist/postcodes/postcodes.contract.d.ts.map +1 -0
- package/dist/postcodes/postcodes.contract.js +90 -0
- package/dist/qualifications/qualifications.contract.d.ts +1489 -0
- package/dist/qualifications/qualifications.contract.d.ts.map +1 -0
- package/dist/qualifications/qualifications.contract.js +215 -0
- package/dist/trades/trades.contract.d.ts +799 -0
- package/dist/trades/trades.contract.d.ts.map +1 -0
- package/dist/trades/trades.contract.js +112 -0
- package/dist/users/users.contract.d.ts +102 -96
- package/dist/users/users.contract.d.ts.map +1 -1
- package/dist/users/users.contract.js +9 -21
- package/dist/workers/workers.contract.d.ts +3376 -0
- package/dist/workers/workers.contract.d.ts.map +1 -0
- package/dist/workers/workers.contract.js +363 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workers.contract.d.ts","sourceRoot":"","sources":["../../contracts/workers/workers.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,MAAM,kBAAkB,gEAI7B,CAAC;AAIH,eAAO,MAAM,gBAAgB,6DAEM,CAAC;AAEpC,eAAO,MAAM,0BAA0B,yEAEM,CAAC;AAI9C,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAOM,CAAC;AAE3C,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAMM,CAAC;AAEjD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;EAOM,CAAC;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAOM,CAAC;AAErC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAMM,CAAC;AAE3C,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EAsBM,CAAC;AAE7C,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;EASM,CAAC;AAEnD,eAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFjC,CAAC"}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workersContractRouter = exports.PaginatedWorkerResponseSchema = exports.FilterWorkerSchema = exports.UpdateWorkerSchema = exports.CreateWorkerSchema = exports.WorkerSchema = exports.WorkerUserSchema = exports.TradeFilterSchema = exports.ShareCodeSchema = exports.CreateWorkerQualificationSchema = exports.WorkerQualificationSchema = exports.CreateWorkerTradeSchema = exports.WorkerTradeSchema = exports.UpsertWorkerPhoneNumberSchema = exports.CreateWorkerPhoneNumberSchema = exports.WorkerPhoneNumberSchema = exports.WorkerSortableFieldsSchema = exports.SkillLevelSchema = exports.AvailabilitySchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@anatine/zod-openapi");
|
|
5
|
+
const core_1 = require("@ts-rest/core");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const common_schemas_1 = require("../common/common-schemas");
|
|
8
|
+
const error_schemas_1 = require("../common/error-schemas");
|
|
9
|
+
const pagination_query_schema_1 = require("../common/pagination-query.schema");
|
|
10
|
+
const pagination_schema_1 = require("../common/pagination.schema");
|
|
11
|
+
(0, zod_openapi_1.extendZodWithOpenApi)(zod_1.z);
|
|
12
|
+
// --- Enums ---
|
|
13
|
+
exports.AvailabilitySchema = zod_1.z.enum([
|
|
14
|
+
'AVAILABLE',
|
|
15
|
+
'PARTIALLY_AVAILABLE',
|
|
16
|
+
'UNAVAILABLE',
|
|
17
|
+
]);
|
|
18
|
+
// EnglishLevelSchema and NationalitySchema are now imported from common-schemas
|
|
19
|
+
exports.SkillLevelSchema = zod_1.z
|
|
20
|
+
.enum(['LABOURER', 'SKILLED', 'SUPERVISOR', 'MANAGER'])
|
|
21
|
+
.openapi({ title: 'SkillLevel' });
|
|
22
|
+
exports.WorkerSortableFieldsSchema = zod_1.z
|
|
23
|
+
.enum(['nameSimilarity', 'fullName', 'distance', 'email', 'phone'])
|
|
24
|
+
.openapi({ title: 'WorkerSortableFields' });
|
|
25
|
+
// --- Nested Schemas ---
|
|
26
|
+
exports.WorkerPhoneNumberSchema = zod_1.z
|
|
27
|
+
.object({
|
|
28
|
+
id: zod_1.z.string().uuid().optional(),
|
|
29
|
+
phoneNumber: zod_1.z.string(),
|
|
30
|
+
description: zod_1.z.string().optional(),
|
|
31
|
+
isPrimary: zod_1.z.boolean().default(false),
|
|
32
|
+
})
|
|
33
|
+
.openapi({ title: 'WorkerPhoneNumber' });
|
|
34
|
+
exports.CreateWorkerPhoneNumberSchema = zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
phoneNumber: zod_1.z.string(),
|
|
37
|
+
description: zod_1.z.string().max(100).optional(),
|
|
38
|
+
isPrimary: zod_1.z.boolean().default(false),
|
|
39
|
+
})
|
|
40
|
+
.openapi({ title: 'CreateWorkerPhoneNumber' });
|
|
41
|
+
exports.UpsertWorkerPhoneNumberSchema = zod_1.z
|
|
42
|
+
.object({
|
|
43
|
+
id: zod_1.z.string().uuid().optional(),
|
|
44
|
+
phoneNumber: zod_1.z.string().optional(),
|
|
45
|
+
description: zod_1.z.string().optional(),
|
|
46
|
+
isPrimary: zod_1.z.boolean().optional(),
|
|
47
|
+
})
|
|
48
|
+
.openapi({ title: 'UpsertWorkerPhoneNumber' });
|
|
49
|
+
exports.WorkerTradeSchema = zod_1.z
|
|
50
|
+
.object({
|
|
51
|
+
id: zod_1.z.string().uuid().optional(),
|
|
52
|
+
tradeId: zod_1.z.string().uuid(),
|
|
53
|
+
mainTrade: zod_1.z.boolean().default(false),
|
|
54
|
+
skillLevel: exports.SkillLevelSchema.optional().nullable(),
|
|
55
|
+
})
|
|
56
|
+
.openapi({ title: 'WorkerTrade' });
|
|
57
|
+
exports.CreateWorkerTradeSchema = zod_1.z
|
|
58
|
+
.object({
|
|
59
|
+
tradeId: zod_1.z.string().uuid(),
|
|
60
|
+
mainTrade: zod_1.z.boolean().default(false),
|
|
61
|
+
skillLevel: exports.SkillLevelSchema.optional().nullable(),
|
|
62
|
+
})
|
|
63
|
+
.openapi({ title: 'CreateWorkerTrade' });
|
|
64
|
+
exports.WorkerQualificationSchema = zod_1.z
|
|
65
|
+
.object({
|
|
66
|
+
id: zod_1.z.string().uuid().optional(),
|
|
67
|
+
qualificationId: zod_1.z.string().uuid(),
|
|
68
|
+
qualificationTypeId: zod_1.z.string().uuid(),
|
|
69
|
+
issueDate: zod_1.z
|
|
70
|
+
.union([zod_1.z.string().date(), zod_1.z.date()])
|
|
71
|
+
.transform((val) => val instanceof Date ? val.toISOString().split('T')[0] : val)
|
|
72
|
+
.optional()
|
|
73
|
+
.nullable(),
|
|
74
|
+
expiryDate: zod_1.z
|
|
75
|
+
.union([zod_1.z.string().date(), zod_1.z.date()])
|
|
76
|
+
.transform((val) => val instanceof Date ? val.toISOString().split('T')[0] : val)
|
|
77
|
+
.optional()
|
|
78
|
+
.nullable(),
|
|
79
|
+
referenceNumber: zod_1.z.string().optional().nullable(),
|
|
80
|
+
proofDocumentFileId: zod_1.z.string().uuid().optional().nullable(),
|
|
81
|
+
})
|
|
82
|
+
.openapi({ title: 'WorkerQualification' });
|
|
83
|
+
exports.CreateWorkerQualificationSchema = zod_1.z
|
|
84
|
+
.object({
|
|
85
|
+
qualificationId: zod_1.z.string().uuid(),
|
|
86
|
+
qualificationTypeId: zod_1.z.string().uuid().optional().nullable(),
|
|
87
|
+
issueDate: zod_1.z.string().date().optional().nullable(),
|
|
88
|
+
expiryDate: zod_1.z.string().date().optional().nullable(),
|
|
89
|
+
referenceNumber: zod_1.z.string().max(255).optional().nullable(),
|
|
90
|
+
proofDocumentFileId: zod_1.z.string().uuid().optional().nullable(),
|
|
91
|
+
})
|
|
92
|
+
.openapi({ title: 'CreateWorkerQualification' });
|
|
93
|
+
exports.ShareCodeSchema = zod_1.z
|
|
94
|
+
.object({
|
|
95
|
+
code: zod_1.z
|
|
96
|
+
.string()
|
|
97
|
+
.min(0)
|
|
98
|
+
.max(9)
|
|
99
|
+
.regex(/^(?:[A-Z0-9]{9})?$/),
|
|
100
|
+
expiryDate: zod_1.z
|
|
101
|
+
.union([zod_1.z.string().date(), zod_1.z.date()])
|
|
102
|
+
.transform((val) => val instanceof Date ? val.toISOString().split('T')[0] : val)
|
|
103
|
+
.optional()
|
|
104
|
+
.nullable(),
|
|
105
|
+
})
|
|
106
|
+
.openapi({ title: 'ShareCode' });
|
|
107
|
+
exports.TradeFilterSchema = zod_1.z
|
|
108
|
+
.object({
|
|
109
|
+
tradeId: zod_1.z.string().uuid(),
|
|
110
|
+
skillLevel: exports.SkillLevelSchema.optional(),
|
|
111
|
+
mainTrade: zod_1.z.boolean().optional(),
|
|
112
|
+
})
|
|
113
|
+
.openapi({ title: 'TradeFilter' });
|
|
114
|
+
exports.WorkerUserSchema = zod_1.z.object({
|
|
115
|
+
id: zod_1.z.string().uuid(),
|
|
116
|
+
firstName: zod_1.z.string(),
|
|
117
|
+
lastName: zod_1.z.string(),
|
|
118
|
+
email: zod_1.z.string().email(),
|
|
119
|
+
});
|
|
120
|
+
// --- Main Schemas ---
|
|
121
|
+
exports.WorkerSchema = zod_1.z
|
|
122
|
+
.object({
|
|
123
|
+
id: zod_1.z.string().uuid().describe('Worker ID'),
|
|
124
|
+
firstName: zod_1.z.string().describe('First Name'),
|
|
125
|
+
lastName: zod_1.z.string().describe('Last Name'),
|
|
126
|
+
email: zod_1.z.string().email().nullable().optional().describe('Email'),
|
|
127
|
+
phoneNumbers: zod_1.z.array(exports.WorkerPhoneNumberSchema).describe('Phone Numbers'),
|
|
128
|
+
nino: zod_1.z
|
|
129
|
+
.string()
|
|
130
|
+
.nullable()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe('National Insurance Number'),
|
|
133
|
+
dateOfBirth: zod_1.z
|
|
134
|
+
.union([zod_1.z.string().date(), zod_1.z.date()])
|
|
135
|
+
.transform((val) => val instanceof Date ? val.toISOString().split('T')[0] : val)
|
|
136
|
+
.nullable()
|
|
137
|
+
.optional()
|
|
138
|
+
.describe('Date of Birth'),
|
|
139
|
+
bio: zod_1.z.string().nullable().optional().describe('Bio'),
|
|
140
|
+
availability: exports.AvailabilitySchema.describe('Availability'),
|
|
141
|
+
trades: zod_1.z.array(exports.WorkerTradeSchema).optional().describe('Trades'),
|
|
142
|
+
qualifications: zod_1.z
|
|
143
|
+
.array(exports.WorkerQualificationSchema)
|
|
144
|
+
.optional()
|
|
145
|
+
.describe('Qualifications'),
|
|
146
|
+
englishLevel: common_schemas_1.EnglishLevelSchema.nullable()
|
|
147
|
+
.optional()
|
|
148
|
+
.describe('English Level'),
|
|
149
|
+
nationality: common_schemas_1.NationalitySchema.nullable()
|
|
150
|
+
.optional()
|
|
151
|
+
.describe('Nationality'),
|
|
152
|
+
hasTools: zod_1.z.boolean().describe('Has Tools'),
|
|
153
|
+
hasPpe: zod_1.z.boolean().describe('Has PPE'),
|
|
154
|
+
location: common_schemas_1.LocationDetailsSchema.nullable().optional().describe('Location'),
|
|
155
|
+
shareCode: exports.ShareCodeSchema.nullable().optional().describe('Share Code'),
|
|
156
|
+
createdByUserId: zod_1.z
|
|
157
|
+
.string()
|
|
158
|
+
.uuid()
|
|
159
|
+
.nullable()
|
|
160
|
+
.optional()
|
|
161
|
+
.describe('Created By User ID'),
|
|
162
|
+
createdBy: exports.WorkerUserSchema.nullable()
|
|
163
|
+
.optional()
|
|
164
|
+
.describe('Created By User'),
|
|
165
|
+
distanceKm: zod_1.z.number().nullable().optional().describe('Distance in KM'),
|
|
166
|
+
createdAt: zod_1.z
|
|
167
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
168
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
169
|
+
.describe('Creation Date'),
|
|
170
|
+
updatedAt: zod_1.z
|
|
171
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
172
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
173
|
+
.describe('Last Update Date'),
|
|
174
|
+
})
|
|
175
|
+
.openapi({ title: 'Worker' });
|
|
176
|
+
exports.CreateWorkerSchema = zod_1.z
|
|
177
|
+
.object({
|
|
178
|
+
firstName: zod_1.z.string().min(3).max(100).describe('First Name'),
|
|
179
|
+
lastName: zod_1.z.string().min(3).max(100).describe('Last Name'),
|
|
180
|
+
email: zod_1.z.string().email().optional().nullable().describe('Email'),
|
|
181
|
+
phoneNumbers: zod_1.z
|
|
182
|
+
.array(exports.CreateWorkerPhoneNumberSchema)
|
|
183
|
+
.min(1)
|
|
184
|
+
.describe('Phone Numbers'),
|
|
185
|
+
nino: zod_1.z
|
|
186
|
+
.string()
|
|
187
|
+
.regex(/^(?:[A-Z]{2}[0-9]{6}[A-D])?$/)
|
|
188
|
+
.optional()
|
|
189
|
+
.nullable()
|
|
190
|
+
.describe('National Insurance Number'),
|
|
191
|
+
dateOfBirth: zod_1.z
|
|
192
|
+
.union([zod_1.z.string().date(), zod_1.z.date()])
|
|
193
|
+
.optional()
|
|
194
|
+
.nullable()
|
|
195
|
+
.describe('Date of Birth'),
|
|
196
|
+
bio: zod_1.z.string().optional().nullable().describe('Bio'),
|
|
197
|
+
availability: exports.AvailabilitySchema.optional()
|
|
198
|
+
.default('AVAILABLE')
|
|
199
|
+
.describe('Availability'),
|
|
200
|
+
trades: zod_1.z.array(exports.CreateWorkerTradeSchema).min(1).max(10).describe('Trades'),
|
|
201
|
+
qualifications: zod_1.z
|
|
202
|
+
.array(exports.CreateWorkerQualificationSchema)
|
|
203
|
+
.optional()
|
|
204
|
+
.nullable()
|
|
205
|
+
.describe('Qualifications'),
|
|
206
|
+
englishLevel: common_schemas_1.EnglishLevelSchema.optional()
|
|
207
|
+
.nullable()
|
|
208
|
+
.describe('English Level'),
|
|
209
|
+
nationality: common_schemas_1.NationalitySchema.optional()
|
|
210
|
+
.nullable()
|
|
211
|
+
.describe('Nationality'),
|
|
212
|
+
hasTools: zod_1.z.boolean().describe('Has Tools'),
|
|
213
|
+
hasPpe: zod_1.z.boolean().describe('Has PPE'),
|
|
214
|
+
location: common_schemas_1.CreateLocationSchema.optional().nullable().describe('Location'),
|
|
215
|
+
shareCode: exports.ShareCodeSchema.optional().nullable().describe('Share Code'),
|
|
216
|
+
})
|
|
217
|
+
.openapi({ title: 'CreateWorker' });
|
|
218
|
+
exports.UpdateWorkerSchema = zod_1.z
|
|
219
|
+
.object({
|
|
220
|
+
firstName: zod_1.z.string().min(3).max(100).optional().describe('First Name'),
|
|
221
|
+
lastName: zod_1.z.string().min(3).max(100).optional().describe('Last Name'),
|
|
222
|
+
email: zod_1.z.string().email().optional().nullable().describe('Email'),
|
|
223
|
+
phoneNumbers: zod_1.z
|
|
224
|
+
.array(exports.UpsertWorkerPhoneNumberSchema)
|
|
225
|
+
.optional()
|
|
226
|
+
.describe('Phone Numbers'),
|
|
227
|
+
nino: zod_1.z
|
|
228
|
+
.string()
|
|
229
|
+
.regex(/^(?:[A-Z]{2}[0-9]{6}[A-D])?$/)
|
|
230
|
+
.optional()
|
|
231
|
+
.nullable()
|
|
232
|
+
.describe('National Insurance Number'),
|
|
233
|
+
dateOfBirth: zod_1.z
|
|
234
|
+
.union([zod_1.z.string().date(), zod_1.z.date()])
|
|
235
|
+
.optional()
|
|
236
|
+
.nullable()
|
|
237
|
+
.describe('Date of Birth'),
|
|
238
|
+
bio: zod_1.z.string().optional().nullable().describe('Bio'),
|
|
239
|
+
availability: exports.AvailabilitySchema.optional().describe('Availability'),
|
|
240
|
+
trades: zod_1.z.array(exports.WorkerTradeSchema).optional().describe('Trades'),
|
|
241
|
+
qualifications: zod_1.z
|
|
242
|
+
.array(exports.WorkerQualificationSchema)
|
|
243
|
+
.optional()
|
|
244
|
+
.nullable()
|
|
245
|
+
.describe('Qualifications'),
|
|
246
|
+
englishLevel: common_schemas_1.EnglishLevelSchema.optional()
|
|
247
|
+
.nullable()
|
|
248
|
+
.describe('English Level'),
|
|
249
|
+
nationality: common_schemas_1.NationalitySchema.optional()
|
|
250
|
+
.nullable()
|
|
251
|
+
.describe('Nationality'),
|
|
252
|
+
hasTools: zod_1.z.boolean().optional().describe('Has Tools'),
|
|
253
|
+
hasPpe: zod_1.z.boolean().optional().describe('Has PPE'),
|
|
254
|
+
location: common_schemas_1.CreateLocationSchema.optional().nullable().describe('Location'),
|
|
255
|
+
shareCode: exports.ShareCodeSchema.optional().nullable().describe('Share Code'),
|
|
256
|
+
})
|
|
257
|
+
.openapi({ title: 'UpdateWorker' });
|
|
258
|
+
exports.FilterWorkerSchema = pagination_query_schema_1.PaginationQuerySchema.extend({
|
|
259
|
+
searchTerm: zod_1.z.string().optional().describe('Search by name, email, or phone'),
|
|
260
|
+
availability: exports.AvailabilitySchema.optional()
|
|
261
|
+
.nullable()
|
|
262
|
+
.describe('Filter by availability'),
|
|
263
|
+
tradeFilters: zod_1.z
|
|
264
|
+
.array(exports.TradeFilterSchema)
|
|
265
|
+
.optional()
|
|
266
|
+
.describe('Filter by trades'),
|
|
267
|
+
sortBy: exports.WorkerSortableFieldsSchema.optional()
|
|
268
|
+
.nullable()
|
|
269
|
+
.describe('Sort by field'),
|
|
270
|
+
sortOrder: common_schemas_1.SortOrderSchema.optional().nullable().describe('Sort order'),
|
|
271
|
+
latitude: zod_1.z.coerce
|
|
272
|
+
.number()
|
|
273
|
+
.optional()
|
|
274
|
+
.describe('Latitude for distance search'),
|
|
275
|
+
longitude: zod_1.z.coerce
|
|
276
|
+
.number()
|
|
277
|
+
.optional()
|
|
278
|
+
.describe('Longitude for distance search'),
|
|
279
|
+
radiusKm: zod_1.z.coerce.number().optional().describe('Radius in KM'),
|
|
280
|
+
});
|
|
281
|
+
exports.PaginatedWorkerResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.WorkerSchema)
|
|
282
|
+
.describe('Workers retrieved successfully.')
|
|
283
|
+
.openapi({ title: 'WorkersPaginatedResponse' });
|
|
284
|
+
// --- Contract ---
|
|
285
|
+
const c = (0, core_1.initContract)();
|
|
286
|
+
exports.workersContractRouter = c.router({
|
|
287
|
+
create: {
|
|
288
|
+
method: 'POST',
|
|
289
|
+
path: '/v2/workers',
|
|
290
|
+
responses: {
|
|
291
|
+
201: exports.WorkerSchema,
|
|
292
|
+
409: error_schemas_1.ErrorResponseSchema,
|
|
293
|
+
},
|
|
294
|
+
body: exports.CreateWorkerSchema,
|
|
295
|
+
summary: 'Create a new worker',
|
|
296
|
+
metadata: { tags: ['Workers'], openApi: { operationId: 'createWorker' } },
|
|
297
|
+
},
|
|
298
|
+
findAll: {
|
|
299
|
+
method: 'GET',
|
|
300
|
+
path: '/v2/workers',
|
|
301
|
+
responses: {
|
|
302
|
+
200: exports.PaginatedWorkerResponseSchema,
|
|
303
|
+
},
|
|
304
|
+
query: exports.FilterWorkerSchema,
|
|
305
|
+
summary: 'Get all workers',
|
|
306
|
+
metadata: {
|
|
307
|
+
tags: ['Workers'],
|
|
308
|
+
openApi: { operationId: 'findAllWorkers' },
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
findOne: {
|
|
312
|
+
method: 'GET',
|
|
313
|
+
path: '/v2/workers/:id',
|
|
314
|
+
responses: {
|
|
315
|
+
200: exports.WorkerSchema,
|
|
316
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
317
|
+
},
|
|
318
|
+
pathParams: zod_1.z.object({
|
|
319
|
+
id: zod_1.z.string().uuid().describe('Worker ID'),
|
|
320
|
+
}),
|
|
321
|
+
summary: 'Get a worker by ID',
|
|
322
|
+
metadata: {
|
|
323
|
+
tags: ['Workers'],
|
|
324
|
+
openApi: { operationId: 'findWorkerById' },
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
update: {
|
|
328
|
+
method: 'PATCH',
|
|
329
|
+
path: '/v2/workers/:id',
|
|
330
|
+
responses: {
|
|
331
|
+
200: exports.WorkerSchema,
|
|
332
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
333
|
+
409: error_schemas_1.ErrorResponseSchema,
|
|
334
|
+
},
|
|
335
|
+
pathParams: zod_1.z.object({
|
|
336
|
+
id: zod_1.z.string().uuid().describe('Worker ID'),
|
|
337
|
+
}),
|
|
338
|
+
body: exports.UpdateWorkerSchema,
|
|
339
|
+
summary: 'Update a worker',
|
|
340
|
+
metadata: { tags: ['Workers'], openApi: { operationId: 'updateWorker' } },
|
|
341
|
+
},
|
|
342
|
+
remove: {
|
|
343
|
+
method: 'DELETE',
|
|
344
|
+
path: '/v2/workers/:id',
|
|
345
|
+
responses: {
|
|
346
|
+
204: zod_1.z.undefined(),
|
|
347
|
+
404: error_schemas_1.ErrorResponseSchema,
|
|
348
|
+
},
|
|
349
|
+
pathParams: zod_1.z.object({
|
|
350
|
+
id: zod_1.z.string().uuid().describe('Worker ID'),
|
|
351
|
+
}),
|
|
352
|
+
body: c.noBody(),
|
|
353
|
+
summary: 'Delete a worker',
|
|
354
|
+
metadata: { tags: ['Workers'], openApi: { operationId: 'deleteWorker' } },
|
|
355
|
+
},
|
|
356
|
+
}, {
|
|
357
|
+
commonResponses: {
|
|
358
|
+
400: error_schemas_1.ErrorResponseSchema,
|
|
359
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
360
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
361
|
+
500: error_schemas_1.ErrorResponseSchema,
|
|
362
|
+
},
|
|
363
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dakkitor/api-contracts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "TypeScript API contracts using ts-rest and Zod",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"watch": "tsc --watch",
|
|
12
13
|
"prepublishOnly": "npm run build",
|
|
13
14
|
"test": "echo \"No tests yet\" && exit 0"
|
|
14
15
|
},
|
|
@@ -23,11 +24,11 @@
|
|
|
23
24
|
"author": "Doru",
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"peerDependencies": {
|
|
26
|
-
"@ts-rest/core": "^3.
|
|
27
|
+
"@ts-rest/core": "^3.52.1",
|
|
27
28
|
"zod": "^3.25.55"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@ts-rest/core": "^3.
|
|
31
|
+
"@ts-rest/core": "^3.52.1",
|
|
31
32
|
"typescript": "^5.3.3"
|
|
32
33
|
},
|
|
33
34
|
"publishConfig": {
|