vms-nest-prisma-api-document 6.0.14 → 6.0.16

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.
@@ -3,6 +3,7 @@ import { FBR, SBR } from '../../core/BaseResponse.js';
3
3
  import { z } from 'zod';
4
4
  import { U as UserOrganisation, a as User, M as MasterVehicle, b as MasterDriver } from '../../user_organisation_service-Cx3ffrVp.js';
5
5
  import { GPSGeofenceData } from '../gps/features/geofence/gps_geofence_data_service.js';
6
+ import { MasterMainLandmark } from '../master/main/master_main_landmark_service.js';
6
7
  import '../../zod_utils/zod_base_schema.js';
7
8
  import '../master/main/master_main_sim_provider_service.js';
8
9
 
@@ -11,7 +12,8 @@ interface Notification extends Record<string, unknown> {
11
12
  module: Module;
12
13
  alert_type: AlertType;
13
14
  alert_sub_type: AlertSubType;
14
- notification_title: string;
15
+ date_time: string;
16
+ date_time_f?: string;
15
17
  notification_message: string;
16
18
  notification_html_message: string;
17
19
  notification_key_1?: string;
@@ -20,6 +22,13 @@ interface Notification extends Record<string, unknown> {
20
22
  notification_key_4?: string;
21
23
  notification_key_5?: string;
22
24
  notification_key_6?: string;
25
+ latitude?: number;
26
+ longitude?: number;
27
+ google_location?: string;
28
+ landmark_id?: string;
29
+ MasterMainLandmark?: MasterMainLandmark;
30
+ landmark_location?: string;
31
+ landmark_distance?: number;
23
32
  status: Status;
24
33
  added_date_time: string;
25
34
  modified_date_time: string;
@@ -44,24 +53,36 @@ declare const NotificationSchema: z.ZodObject<{
44
53
  vehicle_id: z.ZodEffects<z.ZodString, string, string>;
45
54
  driver_id: z.ZodEffects<z.ZodString, string, string>;
46
55
  gps_geofence_id: z.ZodEffects<z.ZodString, string, string>;
47
- notification_title: z.ZodEffects<z.ZodString, string, string>;
56
+ date_time: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
48
57
  notification_message: z.ZodEffects<z.ZodString, string, string>;
49
58
  notification_html_message: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
59
+ latitude: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, unknown>>;
60
+ longitude: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, unknown>>;
61
+ google_location: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
50
62
  notification_key_1: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
51
63
  notification_key_2: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
52
64
  notification_key_3: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
53
65
  notification_key_4: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
54
66
  notification_key_5: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
55
67
  notification_key_6: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
68
+ module: z.ZodType<Module, z.ZodTypeDef, Module>;
69
+ alert_type: z.ZodType<AlertType, z.ZodTypeDef, AlertType>;
70
+ alert_sub_type: z.ZodType<AlertSubType, z.ZodTypeDef, AlertSubType>;
56
71
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
72
+ time_zone_id: z.ZodEffects<z.ZodString, string, string>;
57
73
  }, "strip", z.ZodTypeAny, {
58
74
  status: Status;
59
75
  organisation_id: string;
60
76
  user_id: string;
77
+ time_zone_id: string;
61
78
  driver_id: string;
62
79
  vehicle_id: string;
63
80
  gps_geofence_id: string;
64
- notification_title: string;
81
+ google_location: string;
82
+ module: Module;
83
+ alert_type: AlertType;
84
+ alert_sub_type: AlertSubType;
85
+ date_time: string;
65
86
  notification_message: string;
66
87
  notification_html_message: string;
67
88
  notification_key_1: string;
@@ -70,15 +91,24 @@ declare const NotificationSchema: z.ZodObject<{
70
91
  notification_key_4: string;
71
92
  notification_key_5: string;
72
93
  notification_key_6: string;
94
+ latitude?: number | undefined;
95
+ longitude?: number | undefined;
73
96
  }, {
74
97
  status: Status;
75
98
  organisation_id: string;
76
99
  user_id: string;
100
+ time_zone_id: string;
77
101
  driver_id: string;
78
102
  vehicle_id: string;
79
103
  gps_geofence_id: string;
80
- notification_title: string;
104
+ module: Module;
105
+ alert_type: AlertType;
106
+ alert_sub_type: AlertSubType;
107
+ date_time: string;
81
108
  notification_message: string;
109
+ latitude?: unknown;
110
+ longitude?: unknown;
111
+ google_location?: string | undefined;
82
112
  notification_html_message?: string | undefined;
83
113
  notification_key_1?: string | undefined;
84
114
  notification_key_2?: string | undefined;
@@ -192,7 +222,7 @@ declare const NotificationQuerySchema: z.ZodObject<{
192
222
  gps_geofence_ids?: string[] | undefined;
193
223
  }>;
194
224
  type NotificationQueryDTO = z.infer<typeof NotificationQuerySchema>;
195
- declare const toNotificationPayload: (n: Notification) => NotificationDTO;
225
+ declare const toNotificationPayload: (row: Notification) => NotificationDTO;
196
226
  declare const newNotificationPayload: () => NotificationDTO;
197
227
  declare const findNotifications: (data: NotificationQueryDTO) => Promise<FBR<Notification[]>>;
198
228
  declare const createNotification: (data: NotificationDTO) => Promise<SBR>;
@@ -61,6 +61,20 @@ var numberOptional = (fieldName, min = 0, max = 1e9, defaultValue = 0) => {
61
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
62
  );
63
63
  };
64
+ var doubleOptionalLatLng = (fieldName, defaultValue = 0) => {
65
+ return z.preprocess(
66
+ (val) => {
67
+ if (typeof val === "string") {
68
+ val = parseFloat(val);
69
+ }
70
+ if (typeof val === "number") {
71
+ return parseFloat(val.toFixed(6));
72
+ }
73
+ return val;
74
+ },
75
+ z.number({ invalid_type_error: `${fieldName} must be a number.` }).min(-180, `${fieldName} must be at least -180.`).max(180, `${fieldName} must be at most 180.`).default(defaultValue)
76
+ ).optional();
77
+ };
64
78
  var enumMandatory = (fieldName, enumType, defaultValue) => {
65
79
  return z.union([
66
80
  z.nativeEnum(enumType, {
@@ -101,6 +115,28 @@ var enumArrayOptional = (fieldName, enumType, defaultValue = getAllEnums(enumTyp
101
115
  }
102
116
  return schema.optional().default(() => defaultValue);
103
117
  };
118
+ var handleNullOrUndefinedDate = (value, defaultValue) => {
119
+ if (typeof value === "string" && !isNaN(Date.parse(value))) {
120
+ return value;
121
+ }
122
+ return defaultValue;
123
+ };
124
+ var dateMandatory = (fieldName, minDate, maxDate, defaultValue = (/* @__PURE__ */ new Date()).toISOString()) => {
125
+ const schema = z.string().refine((val) => !isNaN(Date.parse(val)), {
126
+ message: `${fieldName} must be a valid ISO date.`
127
+ }).transform((val) => handleNullOrUndefinedDate(val, defaultValue));
128
+ if (minDate) {
129
+ schema.refine((val) => new Date(val) >= new Date(minDate), {
130
+ message: `${fieldName} must be after ${minDate}.`
131
+ });
132
+ }
133
+ if (maxDate) {
134
+ schema.refine((val) => new Date(val) <= new Date(maxDate), {
135
+ message: `${fieldName} must be before ${maxDate}.`
136
+ });
137
+ }
138
+ return schema;
139
+ };
104
140
  var dynamicJsonSchema = (fieldName, defaultValue = {}) => z.record(z.any()).optional().default(() => defaultValue);
105
141
  var single_select_mandatory = (fieldName) => {
106
142
  const schema = z.string().trim().nonempty(`Please select ${fieldName}.`).transform(handleNullOrUndefined);
@@ -358,20 +394,33 @@ var NotificationSchema = z3.object({
358
394
  // ✅ Single-Selection -> MasterDriver
359
395
  gps_geofence_id: single_select_optional("GPSGeofenceData"),
360
396
  // ✅ Single-Selection -> GPSGeofenceData
361
- notification_title: stringMandatory("Notification Title", 3, 100),
397
+ // Event Time
398
+ date_time: dateMandatory("Date Time"),
362
399
  notification_message: stringMandatory("Notification Message", 3, 500),
363
400
  notification_html_message: stringOptional(
364
401
  "Notification HTML Message",
365
402
  0,
366
403
  500
367
404
  ),
405
+ // Location Details
406
+ latitude: doubleOptionalLatLng("Latitude"),
407
+ longitude: doubleOptionalLatLng("Longitude"),
408
+ google_location: stringOptional("Google Location", 0, 500),
368
409
  notification_key_1: stringOptional("Notification Key 1", 0, 100),
369
410
  notification_key_2: stringOptional("Notification Key 2", 0, 100),
370
411
  notification_key_3: stringOptional("Notification Key 3", 0, 100),
371
412
  notification_key_4: stringOptional("Notification Key 4", 0, 100),
372
413
  notification_key_5: stringOptional("Notification Key 5", 0, 100),
373
414
  notification_key_6: stringOptional("Notification Key 6", 0, 100),
374
- status: enumMandatory("Status", Status, "Active" /* Active */)
415
+ module: enumMandatory("Module", Module, "GPSModule" /* GPSModule */),
416
+ alert_type: enumMandatory("Alert Type", AlertType, "Ignition" /* Ignition */),
417
+ alert_sub_type: enumMandatory(
418
+ "Alert Sub Type",
419
+ AlertSubType,
420
+ "IgnitionOn" /* IgnitionOn */
421
+ ),
422
+ status: enumMandatory("Status", Status, "Active" /* Active */),
423
+ time_zone_id: single_select_mandatory("MasterMainTimeZone")
375
424
  });
376
425
  var NotificationQuerySchema = BaseQuerySchema.extend({
377
426
  notification_ids: multi_select_optional("Notification"),
@@ -398,26 +447,33 @@ var NotificationQuerySchema = BaseQuerySchema.extend({
398
447
  getAllEnums(AlertSubType)
399
448
  )
400
449
  });
401
- var toNotificationPayload = (n) => ({
450
+ var toNotificationPayload = (row) => ({
402
451
  // relations (single-selects)
403
- organisation_id: n.organisation_id,
404
- user_id: n.user_id ?? "",
405
- vehicle_id: n.vehicle_id ?? "",
406
- driver_id: n.driver_id ?? "",
407
- gps_geofence_id: n.gps_geofence_id ?? "",
452
+ organisation_id: row.organisation_id,
453
+ user_id: row.user_id ?? "",
454
+ vehicle_id: row.vehicle_id ?? "",
455
+ driver_id: row.driver_id ?? "",
456
+ gps_geofence_id: row.gps_geofence_id ?? "",
457
+ date_time: row.date_time,
408
458
  // content
409
- notification_title: n.notification_title,
410
- notification_message: n.notification_message,
411
- notification_html_message: n.notification_html_message ?? "",
459
+ notification_message: row.notification_message,
460
+ notification_html_message: row.notification_html_message ?? "",
412
461
  // keys
413
- notification_key_1: n.notification_key_1 ?? "",
414
- notification_key_2: n.notification_key_2 ?? "",
415
- notification_key_3: n.notification_key_3 ?? "",
416
- notification_key_4: n.notification_key_4 ?? "",
417
- notification_key_5: n.notification_key_5 ?? "",
418
- notification_key_6: n.notification_key_6 ?? "",
419
- // metadata
420
- status: n.status
462
+ notification_key_1: row.notification_key_1 ?? "",
463
+ notification_key_2: row.notification_key_2 ?? "",
464
+ notification_key_3: row.notification_key_3 ?? "",
465
+ notification_key_4: row.notification_key_4 ?? "",
466
+ notification_key_5: row.notification_key_5 ?? "",
467
+ notification_key_6: row.notification_key_6 ?? "",
468
+ latitude: row.latitude ?? 0,
469
+ longitude: row.longitude ?? 0,
470
+ google_location: row.google_location || "",
471
+ module: row.module,
472
+ alert_type: row.alert_type,
473
+ alert_sub_type: row.alert_sub_type,
474
+ status: row.status,
475
+ time_zone_id: ""
476
+ // Needs to be provided manually
421
477
  });
422
478
  var newNotificationPayload = () => ({
423
479
  // relations (single-selects)
@@ -426,8 +482,9 @@ var newNotificationPayload = () => ({
426
482
  vehicle_id: "",
427
483
  driver_id: "",
428
484
  gps_geofence_id: "",
485
+ // date
486
+ date_time: (/* @__PURE__ */ new Date()).toISOString(),
429
487
  // content
430
- notification_title: "",
431
488
  notification_message: "",
432
489
  notification_html_message: "",
433
490
  // keys
@@ -437,8 +494,16 @@ var newNotificationPayload = () => ({
437
494
  notification_key_4: "",
438
495
  notification_key_5: "",
439
496
  notification_key_6: "",
497
+ // location
498
+ latitude: 0,
499
+ longitude: 0,
500
+ google_location: "",
501
+ module: "GPSModule" /* GPSModule */,
502
+ alert_type: "Fuel" /* Fuel */,
503
+ alert_sub_type: "FuelRefill" /* FuelRefill */,
440
504
  // metadata
441
- status: "Active" /* Active */
505
+ status: "Active" /* Active */,
506
+ time_zone_id: ""
442
507
  });
443
508
  var findNotifications = async (data) => {
444
509
  return apiPost(ENDPOINTS.find, data);
@@ -31,21 +31,21 @@ declare const GPSGeofenceTransactionSchema: z.ZodObject<{
31
31
  geofence_time: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
32
32
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
33
33
  }, "strip", z.ZodTypeAny, {
34
- geofence_status_type: GeofenceStatusType;
35
- geofence_time: string;
36
34
  status: Status;
37
35
  organisation_id: string;
38
36
  vehicle_id: string;
39
37
  driver_id: string;
40
38
  gps_geofence_id: string;
41
- }, {
42
39
  geofence_status_type: GeofenceStatusType;
43
40
  geofence_time: string;
41
+ }, {
44
42
  status: Status;
45
43
  organisation_id: string;
46
44
  vehicle_id: string;
47
45
  driver_id: string;
48
46
  gps_geofence_id: string;
47
+ geofence_status_type: GeofenceStatusType;
48
+ geofence_time: string;
49
49
  }>;
50
50
  type GPSGeofenceTransactionDTO = z.infer<typeof GPSGeofenceTransactionSchema>;
51
51
  declare const GPSGeofenceTransactionQuerySchema: z.ZodObject<{
@@ -85,7 +85,6 @@ declare const GPSGeofenceTransactionQuerySchema: z.ZodObject<{
85
85
  gps_geofence_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
86
86
  geofence_status_type: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof GeofenceStatusType>, "many">>>;
87
87
  }, "strip", z.ZodTypeAny, {
88
- geofence_status_type: GeofenceStatusType[];
89
88
  status: Status[];
90
89
  search: string;
91
90
  paging: PAGING;
@@ -111,10 +110,10 @@ declare const GPSGeofenceTransactionQuerySchema: z.ZodObject<{
111
110
  vehicle_ids: string[];
112
111
  driver_ids: string[];
113
112
  gps_geofence_ids: string[];
113
+ geofence_status_type: GeofenceStatusType[];
114
114
  }, {
115
115
  date_format_id: string;
116
116
  time_zone_id: string;
117
- geofence_status_type?: GeofenceStatusType[] | undefined;
118
117
  status?: Status[] | undefined;
119
118
  search?: string | undefined;
120
119
  paging?: PAGING | undefined;
@@ -138,6 +137,7 @@ declare const GPSGeofenceTransactionQuerySchema: z.ZodObject<{
138
137
  vehicle_ids?: string[] | undefined;
139
138
  driver_ids?: string[] | undefined;
140
139
  gps_geofence_ids?: string[] | undefined;
140
+ geofence_status_type?: GeofenceStatusType[] | undefined;
141
141
  }>;
142
142
  type GPSGeofenceTransactionQueryDTO = z.infer<typeof GPSGeofenceTransactionQuerySchema>;
143
143
  declare const toGPSGeofenceTransactionPayload: (data: GPSGeofenceTransaction) => GPSGeofenceTransactionDTO;
@@ -40,23 +40,23 @@ declare const GPSGeofenceTransactionSummarySchema: z.ZodObject<{
40
40
  duration_seconds: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
41
41
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
42
42
  }, "strip", z.ZodTypeAny, {
43
+ geofence_enter_date_time: string;
44
+ geofence_exit_date_time: string;
45
+ duration_seconds: number;
43
46
  status: Status;
44
47
  organisation_id: string;
45
48
  vehicle_id: string;
46
49
  driver_id: string;
47
50
  gps_geofence_id: string;
48
- geofence_enter_date_time: string;
49
- geofence_exit_date_time: string;
50
- duration_seconds: number;
51
51
  enter_gps_geofence_transaction_id: string;
52
52
  exit_gps_geofence_transaction_id: string;
53
53
  }, {
54
+ geofence_enter_date_time: string;
54
55
  status: Status;
55
56
  organisation_id: string;
56
57
  vehicle_id: string;
57
58
  driver_id: string;
58
59
  gps_geofence_id: string;
59
- geofence_enter_date_time: string;
60
60
  enter_gps_geofence_transaction_id: string;
61
61
  exit_gps_geofence_transaction_id: string;
62
62
  geofence_exit_date_time?: string | undefined;
@@ -62,11 +62,11 @@ declare const TripGeofenceToGeofenceSchema: z.ZodObject<{
62
62
  mileage: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, unknown>>;
63
63
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
64
64
  }, "strip", z.ZodTypeAny, {
65
+ duration_seconds: number;
65
66
  status: Status;
66
67
  organisation_id: string;
67
68
  vehicle_id: string;
68
69
  driver_id: string;
69
- duration_seconds: number;
70
70
  from_geofence_exit_date_time: string;
71
71
  to_geofence_enter_date_time: string;
72
72
  travel_duration_seconds: number;
@@ -28,21 +28,21 @@ declare const MasterFuelCompanySchema: z.ZodObject<{
28
28
  logo_key: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
29
29
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
30
30
  }, "strip", z.ZodTypeAny, {
31
- company_name: string;
32
31
  description: string;
33
- logo_url: string;
34
- logo_key: string;
35
32
  status: Status;
36
33
  organisation_id: string;
37
34
  country_id: string;
38
- }, {
35
+ logo_key: string;
36
+ logo_url: string;
39
37
  company_name: string;
38
+ }, {
40
39
  status: Status;
41
40
  organisation_id: string;
42
41
  country_id: string;
42
+ company_name: string;
43
43
  description?: string | undefined;
44
- logo_url?: string | undefined;
45
44
  logo_key?: string | undefined;
45
+ logo_url?: string | undefined;
46
46
  }>;
47
47
  type MasterFuelCompanyDTO = z.infer<typeof MasterFuelCompanySchema>;
48
48
  declare const MasterFuelCompanyQuerySchema: z.ZodObject<{
@@ -21,14 +21,14 @@ declare const MasterVendorDocumentTypeSchema: z.ZodObject<{
21
21
  description: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
22
22
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
23
23
  }, "strip", z.ZodTypeAny, {
24
+ document_type: string;
24
25
  description: string;
25
26
  status: Status;
26
27
  organisation_id: string;
27
- document_type: string;
28
28
  }, {
29
+ document_type: string;
29
30
  status: Status;
30
31
  organisation_id: string;
31
- document_type: string;
32
32
  description?: string | undefined;
33
33
  }>;
34
34
  type MasterVendorDocumentTypeDTO = z.infer<typeof MasterVendorDocumentTypeSchema>;
@@ -31,6 +31,7 @@ declare const ContactUsDetailSchema: z.ZodObject<{
31
31
  telegram_chat_url: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
32
32
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
33
33
  }, "strip", z.ZodTypeAny, {
34
+ status: Status;
34
35
  mobile_number: string;
35
36
  email: string;
36
37
  facebook_link: string;
@@ -41,7 +42,6 @@ declare const ContactUsDetailSchema: z.ZodObject<{
41
42
  pinterest_link: string;
42
43
  whats_app_chat_url: string;
43
44
  telegram_chat_url: string;
44
- status: Status;
45
45
  }, {
46
46
  status: Status;
47
47
  mobile_number?: string | undefined;
@@ -17,10 +17,10 @@ declare const FaqSchema: z.ZodObject<{
17
17
  faq_content: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
18
18
  status: z.ZodType<Status, z.ZodTypeDef, Status>;
19
19
  }, "strip", z.ZodTypeAny, {
20
- status: Status;
21
20
  faq_section: string;
22
21
  faq_header: string;
23
22
  faq_content: string;
23
+ status: Status;
24
24
  }, {
25
25
  status: Status;
26
26
  faq_section?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vms-nest-prisma-api-document",
3
- "version": "6.0.14",
3
+ "version": "6.0.16",
4
4
  "description": "Reusable API SDK built with NestJS, Prisma, Axios, and Zod for VMS frontends.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",