@dakkitor/api-contracts 1.1.129 → 1.1.131

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.
@@ -12,64 +12,64 @@ const pagination_schema_1 = require("../common/pagination.schema");
12
12
  (0, zod_openapi_1.extendZodWithOpenApi)(zod_1.z);
13
13
  // Enums
14
14
  exports.ActiveStatusSchema = zod_1.z.enum([
15
- 'PENDING',
16
- 'ACTIVE',
17
- 'VACATION',
18
- 'LEFT_THE_SITE',
19
- 'MEDICAL_LEAVE',
20
- 'DAY_OFF',
21
- 'INJURY',
15
+ "PENDING",
16
+ "ACTIVE",
17
+ "VACATION",
18
+ "LEFT_THE_SITE",
19
+ "MEDICAL_LEAVE",
20
+ "DAY_OFF",
21
+ "INJURY",
22
22
  ]);
23
23
  exports.ActiveStatusFilterTypeSchema = zod_1.z.enum([
24
- 'SECOND_AGENT',
25
- 'FIRST_AGENT',
26
- 'BOTH',
27
- 'EITHER',
24
+ "SECOND_AGENT",
25
+ "FIRST_AGENT",
26
+ "BOTH",
27
+ "EITHER",
28
28
  ]);
29
29
  exports.ActiveSortableFieldsSchema = zod_1.z.enum([
30
- 'date',
31
- 'payRate',
32
- 'status',
33
- 'updatedAt',
30
+ "date",
31
+ "payRate",
32
+ "status",
33
+ "updatedAt",
34
34
  ]);
35
35
  // Active Pay schema - includes receivedRate
36
36
  const ActivePaySchema = zod_1.z
37
37
  .object({
38
- rate: zod_1.z.coerce.number().min(0).describe('Pay Rate'),
39
- unit: common_schemas_1.RateUnitSchema.describe('Pay Unit'),
38
+ rate: zod_1.z.coerce.number().min(0).describe("Pay Rate"),
39
+ unit: common_schemas_1.RateUnitSchema.describe("Pay Unit"),
40
40
  receivedRate: zod_1.z.coerce
41
41
  .number()
42
42
  .nullable()
43
- .describe('The received pay rate'),
43
+ .describe("The received pay rate"),
44
44
  })
45
- .openapi({ title: 'ActivePay' });
45
+ .openapi({ title: "ActivePay" });
46
46
  // Worker Pay schema for create/update (without receivedRate for SA)
47
47
  const WorkerPaySchema = zod_1.z.object({
48
- rate: zod_1.z.number().min(0).describe('Pay Rate'),
49
- unit: common_schemas_1.RateUnitSchema.describe('Pay Unit'),
48
+ rate: zod_1.z.number().min(0).describe("Pay Rate"),
49
+ unit: common_schemas_1.RateUnitSchema.describe("Pay Unit"),
50
50
  });
51
51
  // Active Pay update schema for FA - includes receivedRate
52
52
  const ActivePayUpdateSchema = zod_1.z
53
53
  .object({
54
- rate: zod_1.z.number().min(0).optional().describe('Pay Rate'),
55
- unit: common_schemas_1.RateUnitSchema.optional().describe('Pay Unit'),
54
+ rate: zod_1.z.number().min(0).optional().describe("Pay Rate"),
55
+ unit: common_schemas_1.RateUnitSchema.optional().describe("Pay Unit"),
56
56
  receivedRate: zod_1.z
57
57
  .number()
58
58
  .min(0)
59
59
  .optional()
60
60
  .nullable()
61
- .describe('Updated received rate'),
61
+ .describe("Updated received rate"),
62
62
  })
63
- .openapi({ title: 'ActivePayUpdate' });
63
+ .openapi({ title: "ActivePayUpdate" });
64
64
  // Active Status Filter
65
65
  const ActiveStatusFilterSchema = zod_1.z
