vms-nest-prisma-api-document 229.0.0 → 230.0.0
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/core/Enums.d.ts +12 -1
- package/dist/core/Enums.js +15 -0
- package/dist/services/account/analytics/user_login_analytics_service.d.ts +3 -3
- package/dist/services/account/analytics/user_page_analytics_service.d.ts +1 -1
- package/dist/services/fleet/incident_management/incident_management_service.d.ts +70 -70
- package/dist/services/fleet/inspection_management/fleet_inspection_form_service.d.ts +16 -0
- package/dist/services/fleet/inspection_management/fleet_inspection_form_service.js +308 -0
- package/dist/services/fleet/inspection_management/fleet_inspection_management_service.d.ts +16 -0
- package/dist/services/fleet/inspection_management/fleet_inspection_management_service.js +501 -0
- package/dist/services/fleet/inspection_management/fleet_inspection_schedule_service.d.ts +697 -0
- package/dist/services/fleet/inspection_management/fleet_inspection_schedule_service.js +340 -0
- package/dist/services/fleet/service_management/fleet_service_management_service.d.ts +179 -46
- package/dist/services/fleet/service_management/fleet_service_management_service.js +86 -11
- package/dist/services/fleet/service_management/fleet_service_schedule_service.d.ts +166 -0
- package/dist/services/fleet/service_management/fleet_service_schedule_service.js +338 -0
- package/dist/services/gps/reports/gps_reports_mongo_service.d.ts +46 -46
- package/dist/services/master/expense/master_expense_name_service.d.ts +2 -2
- package/dist/services/master/fleet/master_fleet_incident_severity_service.d.ts +1 -1
- package/dist/services/master/fleet/master_fleet_incident_status_service.d.ts +1 -1
- package/dist/services/master/fleet/master_fleet_incident_type_service.d.ts +1 -1
- package/dist/services/master/fleet/master_fleet_insurance_claim_status_service.d.ts +1 -1
- package/dist/services/master/fleet/master_fleet_service_task_service.d.ts +1 -1
- package/dist/services/master/spare_part/master_spare_part_sub_category_service.d.ts +8 -8
- package/dist/services/website/faq_service.d.ts +1 -1
- package/dist/services/website/static_pages_service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
// src/core/sdk-config.ts
|
|
2
|
+
var KEY = "__vms_axios_instance__";
|
|
3
|
+
var getAxiosInstance = () => {
|
|
4
|
+
const instance = globalThis[KEY];
|
|
5
|
+
if (!instance) {
|
|
6
|
+
throw new Error("\u274C Axios instance not configured. Call setAxiosInstance() first.");
|
|
7
|
+
}
|
|
8
|
+
return instance;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/core/apiCall.ts
|
|
12
|
+
var apiPost = async (url, data) => {
|
|
13
|
+
const response = await getAxiosInstance().post(url, data);
|
|
14
|
+
return response.data;
|
|
15
|
+
};
|
|
16
|
+
var apiPatch = async (url, data) => {
|
|
17
|
+
const response = await getAxiosInstance().patch(url, data);
|
|
18
|
+
return response.data;
|
|
19
|
+
};
|
|
20
|
+
var apiDelete = async (url) => {
|
|
21
|
+
const response = await getAxiosInstance().delete(url);
|
|
22
|
+
return response.data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/services/fleet/inspection_management/fleet_inspection_management_service.ts
|
|
26
|
+
import { z as z3 } from "zod";
|
|
27
|
+
|
|
28
|
+
// src/zod_utils/zod_utils.ts
|
|
29
|
+
import { z } from "zod";
|
|
30
|
+
|
|
31
|
+
// src/core/BaseResponse.ts
|
|
32
|
+
var r_log = (data = {}) => {
|
|
33
|
+
return data;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/zod_utils/zod_utils.ts
|
|
37
|
+
var handleNullOrUndefined = (value) => typeof value === "string" ? value : "";
|
|
38
|
+
var stringMandatory = (fieldName, min = 1, max = 100) => {
|
|
39
|
+
const schema = z.string().trim().min(min, `${fieldName} must be at least ${min} characters.`).max(max, `${fieldName} must be at most ${max} characters.`).nonempty(`${fieldName} is required.`).transform(handleNullOrUndefined);
|
|
40
|
+
return schema;
|
|
41
|
+
};
|
|
42
|
+
var stringOptional = (fieldName, min = 0, max = 255, defaultValue = "") => {
|
|
43
|
+
const schema = z.string().trim().min(min, `${fieldName} must be at least ${min} characters.`).max(max, `${fieldName} must be at most ${max} characters.`).transform(handleNullOrUndefined).default(defaultValue);
|
|
44
|
+
return schema;
|
|
45
|
+
};
|
|
46
|
+
var stringArrayOptional = (fieldName, min = 0, max = 100, defaultValue = [], unique = false) => {
|
|
47
|
+
const schema = z.array(z.string().trim(), {
|
|
48
|
+
invalid_type_error: `${fieldName} must be an array of strings.`
|
|
49
|
+
}).min(min, `${fieldName} must contain at least ${min} items.`).max(max, `${fieldName} must contain at most ${max} items.`);
|
|
50
|
+
if (unique) {
|
|
51
|
+
schema.refine(
|
|
52
|
+
(arr) => new Set(arr).size === arr.length,
|
|
53
|
+
`${fieldName} must contain unique values.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return schema.optional().default(defaultValue);
|
|
57
|
+
};
|
|
58
|
+
var numberOptional = (fieldName, min = 0, max = 1e14, defaultValue = 0) => {
|
|
59
|
+
return z.preprocess(
|
|
60
|
+
(val) => typeof val === "string" && val.trim() !== "" ? Number(val) : val,
|
|
61
|
+
z.number({ invalid_type_error: `${fieldName} must be a number.` }).min(min, `${fieldName} must be at least ${min}.`).max(max, `${fieldName} must be at most ${max}.`).optional().default(defaultValue)
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
var enumMandatory = (fieldName, enumType, defaultValue) => {
|
|
65
|
+
return z.union([
|
|
66
|
+
z.nativeEnum(enumType, {
|
|
67
|
+
invalid_type_error: `${fieldName} should be one of the following values: ${Object.values(
|
|
68
|
+
enumType
|
|
69
|
+
).join(", ")}.`
|
|
70
|
+
}),
|
|
71
|
+
z.string().refine((val) => Object.values(enumType).includes(val), {
|
|
72
|
+
message: `${fieldName} should be one of the following values: ${Object.values(
|
|
73
|
+
enumType
|
|
74
|
+
).join(", ")}.`
|
|
75
|
+
})
|
|
76
|
+
]).default(defaultValue).refine((val) => val !== "", {
|
|
77
|
+
message: `Please select ${fieldName}.`
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
var enumOptional = (fieldName, enumType, defaultValue) => {
|
|
81
|
+
return z.nativeEnum(enumType, {
|
|
82
|
+
invalid_type_error: `${fieldName} must be an array containing only the following values: ${Object.values(
|
|
83
|
+
enumType
|
|
84
|
+
).join(", ")}.`
|
|
85
|
+
}).optional().default(() => defaultValue);
|
|
86
|
+
};
|
|
87
|
+
var getAllEnums = (enumType) => {
|
|
88
|
+
return Object.values(enumType);
|
|
89
|
+
};
|
|
90
|
+
var enumArrayOptional = (fieldName, enumType, defaultValue = getAllEnums(enumType), min = 0, max = 100, unique = false) => {
|
|
91
|
+
const schema = z.array(z.nativeEnum(enumType), {
|
|
92
|
+
invalid_type_error: `${fieldName} must be an array containing only the following values: ${Object.values(
|
|
93
|
+
enumType
|
|
94
|
+
).join(", ")}.`
|
|
95
|
+
}).min(min, `${fieldName} must contain at least ${min} items.`).max(max, `${fieldName} must contain at most ${max} items.`);
|
|
96
|
+
if (unique) {
|
|
97
|
+
schema.refine(
|
|
98
|
+
(arr) => new Set(arr).size === arr.length,
|
|
99
|
+
`${fieldName} must contain unique values.`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return schema.optional().default(() => defaultValue);
|
|
103
|
+
};
|
|
104
|
+
var handleNullOrUndefinedDate = (value, defaultValue) => {
|
|
105
|
+
if (typeof value === "string" && !isNaN(Date.parse(value))) {
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
return defaultValue;
|
|
109
|
+
};
|
|
110
|
+
var dateMandatory = (fieldName, minDate, maxDate, defaultValue = (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
111
|
+
const schema = z.string().refine((val) => !isNaN(Date.parse(val)), {
|
|
112
|
+
message: `${fieldName} must be a valid ISO date.`
|
|
113
|
+
}).transform((val) => handleNullOrUndefinedDate(val, defaultValue));
|
|
114
|
+
if (minDate) {
|
|
115
|
+
schema.refine((val) => new Date(val) >= new Date(minDate), {
|
|
116
|
+
message: `${fieldName} must be after ${minDate}.`
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (maxDate) {
|
|
120
|
+
schema.refine((val) => new Date(val) <= new Date(maxDate), {
|
|
121
|
+
message: `${fieldName} must be before ${maxDate}.`
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return schema;
|
|
125
|
+
};
|
|
126
|
+
var dynamicJsonSchema = (fieldName, defaultValue = {}) => z.record(z.any()).optional().default(() => defaultValue);
|
|
127
|
+
var nestedArrayOfObjectsOptional = (fieldName, schema, defaultValue = [], min = 0, max) => {
|
|
128
|
+
let arraySchema = z.array(schema, {
|
|
129
|
+
invalid_type_error: `${fieldName} must be an array of objects.`
|
|
130
|
+
}).min(min, `${fieldName} must contain at least ${min} items.`);
|
|
131
|
+
if (max !== void 0) {
|
|
132
|
+
arraySchema = arraySchema.max(
|
|
133
|
+
max,
|
|
134
|
+
`${fieldName} must contain at most ${max} items.`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return arraySchema.optional().default(() => defaultValue);
|
|
138
|
+
};
|
|
139
|
+
var single_select_mandatory = (fieldName) => {
|
|
140
|
+
const schema = z.string().trim().nonempty(`Please select ${fieldName}.`).transform(handleNullOrUndefined);
|
|
141
|
+
return schema;
|
|
142
|
+
};
|
|
143
|
+
var single_select_optional = (fieldName) => {
|
|
144
|
+
r_log(fieldName);
|
|
145
|
+
const schema = z.string().trim().transform(handleNullOrUndefined);
|
|
146
|
+
return schema;
|
|
147
|
+
};
|
|
148
|
+
var multi_select_optional = (fieldName, max = 1e3, defaultValue = []) => {
|
|
149
|
+
const schema = z.array(
|
|
150
|
+
z.string({
|
|
151
|
+
invalid_type_error: `${fieldName} must be an array of strings.`
|
|
152
|
+
})
|
|
153
|
+
).max(
|
|
154
|
+
max,
|
|
155
|
+
`Please select at most ${max} ${fieldName}${max > 1 ? "s" : ""}.`
|
|
156
|
+
);
|
|
157
|
+
return schema.optional().default(defaultValue);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/zod_utils/zod_base_schema.ts
|
|
161
|
+
import { z as z2 } from "zod";
|
|
162
|
+
|
|
163
|
+
// src/core/Enums.ts
|
|
164
|
+
var PAGING = /* @__PURE__ */ ((PAGING2) => {
|
|
165
|
+
PAGING2["Yes"] = "Yes";
|
|
166
|
+
PAGING2["No"] = "No";
|
|
167
|
+
return PAGING2;
|
|
168
|
+
})(PAGING || {});
|
|
169
|
+
var LoadParents = /* @__PURE__ */ ((LoadParents2) => {
|
|
170
|
+
LoadParents2["Yes"] = "Yes";
|
|
171
|
+
LoadParents2["No"] = "No";
|
|
172
|
+
LoadParents2["Custom"] = "Custom";
|
|
173
|
+
return LoadParents2;
|
|
174
|
+
})(LoadParents || {});
|
|
175
|
+
var LoadChild = /* @__PURE__ */ ((LoadChild2) => {
|
|
176
|
+
LoadChild2["No"] = "No";
|
|
177
|
+
LoadChild2["Yes"] = "Yes";
|
|
178
|
+
LoadChild2["Count"] = "Count";
|
|
179
|
+
LoadChild2["Custom"] = "Custom";
|
|
180
|
+
LoadChild2["Direct"] = "Direct";
|
|
181
|
+
return LoadChild2;
|
|
182
|
+
})(LoadChild || {});
|
|
183
|
+
var LoadChildCount = /* @__PURE__ */ ((LoadChildCount2) => {
|
|
184
|
+
LoadChildCount2["No"] = "No";
|
|
185
|
+
LoadChildCount2["Yes"] = "Yes";
|
|
186
|
+
LoadChildCount2["Custom"] = "Custom";
|
|
187
|
+
return LoadChildCount2;
|
|
188
|
+
})(LoadChildCount || {});
|
|
189
|
+
var OrderBy = /* @__PURE__ */ ((OrderBy2) => {
|
|
190
|
+
OrderBy2["asc"] = "asc";
|
|
191
|
+
OrderBy2["desc"] = "desc";
|
|
192
|
+
return OrderBy2;
|
|
193
|
+
})(OrderBy || {});
|
|
194
|
+
var LoginFrom = /* @__PURE__ */ ((LoginFrom2) => {
|
|
195
|
+
LoginFrom2["Web"] = "Web";
|
|
196
|
+
LoginFrom2["Android"] = "Android";
|
|
197
|
+
LoginFrom2["IPhone"] = "IPhone";
|
|
198
|
+
LoginFrom2["AndroidPWA"] = "AndroidPWA";
|
|
199
|
+
LoginFrom2["iOSPWA"] = "iOSPWA";
|
|
200
|
+
return LoginFrom2;
|
|
201
|
+
})(LoginFrom || {});
|
|
202
|
+
var Status = /* @__PURE__ */ ((Status2) => {
|
|
203
|
+
Status2["Active"] = "Active";
|
|
204
|
+
Status2["Inactive"] = "Inactive";
|
|
205
|
+
return Status2;
|
|
206
|
+
})(Status || {});
|
|
207
|
+
var FileType = /* @__PURE__ */ ((FileType2) => {
|
|
208
|
+
FileType2["NoFile"] = "NoFile";
|
|
209
|
+
FileType2["Image"] = "Image";
|
|
210
|
+
FileType2["Video"] = "Video";
|
|
211
|
+
FileType2["PDF"] = "PDF";
|
|
212
|
+
return FileType2;
|
|
213
|
+
})(FileType || {});
|
|
214
|
+
var YesNo = /* @__PURE__ */ ((YesNo3) => {
|
|
215
|
+
YesNo3["Yes"] = "Yes";
|
|
216
|
+
YesNo3["No"] = "No";
|
|
217
|
+
return YesNo3;
|
|
218
|
+
})(YesNo || {});
|
|
219
|
+
var InspectionStatus = /* @__PURE__ */ ((InspectionStatus2) => {
|
|
220
|
+
InspectionStatus2["Pending"] = "Pending";
|
|
221
|
+
InspectionStatus2["Completed"] = "Completed";
|
|
222
|
+
InspectionStatus2["Missed"] = "Missed";
|
|
223
|
+
InspectionStatus2["Cancelled"] = "Cancelled";
|
|
224
|
+
InspectionStatus2["Failed"] = "Failed";
|
|
225
|
+
return InspectionStatus2;
|
|
226
|
+
})(InspectionStatus || {});
|
|
227
|
+
var InspectionPriority = /* @__PURE__ */ ((InspectionPriority2) => {
|
|
228
|
+
InspectionPriority2["Critical"] = "Critical";
|
|
229
|
+
InspectionPriority2["High"] = "High";
|
|
230
|
+
InspectionPriority2["Medium"] = "Medium";
|
|
231
|
+
InspectionPriority2["Low"] = "Low";
|
|
232
|
+
InspectionPriority2["NoPriority"] = "NoPriority";
|
|
233
|
+
return InspectionPriority2;
|
|
234
|
+
})(InspectionPriority || {});
|
|
235
|
+
var InspectionType = /* @__PURE__ */ ((InspectionType2) => {
|
|
236
|
+
InspectionType2["Regular"] = "Regular";
|
|
237
|
+
InspectionType2["VehicleHandover"] = "VehicleHandover";
|
|
238
|
+
InspectionType2["VehicleReturn"] = "VehicleReturn";
|
|
239
|
+
InspectionType2["TripPreCheckList"] = "TripPreCheckList";
|
|
240
|
+
InspectionType2["TripPostCheckList"] = "TripPostCheckList";
|
|
241
|
+
InspectionType2["ServiceBefore"] = "ServiceBefore";
|
|
242
|
+
InspectionType2["ServiceAfter"] = "ServiceAfter";
|
|
243
|
+
return InspectionType2;
|
|
244
|
+
})(InspectionType || {});
|
|
245
|
+
var InspectionActionStatus = /* @__PURE__ */ ((InspectionActionStatus2) => {
|
|
246
|
+
InspectionActionStatus2["Pending"] = "Pending";
|
|
247
|
+
InspectionActionStatus2["Approved"] = "Approved";
|
|
248
|
+
InspectionActionStatus2["Rejected"] = "Rejected";
|
|
249
|
+
InspectionActionStatus2["Escalated"] = "Escalated";
|
|
250
|
+
return InspectionActionStatus2;
|
|
251
|
+
})(InspectionActionStatus || {});
|
|
252
|
+
|
|
253
|
+
// src/zod_utils/zod_base_schema.ts
|
|
254
|
+
var OrderBySchema = z2.array(
|
|
255
|
+
z2.object({
|
|
256
|
+
name: stringMandatory("Order Field Name", 0, 255),
|
|
257
|
+
field: stringMandatory("Order Field Name", 0, 255),
|
|
258
|
+
direction: enumMandatory("Order Direction", OrderBy, "asc" /* asc */)
|
|
259
|
+
})
|
|
260
|
+
);
|
|
261
|
+
var BaseFileSchema = z2.object({
|
|
262
|
+
usage_type: stringMandatory("Usage Type", 3, 100),
|
|
263
|
+
file_type: enumMandatory("File Type", FileType, "Image" /* Image */),
|
|
264
|
+
file_url: stringOptional("File URL", 0, 300),
|
|
265
|
+
file_key: stringOptional("File Key", 0, 300),
|
|
266
|
+
file_name: stringOptional("File Name", 0, 300),
|
|
267
|
+
file_description: stringOptional("File Description", 0, 2e3),
|
|
268
|
+
file_size: numberOptional("File Size"),
|
|
269
|
+
file_metadata: dynamicJsonSchema("File Metadata", {}),
|
|
270
|
+
status: enumMandatory("Status", Status, "Active" /* Active */)
|
|
271
|
+
});
|
|
272
|
+
var BaseQuerySchema = z2.object({
|
|
273
|
+
search: stringOptional("Search", 0, 255, ""),
|
|
274
|
+
status: enumArrayOptional("Status", Status, getAllEnums(Status), 0, 10, true),
|
|
275
|
+
paging: enumOptional("Paging", PAGING, "Yes" /* Yes */),
|
|
276
|
+
page_count: numberOptional("Page Count", 0, 1e3, 100),
|
|
277
|
+
page_index: numberOptional("Page Index", 0, 1e3, 0),
|
|
278
|
+
load_parents: enumOptional("Load Parents", LoadParents, "No" /* No */),
|
|
279
|
+
load_parents_list: stringArrayOptional("Load Parents List"),
|
|
280
|
+
load_child: enumOptional("Load Child", LoadChild, "No" /* No */),
|
|
281
|
+
load_child_list: stringArrayOptional("Load Child List"),
|
|
282
|
+
load_child_count: enumOptional(
|
|
283
|
+
"Load Child",
|
|
284
|
+
LoadChildCount,
|
|
285
|
+
"No" /* No */
|
|
286
|
+
),
|
|
287
|
+
load_child_count_list: stringArrayOptional("Load Child List"),
|
|
288
|
+
include_details: dynamicJsonSchema("Include Details", {}),
|
|
289
|
+
where_relations: dynamicJsonSchema("Where Relations", {}),
|
|
290
|
+
order_by: OrderBySchema.optional().default([]),
|
|
291
|
+
include_master_data: enumOptional("Include Master Data", YesNo, "No" /* No */),
|
|
292
|
+
date_format_id: single_select_optional("MasterMainDateFormat"),
|
|
293
|
+
time_zone_id: single_select_optional("MasterMainTimeZone")
|
|
294
|
+
});
|
|
295
|
+
var FilePresignedUrlSchema = z2.object({
|
|
296
|
+
file_name: stringMandatory("File Name", 1, 255),
|
|
297
|
+
file_type: enumMandatory("File Type", FileType, "Image" /* Image */)
|
|
298
|
+
});
|
|
299
|
+
var MongoBaseQuerySchema = z2.object({
|
|
300
|
+
search: stringOptional("Search", 0, 255, ""),
|
|
301
|
+
paging: enumOptional("Paging", PAGING, "Yes" /* Yes */),
|
|
302
|
+
page_count: numberOptional("Page Count", 0, 1e3, 100),
|
|
303
|
+
page_index: numberOptional("Page Index", 0, 1e3, 0),
|
|
304
|
+
login_from: enumMandatory("Login From", LoginFrom, "Web" /* Web */),
|
|
305
|
+
date_format_id: single_select_optional("MasterMainDateFormat"),
|
|
306
|
+
// ✅ Single-selection -> MasterMainDateFormat
|
|
307
|
+
time_zone_id: single_select_optional("MasterMainTimeZone")
|
|
308
|
+
// ✅ Single-selection -> MasterMainTimeZone
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
// src/services/fleet/inspection_management/fleet_inspection_management_service.ts
|
|
312
|
+
var URL = "fleet/inspection_management/inspections";
|
|
313
|
+
var ENDPOINTS = {
|
|
314
|
+
// AWS S3 PRESIGNED
|
|
315
|
+
inspection_file_presigned_url: `${URL}/inspection_file_presigned_url`,
|
|
316
|
+
// File
|
|
317
|
+
create_inspection_file: `${URL}/create_inspection_file`,
|
|
318
|
+
remove_inspection_file: (id) => `${URL}/remove_inspection_file/${id}`,
|
|
319
|
+
find: `${URL}/search`,
|
|
320
|
+
find_check_pending: `${URL}/check_pending`,
|
|
321
|
+
create: `${URL}`,
|
|
322
|
+
update: (id) => `${URL}/${id}`,
|
|
323
|
+
delete: (id) => `${URL}/${id}`
|
|
324
|
+
};
|
|
325
|
+
var FleetInspectionFileSchema = BaseFileSchema.extend({
|
|
326
|
+
organisation_id: single_select_optional("UserOrganisation"),
|
|
327
|
+
// ✅ Single-Selection -> UserOrganisation
|
|
328
|
+
inspection_id: single_select_optional("FleetInspection")
|
|
329
|
+
// ✅ Single-Selection -> FleetInspection
|
|
330
|
+
});
|
|
331
|
+
var FleetInspectionSchema = z3.object({
|
|
332
|
+
organisation_id: single_select_mandatory("UserOrganisation"),
|
|
333
|
+
// ✅ Single-Selection -> UserOrganisation
|
|
334
|
+
vehicle_id: single_select_mandatory("MasterVehicle"),
|
|
335
|
+
// ✅ Single-Selection -> MasterVehicle
|
|
336
|
+
driver_id: single_select_optional("MasterDriver"),
|
|
337
|
+
// ✅ Single-Selection -> MasterDriver
|
|
338
|
+
inspector_id: single_select_optional("User"),
|
|
339
|
+
// ✅ Single-Selection -> User
|
|
340
|
+
inspection_form_id: single_select_mandatory("FleetInspectionForm"),
|
|
341
|
+
// ✅ Single-Selection -> FleetInspectionForm
|
|
342
|
+
service_management_id: single_select_optional("FleetServiceManagement"),
|
|
343
|
+
// ✅ Single-Selection -> FleetServiceManagement
|
|
344
|
+
inspection_type: enumMandatory(
|
|
345
|
+
"Inspection Type",
|
|
346
|
+
InspectionType,
|
|
347
|
+
"Regular" /* Regular */
|
|
348
|
+
),
|
|
349
|
+
inspection_date: dateMandatory("Inspection Date"),
|
|
350
|
+
inspection_priority: enumMandatory(
|
|
351
|
+
"Inspection Priority",
|
|
352
|
+
InspectionPriority,
|
|
353
|
+
"NoPriority" /* NoPriority */
|
|
354
|
+
),
|
|
355
|
+
inspection_status: enumMandatory(
|
|
356
|
+
"Inspection Status",
|
|
357
|
+
InspectionStatus,
|
|
358
|
+
"Pending" /* Pending */
|
|
359
|
+
),
|
|
360
|
+
inspection_data: dynamicJsonSchema("Inspection Data", {}),
|
|
361
|
+
odometer_reading: numberOptional("Odometer Reading"),
|
|
362
|
+
// Other
|
|
363
|
+
status: enumMandatory("Status", Status, "Active" /* Active */),
|
|
364
|
+
time_zone_id: single_select_mandatory("MasterMainTimeZone"),
|
|
365
|
+
FleetInspectionFileSchema: nestedArrayOfObjectsOptional(
|
|
366
|
+
"FleetInspectionFileSchema",
|
|
367
|
+
FleetInspectionFileSchema,
|
|
368
|
+
[]
|
|
369
|
+
)
|
|
370
|
+
});
|
|
371
|
+
var FleetInspectionQuerySchema = BaseQuerySchema.extend({
|
|
372
|
+
inspection_ids: multi_select_optional("FleetInspection"),
|
|
373
|
+
// ✅ Multi-Selection -> FleetInspection
|
|
374
|
+
organisation_ids: multi_select_optional("UserOrganisation"),
|
|
375
|
+
// ✅ Multi-Selection -> UserOrganisation
|
|
376
|
+
vehicle_ids: multi_select_optional("MasterVehicle"),
|
|
377
|
+
// ✅ Multi-Selection -> MasterVehicle
|
|
378
|
+
driver_ids: multi_select_optional("MasterDriver"),
|
|
379
|
+
// ✅ Multi-Selection -> MasterDriver
|
|
380
|
+
inspection_form_ids: multi_select_optional("FleetInspectionForm"),
|
|
381
|
+
// ✅ Multi-Selection -> FleetInspectionForm
|
|
382
|
+
service_management_ids: multi_select_optional("FleetServiceManagement"),
|
|
383
|
+
// ✅ Multi-Selection -> FleetServiceManagement
|
|
384
|
+
inspection_schedule_ids: multi_select_optional("FleetInspectionSchedule"),
|
|
385
|
+
// ✅ Multi-Selection -> FleetInspectionSchedule
|
|
386
|
+
inspection_type: enumArrayOptional(
|
|
387
|
+
"Inspection Type",
|
|
388
|
+
InspectionType,
|
|
389
|
+
getAllEnums(InspectionType)
|
|
390
|
+
),
|
|
391
|
+
inspection_priority: enumArrayOptional(
|
|
392
|
+
"Inspection Priority",
|
|
393
|
+
InspectionPriority,
|
|
394
|
+
getAllEnums(InspectionPriority)
|
|
395
|
+
),
|
|
396
|
+
inspection_status: enumArrayOptional(
|
|
397
|
+
"Inspection Status",
|
|
398
|
+
InspectionStatus,
|
|
399
|
+
getAllEnums(InspectionStatus)
|
|
400
|
+
),
|
|
401
|
+
inspection_action_status: enumArrayOptional(
|
|
402
|
+
"Inspection Action Status",
|
|
403
|
+
InspectionActionStatus,
|
|
404
|
+
getAllEnums(InspectionActionStatus)
|
|
405
|
+
)
|
|
406
|
+
});
|
|
407
|
+
var FleetInspectionCheckPendingQuerySchema = BaseQuerySchema.extend({
|
|
408
|
+
vehicle_ids: multi_select_optional("MasterVehicle")
|
|
409
|
+
// ✅ Multi-Selection -> MasterVehicle
|
|
410
|
+
});
|
|
411
|
+
var toFleetInspectionPayload = (row) => ({
|
|
412
|
+
organisation_id: row.organisation_id || "",
|
|
413
|
+
vehicle_id: row.vehicle_id || "",
|
|
414
|
+
driver_id: row.driver_id || "",
|
|
415
|
+
inspector_id: row.inspector_id || "",
|
|
416
|
+
inspection_form_id: row.inspection_form_id || "",
|
|
417
|
+
service_management_id: row.service_management_id || "",
|
|
418
|
+
inspection_type: row.inspection_type || "Regular" /* Regular */,
|
|
419
|
+
inspection_date: row.inspection_date || "",
|
|
420
|
+
inspection_priority: row.inspection_priority || "NoPriority" /* NoPriority */,
|
|
421
|
+
inspection_status: row.inspection_status || "Pending" /* Pending */,
|
|
422
|
+
inspection_data: row.inspection_data || {},
|
|
423
|
+
odometer_reading: row.odometer_reading || 0,
|
|
424
|
+
status: row.status || "Active" /* Active */,
|
|
425
|
+
time_zone_id: "",
|
|
426
|
+
// Needs to be provided manually
|
|
427
|
+
FleetInspectionFileSchema: row.FleetInspectionFile?.map((file) => ({
|
|
428
|
+
fleet_inspection_file_id: file.fleet_inspection_file_id ?? "",
|
|
429
|
+
usage_type: file.usage_type,
|
|
430
|
+
file_type: file.file_type,
|
|
431
|
+
file_url: file.file_url || "",
|
|
432
|
+
file_key: file.file_key || "",
|
|
433
|
+
file_name: file.file_name || "",
|
|
434
|
+
file_description: file.file_description || "",
|
|
435
|
+
file_size: file.file_size || 0,
|
|
436
|
+
file_metadata: file.file_metadata ?? {},
|
|
437
|
+
status: file.status,
|
|
438
|
+
added_date_time: file.added_date_time,
|
|
439
|
+
modified_date_time: file.modified_date_time,
|
|
440
|
+
organisation_id: file.organisation_id ?? "",
|
|
441
|
+
inspection_id: file.inspection_id ?? ""
|
|
442
|
+
})) ?? []
|
|
443
|
+
});
|
|
444
|
+
var newFleetInspectionPayload = () => ({
|
|
445
|
+
organisation_id: "",
|
|
446
|
+
vehicle_id: "",
|
|
447
|
+
driver_id: "",
|
|
448
|
+
inspector_id: "",
|
|
449
|
+
inspection_form_id: "",
|
|
450
|
+
service_management_id: "",
|
|
451
|
+
inspection_type: "Regular" /* Regular */,
|
|
452
|
+
inspection_date: "",
|
|
453
|
+
inspection_priority: "NoPriority" /* NoPriority */,
|
|
454
|
+
inspection_status: "Pending" /* Pending */,
|
|
455
|
+
inspection_data: {},
|
|
456
|
+
odometer_reading: 0,
|
|
457
|
+
status: "Active" /* Active */,
|
|
458
|
+
time_zone_id: "",
|
|
459
|
+
// Needs to be provided manually
|
|
460
|
+
FleetInspectionFileSchema: []
|
|
461
|
+
});
|
|
462
|
+
var get_inspection_file_presigned_url = async (data) => {
|
|
463
|
+
return apiPost(ENDPOINTS.inspection_file_presigned_url, data);
|
|
464
|
+
};
|
|
465
|
+
var create_service_file = async (data) => {
|
|
466
|
+
return apiPost(ENDPOINTS.create_inspection_file, data);
|
|
467
|
+
};
|
|
468
|
+
var remove_service_file = async (id) => {
|
|
469
|
+
return apiDelete(ENDPOINTS.remove_inspection_file(id));
|
|
470
|
+
};
|
|
471
|
+
var findFleetInspection = async (data) => {
|
|
472
|
+
return apiPost(ENDPOINTS.find, data);
|
|
473
|
+
};
|
|
474
|
+
var find_check_pending = async (data) => {
|
|
475
|
+
return apiPost(ENDPOINTS.find_check_pending, data);
|
|
476
|
+
};
|
|
477
|
+
var createFleetInspection = async (data) => {
|
|
478
|
+
return apiPost(ENDPOINTS.create, data);
|
|
479
|
+
};
|
|
480
|
+
var updateFleetInspection = async (id, data) => {
|
|
481
|
+
return apiPatch(ENDPOINTS.update(id), data);
|
|
482
|
+
};
|
|
483
|
+
var deleteFleetInspection = async (id) => {
|
|
484
|
+
return apiDelete(ENDPOINTS.delete(id));
|
|
485
|
+
};
|
|
486
|
+
export {
|
|
487
|
+
FleetInspectionCheckPendingQuerySchema,
|
|
488
|
+
FleetInspectionFileSchema,
|
|
489
|
+
FleetInspectionQuerySchema,
|
|
490
|
+
FleetInspectionSchema,
|
|
491
|
+
createFleetInspection,
|
|
492
|
+
create_service_file,
|
|
493
|
+
deleteFleetInspection,
|
|
494
|
+
findFleetInspection,
|
|
495
|
+
find_check_pending,
|
|
496
|
+
get_inspection_file_presigned_url,
|
|
497
|
+
newFleetInspectionPayload,
|
|
498
|
+
remove_service_file,
|
|
499
|
+
toFleetInspectionPayload,
|
|
500
|
+
updateFleetInspection
|
|
501
|
+
};
|