66
66
  .object({
67
- status: exports.ActiveStatusSchema.optional().describe('Filter by status value'),
67
+ status: exports.ActiveStatusSchema.optional().describe("Filter by status value"),
68
68
  filterType: exports.ActiveStatusFilterTypeSchema.optional()
69
- .default('EITHER')
70
- .describe('Status filter type: SECOND_AGENT (check only SA status), FIRST_AGENT (check only FA status), BOTH (both statuses must be the same), EITHER (either SA or FA status can match)'),
69
+ .default("EITHER")
70
+ .describe("Status filter type: SECOND_AGENT (check only SA status), FIRST_AGENT (check only FA status), BOTH (both statuses must be the same), EITHER (either SA or FA status can match)"),
71
71
  })
72
- .openapi({ title: 'ActiveStatusFilter' });
72
+ .openapi({ title: "ActiveStatusFilter" });
73
73
  // ============================================================================
74
74
  // Main Active schema
75
75
  // ============================================================================
@@ -78,32 +78,32 @@ exports.ActiveSchema = zod_1.z
78
78
  id: zod_1.z
79
79
  .string()
80
80
  .uuid()
81
- .describe('The unique identifier of the active record.'),
82
- date: zod_1.z.string().date().describe('The date when the worker was active.'),
83
- pay: ActivePaySchema.describe('Pay Information'),
84
- comment: zod_1.z.string().nullable().describe('Optional comment for the day.'),
85
- statusSa: exports.ActiveStatusSchema.describe('Filter by status value.'),
81
+ .describe("The unique identifier of the active record."),
82
+ date: zod_1.z.string().date().describe("The date when the worker was active."),
83
+ pay: ActivePaySchema.describe("Pay Information"),
84
+ comment: zod_1.z.string().nullable().describe("Optional comment for the day."),
85
+ statusSa: exports.ActiveStatusSchema.describe("Filter by status value."),
86
86
  statusSaUpdatedAt: zod_1.z
87
87
  .union([zod_1.z.string().datetime(), zod_1.z.date(), zod_1.z.null()])
88
88
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
89
89
  .nullable()
90
- .describe('The timestamp when statusSa was last updated.'),
91
- statusFa: exports.ActiveStatusSchema.describe('Filter by status value.'),
90
+ .describe("The timestamp when statusSa was last updated."),
91
+ statusFa: exports.ActiveStatusSchema.describe("Filter by status value."),
92
92
  statusFaUpdatedAt: zod_1.z
93
93
  .union([zod_1.z.string().datetime(), zod_1.z.date(), zod_1.z.null()])
94
94
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
95
95
  .nullable()
96
- .describe('The timestamp when statusFa was last updated.'),
96
+ .describe("The timestamp when statusFa was last updated."),
97
97
  hoursWorked: zod_1.z.coerce
98
98
  .number()
99
99
  .nullable()
100
- .describe('The number of hours worked.'),
100
+ .describe("The number of hours worked."),
101
101
  hoursWorkedUpdatedAt: zod_1.z
102
102
  .union([zod_1.z.string().datetime(), zod_1.z.date(), zod_1.z.null()])
103
103
  .transform((val) => (val instanceof Date ? val.toISOString() : val))
104
104
  .nullable()
105
- .describe('The timestamp when hours worked was last updated.'),
106
- booking: zod_1.z.lazy(() => bookings_contract_1.BookingSchema).describe('Associated Booking'),
105
+ .describe("The timestamp when hours worked was last updated."),
106
+ booking: zod_1.z.lazy(() => bookings_contract_1.BookingSchema).describe("Associated Booking"),
107
107
  createdAt: zod_1.z
108
108
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
109
109
  .transform((val) => (val instanceof Date ? val.toISOString() : val)),
@@ -111,141 +111,141 @@ exports.ActiveSchema = zod_1.z
111
111
  .union([zod_1.z.string().datetime(), zod_1.z.date()])
112
112
  .transform((val) => (val instanceof Date ? val.toISOString() : val)),
113
113
  })
114
- .openapi({ title: 'Active' });
114
+ .openapi({ title: "Active" });
115
115
  // Create Active schema
116
116
  exports.CreateActiveSchema = zod_1.z
117
117
  .object({
118
- date: zod_1.z.string().date().describe('Select date'),
119
- pay: WorkerPaySchema.describe('Pay rate and unit'),
120
- comment: zod_1.z.string().optional().describe('Enter comment'),
121
- statusSa: exports.ActiveStatusSchema.optional().describe('Select SA status'),
122
- statusFa: exports.ActiveStatusSchema.optional().describe('Select FA status'),
118
+ date: zod_1.z.string().date().describe("Select date"),
119
+ pay: WorkerPaySchema.describe("Pay rate and unit"),
120
+ comment: zod_1.z.string().optional().describe("Enter comment"),
121
+ statusSa: exports.ActiveStatusSchema.optional().describe("Select SA status"),
122
+ statusFa: exports.ActiveStatusSchema.optional().describe("Select FA status"),
123
123
  })
124
- .openapi({ title: 'CreateActive' });
124
+ .openapi({ title: "CreateActive" });
125
125
  exports.UpdateActiveSchema = zod_1.z
126
126
  .object({
127
- pay: ActivePayUpdateSchema.optional().describe('Updated pay rate and unit'),
128
- hoursWorked: zod_1.z.number().min(0).optional().describe('Updated hours worked'),
129
- comment: zod_1.z.string().nullable().optional().describe('Updated comment'),
130
- statusSa: exports.ActiveStatusSchema.optional().describe('Updated SA status'),
131
- statusFa: exports.ActiveStatusSchema.optional().describe('Updated FA status'),
127
+ pay: ActivePayUpdateSchema.optional().describe("Updated pay rate and unit"),
128
+ hoursWorked: zod_1.z.number().min(0).optional().describe("Updated hours worked"),
129
+ comment: zod_1.z.string().nullable().optional().describe("Updated comment"),
130
+ statusSa: exports.ActiveStatusSchema.optional().describe("Updated SA status"),
131
+ statusFa: exports.ActiveStatusSchema.optional().describe("Updated FA status"),
132
132
  })
133
- .openapi({ title: 'UpdateActive' });
133
+ .openapi({ title: "UpdateActive" });
134
134
  // Filter Active schema
135
135
  exports.FilterActiveSchema = pagination_query_schema_1.PaginationQuerySchema.extend({
136
136
  workerName: zod_1.z
137
137
  .string()
138
138
  .optional()
139
139
  .nullable()
140
- .describe('Search worker by name'),
140
+ .describe("Search worker by name"),
141
141
  agentId: zod_1.z
142
142
  .string()
143
143
  .uuid()
144
144
  .optional()
145
145
  .nullable()
146
- .describe('Search Second Agent'),
146
+ .describe("Search Second Agent"),
147
147
  job: bookings_contract_1.FilterJobInBookingSchema.optional()
148
148
  .nullable()
149
- .describe('Filter by job details'),
150
- date: common_schemas_1.DateRangeSchema.optional().nullable().describe('Filter by date range'),
149
+ .describe("Filter by job details"),
150
+ date: common_schemas_1.DateRangeSchema.optional().nullable().describe("Filter by date range"),
151
151
  pay: common_schemas_1.PayRangeSchema.optional()
152
152
  .nullable()
153
- .describe('Filter by pay rate range'),
153
+ .describe("Filter by pay rate range"),
154
154
  status: ActiveStatusFilterSchema.optional()
155
155
  .nullable()
156
- .describe('Filter by status'),
156
+ .describe("Filter by status"),
157
157
  sortBy: exports.ActiveSortableFieldsSchema.optional()
158
158
  .nullable()
159
- .describe('The field to sort the results by'),
159
+ .describe("The field to sort the results by"),
160
160
  sortOrder: common_schemas_1.SortOrderSchema.optional()
161
161
  .nullable()
162
- .describe('The order to sort the results by'),
162
+ .describe("The order to sort the results by"),
163
163
  });
164
164
  exports.PaginatedActiveResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.ActiveSchema)
165
- .describe('Active records retrieved successfully')
166
- .openapi({ title: 'ActivesPaginatedResponse' });
165
+ .describe("Active records retrieved successfully")
166
+ .openapi({ title: "ActivesPaginatedResponse" });
167
167
  // Contract
168
168
  const c = (0, core_1.initContract)();
169
169
  exports.activesContractRouter = c.router({
170
170
  create: {
171
- method: 'POST',
172
- path: '/v2/bookings/:bookingId/actives',
171
+ method: "POST",
172
+ path: "/v2/bookings/:bookingId/actives",
173
173
  responses: {
174
174
  201: exports.ActiveSchema,
175
175
  404: error_schemas_1.ErrorResponseSchema,
176
176
  409: error_schemas_1.ErrorResponseSchema,
177
177
  },
178
178
  pathParams: zod_1.z.object({
179
- bookingId: zod_1.z.string().uuid().describe('Booking ID'),
179
+ bookingId: zod_1.z.string().uuid().describe("Booking ID"),
180
180
  }),
181
181
  body: exports.CreateActiveSchema,
182
- summary: 'Create a new active record for a specific booking',
182
+ summary: "Create a new active record for a specific booking",
183
183
  metadata: {
184
- tags: ['Actives'],
185
- openApi: { operationId: 'createActiveForBooking' },
184
+ tags: ["Actives"],
185
+ openApi: { operationId: "createActiveForBooking" },
186
186
  },
187
187
  },
188
188
  findAll: {
189
- method: 'GET',
190
- path: '/v2/actives',
189
+ method: "GET",
190
+ path: "/v2/actives",
191
191
  responses: {
192
192
  200: exports.PaginatedActiveResponseSchema,
193
193
  },
194
194
  query: exports.FilterActiveSchema,
195
- summary: 'Get all active records',
195
+ summary: "Get all active records",
196
196
  metadata: {
197
- tags: ['Actives'],
198
- openApi: { operationId: 'findAllActives' },
197
+ tags: ["Actives"],
198
+ openApi: { operationId: "findAllActives" },
199
199
  },
200
200
  },
201
201
  findOne: {
202
- method: 'GET',
203
- path: '/v2/actives/:id',
202
+ method: "GET",
203
+ path: "/v2/actives/:id",
204
204
  responses: {
205
205
  200: exports.ActiveSchema,
206
206
  404: error_schemas_1.ErrorResponseSchema,
207
207
  },
208
208
  pathParams: zod_1.z.object({
209
- id: zod_1.z.string().uuid().describe('Active Record ID'),
209
+ id: zod_1.z.string().uuid().describe("Active Record ID"),
210
210
  }),
211
- summary: 'Get an active record by ID',
211
+ summary: "Get an active record by ID",
212
212
  metadata: {
213
- tags: ['Actives'],
214
- openApi: { operationId: 'findActiveById' },
213
+ tags: ["Actives"],
214
+ openApi: { operationId: "findActiveById" },
215
215
  },
216
216
  },
217
217
  update: {
218
- method: 'PATCH',
219
- path: '/v2/actives/:id',
218
+ method: "PATCH",
219
+ path: "/v2/actives/:id",
220
220
  responses: {
221
221
  200: exports.ActiveSchema,
222
222
  404: error_schemas_1.ErrorResponseSchema,
223
223
  },
224
224
  pathParams: zod_1.z.object({
225
- id: zod_1.z.string().uuid().describe('Active Record ID'),
225
+ id: zod_1.z.string().uuid().describe("Active Record ID"),
226
226
  }),
227
227
  body: exports.UpdateActiveSchema,
228
- summary: 'Update an active record',
228
+ summary: "Update an active record",
229
229
  metadata: {
230
- tags: ['Actives'],
231
- openApi: { operationId: 'updateActive' },
230
+ tags: ["Actives"],
231
+ openApi: { operationId: "updateActive" },
232
232
  },
233
233
  },
234
234
  remove: {
235
- method: 'DELETE',
236
- path: '/v2/actives/:id',
235
+ method: "DELETE",
236
+ path: "/v2/actives/:id",
237
237
  responses: {
238
238
  204: zod_1.z.undefined(),
239
239
  404: error_schemas_1.ErrorResponseSchema,
240
240
  },
241
241
  pathParams: zod_1.z.object({
242
- id: zod_1.z.string().uuid().describe('Active Record ID'),
242
+ id: zod_1.z.string().uuid().describe("Active Record ID"),
243
243
  }),
244
244
  body: c.noBody(),
245
- summary: 'Delete an active record',
245
+ summary: "Delete an active record",
246
246
  metadata: {
247
- tags: ['Actives'],
248
- openApi: { operationId: 'deleteActive' },
247
+ tags: ["Actives"],
248
+ openApi: { operationId: "deleteActive" },
249
249
  },
250
250
  },
251
251
  }, {