vms-nest-prisma-api-document 8.0.1 → 9.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.
@@ -131,9 +131,26 @@ declare enum DeviceType {
131
131
  Web = "Web"
132
132
  }
133
133
  declare enum NotificationType {
134
- Whatsapp = "Whatsapp",
135
- Message = "Message",
136
- Email = "Email"
134
+ Email = "Email",
135
+ Push = "Push"
136
+ }
137
+ declare enum NotificationPreference {
138
+ GeofenceEnter = "GeofenceEnter",
139
+ GeofenceExit = "GeofenceExit",
140
+ FuelRemoval = "FuelRemoval",
141
+ FuelRefill = "FuelRefill",
142
+ IgnitionOn = "IgnitionOn",
143
+ IgnitionOff = "IgnitionOff"
144
+ }
145
+ declare enum ReportPreference {
146
+ FleetFuelRefillReport = "FleetFuelRefillReport",
147
+ FleetFuelRemovalReport = "FleetFuelRemovalReport",
148
+ FleetFuelConsumptionReport = "FleetFuelConsumptionReport"
149
+ }
150
+ declare enum ReportType {
151
+ Daily = "Daily",
152
+ Weekly = "Weekly",
153
+ Monthly = "Monthly"
137
154
  }
138
155
  declare enum GeofenceType {
139
156
  Polygon = "Polygon",
@@ -585,4 +602,4 @@ declare enum PaymentMode {
585
602
  Other = "Other"
586
603
  }
587
604
 
588
- export { AdminRole, AlertSubType, AlertType, BillingStatus, BooleanType, DeviceStatus, DeviceType, DocumentStatus, DocumentType, DocumentValidityStatus, DoorSensorStatus, ExpenseCategory, FileType, FleetSize, GPSFuelApproveStatus, GPSSource, GPSType, GeofencePurposeType, GeofenceStatusType, GeofenceType, InspectionActionStatus, InspectionStatus, InspectionType, Is12AM, IssueSeverity, IssueSource, IssueStatus, JobCardStatus, LifeExpiry, LinkStatus, LinkType, LoadChild, LoadChildCount, LoadParents, LoginFrom, MenuType, Module, NightDriving, NotificationType, OdometerSource, OrderBy, OverSpeed, PAGING, PaymentMode, PaymentStatus, Priority, PurchaseOrderStatus, PurchaseType, PurchaseVehicleType, RecurrenceInterval, RefillEntrySource, RefillMethod, ReminderSource, ReminderStatus, ReminderTriggerType, RequestType, RetreadingMethod, ScheduleStatus, ScheduleType, ServiceType, SimStatus, Status, StockType, TicketStatus, TimeSlot, TrackHistoryLinkStatus, TyreStatus, VerifyStatus, YesNo };
605
+ export { AdminRole, AlertSubType, AlertType, BillingStatus, BooleanType, DeviceStatus, DeviceType, DocumentStatus, DocumentType, DocumentValidityStatus, DoorSensorStatus, ExpenseCategory, FileType, FleetSize, GPSFuelApproveStatus, GPSSource, GPSType, GeofencePurposeType, GeofenceStatusType, GeofenceType, InspectionActionStatus, InspectionStatus, InspectionType, Is12AM, IssueSeverity, IssueSource, IssueStatus, JobCardStatus, LifeExpiry, LinkStatus, LinkType, LoadChild, LoadChildCount, LoadParents, LoginFrom, MenuType, Module, NightDriving, NotificationPreference, NotificationType, OdometerSource, OrderBy, OverSpeed, PAGING, PaymentMode, PaymentStatus, Priority, PurchaseOrderStatus, PurchaseType, PurchaseVehicleType, RecurrenceInterval, RefillEntrySource, RefillMethod, ReminderSource, ReminderStatus, ReminderTriggerType, ReportPreference, ReportType, RequestType, RetreadingMethod, ScheduleStatus, ScheduleType, ServiceType, SimStatus, Status, StockType, TicketStatus, TimeSlot, TrackHistoryLinkStatus, TyreStatus, VerifyStatus, YesNo };
@@ -157,11 +157,31 @@ var DeviceType = /* @__PURE__ */ ((DeviceType2) => {
157
157
  return DeviceType2;
158
158
  })(DeviceType || {});
159
159
  var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
160
- NotificationType2["Whatsapp"] = "Whatsapp";
161
- NotificationType2["Message"] = "Message";
162
160
  NotificationType2["Email"] = "Email";
161
+ NotificationType2["Push"] = "Push";
163
162
  return NotificationType2;
164
163
  })(NotificationType || {});
164
+ var NotificationPreference = /* @__PURE__ */ ((NotificationPreference2) => {
165
+ NotificationPreference2["GeofenceEnter"] = "GeofenceEnter";
166
+ NotificationPreference2["GeofenceExit"] = "GeofenceExit";
167
+ NotificationPreference2["FuelRemoval"] = "FuelRemoval";
168
+ NotificationPreference2["FuelRefill"] = "FuelRefill";
169
+ NotificationPreference2["IgnitionOn"] = "IgnitionOn";
170
+ NotificationPreference2["IgnitionOff"] = "IgnitionOff";
171
+ return NotificationPreference2;
172
+ })(NotificationPreference || {});
173
+ var ReportPreference = /* @__PURE__ */ ((ReportPreference2) => {
174
+ ReportPreference2["FleetFuelRefillReport"] = "FleetFuelRefillReport";
175
+ ReportPreference2["FleetFuelRemovalReport"] = "FleetFuelRemovalReport";
176
+ ReportPreference2["FleetFuelConsumptionReport"] = "FleetFuelConsumptionReport";
177
+ return ReportPreference2;
178
+ })(ReportPreference || {});
179
+ var ReportType = /* @__PURE__ */ ((ReportType2) => {
180
+ ReportType2["Daily"] = "Daily";
181
+ ReportType2["Weekly"] = "Weekly";
182
+ ReportType2["Monthly"] = "Monthly";
183
+ return ReportType2;
184
+ })(ReportType || {});
165
185
  var GeofenceType = /* @__PURE__ */ ((GeofenceType2) => {
166
186
  GeofenceType2["Polygon"] = "Polygon";
167
187
  GeofenceType2["Circle"] = "Circle";
@@ -693,6 +713,7 @@ export {
693
713
  MenuType,
694
714
  Module,
695
715
  NightDriving,
716
+ NotificationPreference,
696
717
  NotificationType,
697
718
  OdometerSource,
698
719
  OrderBy,
@@ -710,6 +731,8 @@ export {
710
731
  ReminderSource,
711
732
  ReminderStatus,
712
733
  ReminderTriggerType,
734
+ ReportPreference,
735
+ ReportType,
713
736
  RequestType,
714
737
  RetreadingMethod,
715
738
  ScheduleStatus,
@@ -221,9 +221,8 @@ var YesNo = /* @__PURE__ */ ((YesNo2) => {
221
221
  return YesNo2;
222
222
  })(YesNo || {});
223
223
  var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
224
- NotificationType2["Whatsapp"] = "Whatsapp";
225
- NotificationType2["Message"] = "Message";
226
224
  NotificationType2["Email"] = "Email";
225
+ NotificationType2["Push"] = "Push";
227
226
  return NotificationType2;
228
227
  })(NotificationType || {});
229
228
  var LinkType = /* @__PURE__ */ ((LinkType2) => {
@@ -193,9 +193,8 @@ var YesNo = /* @__PURE__ */ ((YesNo2) => {
193
193
  return YesNo2;
194
194
  })(YesNo || {});
195
195
  var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
196
- NotificationType2["Whatsapp"] = "Whatsapp";
197
- NotificationType2["Message"] = "Message";
198
196
  NotificationType2["Email"] = "Email";
197
+ NotificationType2["Push"] = "Push";
199
198
  return NotificationType2;
200
199
  })(NotificationType || {});
201
200
  var TrackHistoryLinkStatus = /* @__PURE__ */ ((TrackHistoryLinkStatus2) => {
@@ -0,0 +1,192 @@
1
+ import { YesNo, NotificationType, NotificationPreference, Status, PAGING, LoadParents, LoadChild, LoadChildCount, OrderBy } from '../../../../core/Enums.js';
2
+ import { FBR, SBR } from '../../../../core/BaseResponse.js';
3
+ import { z } from 'zod';
4
+ import { U as UserOrganisation, a as User, M as MasterVehicle } from '../../../../user_organisation_service-D2pCLN2b.js';
5
+ import '../../../../zod_utils/zod_base_schema.js';
6
+ import '../../../master/main/master_main_sim_provider_service.js';
7
+
8
+ interface UserNotificationPreferences extends Record<string, unknown> {
9
+ notification_preference_id: string;
10
+ notification_name: string;
11
+ notification_status: YesNo;
12
+ notification_type: NotificationType;
13
+ mobile_numbers?: string;
14
+ email_ids?: string;
15
+ cc_email_ids?: string;
16
+ notification_list: NotificationPreference[];
17
+ is_all_vehicles: YesNo;
18
+ status: Status;
19
+ added_date_time: string;
20
+ modified_date_time: string;
21
+ organisation_id: string;
22
+ UserOrganisation?: UserOrganisation;
23
+ UserNotificationPreferenceUserLink: UserNotificationPreferenceUserLink[];
24
+ UserNotificationPreferenceVehicleLink: UserNotificationPreferenceVehicleLink[];
25
+ _count?: {
26
+ UserNotificationPreferenceUserLink: number;
27
+ UserNotificationPreferenceVehicleLink: number;
28
+ };
29
+ }
30
+ interface UserNotificationPreferenceVehicleLink extends Record<string, unknown> {
31
+ notification_vehicle_id: string;
32
+ status: Status;
33
+ added_date_time: string;
34
+ modified_date_time: string;
35
+ vehicle_id: string;
36
+ MasterVehicle?: MasterVehicle;
37
+ vehicle_number?: string;
38
+ vehicle_type?: string;
39
+ notification_preference_id: string;
40
+ UserNotificationPreferences?: UserNotificationPreferences;
41
+ }
42
+ interface UserNotificationPreferenceUserLink extends Record<string, unknown> {
43
+ notification_user_id: string;
44
+ status: Status;
45
+ added_date_time: string;
46
+ modified_date_time: string;
47
+ user_id: string;
48
+ User?: User;
49
+ notification_preference_id: string;
50
+ UserNotificationPreferences?: UserNotificationPreferences;
51
+ }
52
+ declare const UserNotificationPreferencesSchema: z.ZodObject<{
53
+ organisation_id: z.ZodEffects<z.ZodString, string, string>;
54
+ notification_name: z.ZodEffects<z.ZodString, string, string>;
55
+ notification_status: z.ZodType<YesNo, z.ZodTypeDef, YesNo>;
56
+ notification_type: z.ZodType<NotificationType, z.ZodTypeDef, NotificationType>;
57
+ mobile_numbers: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
58
+ email_ids: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
59
+ cc_email_ids: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
60
+ is_all_vehicles: z.ZodType<YesNo, z.ZodTypeDef, YesNo>;
61
+ notification_list: z.ZodDefault<z.ZodArray<z.ZodNativeEnum<typeof NotificationPreference>, "many">>;
62
+ status: z.ZodType<Status, z.ZodTypeDef, Status>;
63
+ vehicle_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
64
+ user_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ notification_name: string;
67
+ notification_status: YesNo;
68
+ notification_type: NotificationType;
69
+ mobile_numbers: string;
70
+ email_ids: string;
71
+ cc_email_ids: string;
72
+ notification_list: NotificationPreference[];
73
+ is_all_vehicles: YesNo;
74
+ status: Status;
75
+ organisation_id: string;
76
+ vehicle_ids: string[];
77
+ user_ids: string[];
78
+ }, {
79
+ notification_name: string;
80
+ notification_status: YesNo;
81
+ notification_type: NotificationType;
82
+ is_all_vehicles: YesNo;
83
+ status: Status;
84
+ organisation_id: string;
85
+ mobile_numbers?: string | undefined;
86
+ email_ids?: string | undefined;
87
+ cc_email_ids?: string | undefined;
88
+ notification_list?: NotificationPreference[] | undefined;
89
+ vehicle_ids?: string[] | undefined;
90
+ user_ids?: string[] | undefined;
91
+ }>;
92
+ type UserNotificationPreferencesDTO = z.infer<typeof UserNotificationPreferencesSchema>;
93
+ declare const UserNotificationPreferencesQuerySchema: z.ZodObject<{
94
+ search: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
95
+ status: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof Status>, "many">>>;
96
+ paging: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof PAGING>>>;
97
+ page_count: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
98
+ page_index: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
99
+ load_parents: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadParents>>>;
100
+ load_parents_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
101
+ load_child: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadChild>>>;
102
+ load_child_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
103
+ load_child_count: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof LoadChildCount>>>;
104
+ load_child_count_list: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
105
+ include_details: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
106
+ where_relations: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
107
+ order_by: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
108
+ name: z.ZodEffects<z.ZodString, string, string>;
109
+ field: z.ZodEffects<z.ZodString, string, string>;
110
+ direction: z.ZodType<OrderBy, z.ZodTypeDef, OrderBy>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ name: string;
113
+ field: string;
114
+ direction: OrderBy;
115
+ }, {
116
+ name: string;
117
+ field: string;
118
+ direction: OrderBy;
119
+ }>, "many">>>;
120
+ include_master_data: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof YesNo>>>;
121
+ date_format_id: z.ZodEffects<z.ZodString, string, string>;
122
+ time_zone_id: z.ZodEffects<z.ZodString, string, string>;
123
+ } & {
124
+ organisation_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
125
+ notification_preference_ids: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
126
+ notification_status: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof YesNo>, "many">>>;
127
+ notification_type: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof NotificationType>, "many">>>;
128
+ is_all_vehicles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof YesNo>, "many">>>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ notification_status: YesNo[];
131
+ notification_type: NotificationType[];
132
+ is_all_vehicles: YesNo[];
133
+ status: Status[];
134
+ search: string;
135
+ paging: PAGING;
136
+ page_count: number;
137
+ page_index: number;
138
+ load_parents: LoadParents;
139
+ load_parents_list: string[];
140
+ load_child: LoadChild;
141
+ load_child_list: string[];
142
+ load_child_count: LoadChildCount;
143
+ load_child_count_list: string[];
144
+ include_details: Record<string, any>;
145
+ where_relations: Record<string, any>;
146
+ order_by: {
147
+ name: string;
148
+ field: string;
149
+ direction: OrderBy;
150
+ }[];
151
+ include_master_data: YesNo;
152
+ date_format_id: string;
153
+ time_zone_id: string;
154
+ organisation_ids: string[];
155
+ notification_preference_ids: string[];
156
+ }, {
157
+ date_format_id: string;
158
+ time_zone_id: string;
159
+ notification_status?: YesNo[] | undefined;
160
+ notification_type?: NotificationType[] | undefined;
161
+ is_all_vehicles?: YesNo[] | undefined;
162
+ status?: Status[] | undefined;
163
+ search?: string | undefined;
164
+ paging?: PAGING | undefined;
165
+ page_count?: unknown;
166
+ page_index?: unknown;
167
+ load_parents?: LoadParents | undefined;
168
+ load_parents_list?: string[] | undefined;
169
+ load_child?: LoadChild | undefined;
170
+ load_child_list?: string[] | undefined;
171
+ load_child_count?: LoadChildCount | undefined;
172
+ load_child_count_list?: string[] | undefined;
173
+ include_details?: Record<string, any> | undefined;
174
+ where_relations?: Record<string, any> | undefined;
175
+ order_by?: {
176
+ name: string;
177
+ field: string;
178
+ direction: OrderBy;
179
+ }[] | undefined;
180
+ include_master_data?: YesNo | undefined;
181
+ organisation_ids?: string[] | undefined;
182
+ notification_preference_ids?: string[] | undefined;
183
+ }>;
184
+ type UserNotificationPreferencesQueryDTO = z.infer<typeof UserNotificationPreferencesQuerySchema>;
185
+ declare const toUserNotificationPreferencesPayload: (data: UserNotificationPreferences) => UserNotificationPreferencesDTO;
186
+ declare const newUserNotificationPreferencesPayload: () => UserNotificationPreferencesDTO;
187
+ declare const findUserNotificationPreferences: (data: UserNotificationPreferencesQueryDTO) => Promise<FBR<UserNotificationPreferences[]>>;
188
+ declare const createUserNotificationPreferences: (data: UserNotificationPreferencesDTO) => Promise<SBR>;
189
+ declare const updateUserNotificationPreferences: (id: string, data: UserNotificationPreferencesDTO) => Promise<SBR>;
190
+ declare const deleteUserNotificationPreferences: (id: string) => Promise<SBR>;
191
+
192
+ export { type UserNotificationPreferenceUserLink, type UserNotificationPreferenceVehicleLink, type UserNotificationPreferences, type UserNotificationPreferencesDTO, type UserNotificationPreferencesQueryDTO, UserNotificationPreferencesQuerySchema, UserNotificationPreferencesSchema, createUserNotificationPreferences, deleteUserNotificationPreferences, findUserNotificationPreferences, newUserNotificationPreferencesPayload, toUserNotificationPreferencesPayload, updateUserNotificationPreferences };
@@ -0,0 +1,365 @@
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/gps/features/preferences/user_notification_preferences.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 = 1e9, 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 handleNullOrUndefinedEnumArray = (value, defaultValue) => Array.isArray(value) ? value : defaultValue;
88
+ var getAllEnums = (enumType) => {
89
+ return Object.values(enumType);
90
+ };
91
+ var enumArrayMandatory = (fieldName, enumType, defaultValue = getAllEnums(enumType), min = 1, max = 100, unique = false) => {
92
+ const schema = z.array(z.nativeEnum(enumType), {
93
+ invalid_type_error: `${fieldName} must be an array containing only the following values: ${Object.values(
94
+ enumType
95
+ ).join(", ")}.`
96
+ }).min(min, `${fieldName} must contain at least ${min} items.`).max(max, `${fieldName} must contain at most ${max} items.`);
97
+ if (unique) {
98
+ schema.refine(
99
+ (arr) => new Set(arr).size === arr.length,
100
+ `${fieldName} must contain unique values.`
101
+ );
102
+ }
103
+ schema.transform((val) => handleNullOrUndefinedEnumArray(val, []));
104
+ return schema.default(() => defaultValue);
105
+ };
106
+ var enumArrayOptional = (fieldName, enumType, defaultValue = getAllEnums(enumType), min = 0, max = 100, unique = false) => {
107
+ const schema = z.array(z.nativeEnum(enumType), {
108
+ invalid_type_error: `${fieldName} must be an array containing only the following values: ${Object.values(
109
+ enumType
110
+ ).join(", ")}.`
111
+ }).min(min, `${fieldName} must contain at least ${min} items.`).max(max, `${fieldName} must contain at most ${max} items.`);
112
+ if (unique) {
113
+ schema.refine(
114
+ (arr) => new Set(arr).size === arr.length,
115
+ `${fieldName} must contain unique values.`
116
+ );
117
+ }
118
+ return schema.optional().default(() => defaultValue);
119
+ };
120
+ var dynamicJsonSchema = (fieldName, defaultValue = {}) => z.record(z.any()).optional().default(() => defaultValue);
121
+ var single_select_mandatory = (fieldName) => {
122
+ const schema = z.string().trim().nonempty(`Please select ${fieldName}.`).transform(handleNullOrUndefined);
123
+ return schema;
124
+ };
125
+ var single_select_optional = (fieldName) => {
126
+ r_log(fieldName);
127
+ const schema = z.string().trim().transform(handleNullOrUndefined);
128
+ return schema;
129
+ };
130
+ var multi_select_optional = (fieldName, max = 1e3, defaultValue = []) => {
131
+ const schema = z.array(
132
+ z.string({
133
+ invalid_type_error: `${fieldName} must be an array of strings.`
134
+ })
135
+ ).max(
136
+ max,
137
+ `Please select at most ${max} ${fieldName}${max > 1 ? "s" : ""}.`
138
+ );
139
+ return schema.optional().default(defaultValue);
140
+ };
141
+
142
+ // src/zod_utils/zod_base_schema.ts
143
+ import { z as z2 } from "zod";
144
+
145
+ // src/core/Enums.ts
146
+ var PAGING = /* @__PURE__ */ ((PAGING2) => {
147
+ PAGING2["Yes"] = "Yes";
148
+ PAGING2["No"] = "No";
149
+ return PAGING2;
150
+ })(PAGING || {});
151
+ var LoadParents = /* @__PURE__ */ ((LoadParents2) => {
152
+ LoadParents2["Yes"] = "Yes";
153
+ LoadParents2["No"] = "No";
154
+ LoadParents2["Custom"] = "Custom";
155
+ return LoadParents2;
156
+ })(LoadParents || {});
157
+ var LoadChild = /* @__PURE__ */ ((LoadChild2) => {
158
+ LoadChild2["No"] = "No";
159
+ LoadChild2["Yes"] = "Yes";
160
+ LoadChild2["Count"] = "Count";
161
+ LoadChild2["Custom"] = "Custom";
162
+ LoadChild2["Direct"] = "Direct";
163
+ return LoadChild2;
164
+ })(LoadChild || {});
165
+ var LoadChildCount = /* @__PURE__ */ ((LoadChildCount2) => {
166
+ LoadChildCount2["No"] = "No";
167
+ LoadChildCount2["Yes"] = "Yes";
168
+ LoadChildCount2["Custom"] = "Custom";
169
+ return LoadChildCount2;
170
+ })(LoadChildCount || {});
171
+ var OrderBy = /* @__PURE__ */ ((OrderBy2) => {
172
+ OrderBy2["asc"] = "asc";
173
+ OrderBy2["desc"] = "desc";
174
+ return OrderBy2;
175
+ })(OrderBy || {});
176
+ var LoginFrom = /* @__PURE__ */ ((LoginFrom2) => {
177
+ LoginFrom2["Web"] = "Web";
178
+ LoginFrom2["Android"] = "Android";
179
+ LoginFrom2["IPhone"] = "IPhone";
180
+ return LoginFrom2;
181
+ })(LoginFrom || {});
182
+ var Status = /* @__PURE__ */ ((Status2) => {
183
+ Status2["Active"] = "Active";
184
+ Status2["Inactive"] = "Inactive";
185
+ return Status2;
186
+ })(Status || {});
187
+ var FileType = /* @__PURE__ */ ((FileType2) => {
188
+ FileType2["NoFile"] = "NoFile";
189
+ FileType2["Image"] = "Image";
190
+ FileType2["Video"] = "Video";
191
+ FileType2["PDF"] = "PDF";
192
+ return FileType2;
193
+ })(FileType || {});
194
+ var YesNo = /* @__PURE__ */ ((YesNo2) => {
195
+ YesNo2["Yes"] = "Yes";
196
+ YesNo2["No"] = "No";
197
+ return YesNo2;
198
+ })(YesNo || {});
199
+ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
200
+ NotificationType2["Email"] = "Email";
201
+ NotificationType2["Push"] = "Push";
202
+ return NotificationType2;
203
+ })(NotificationType || {});
204
+ var NotificationPreference = /* @__PURE__ */ ((NotificationPreference2) => {
205
+ NotificationPreference2["GeofenceEnter"] = "GeofenceEnter";
206
+ NotificationPreference2["GeofenceExit"] = "GeofenceExit";
207
+ NotificationPreference2["FuelRemoval"] = "FuelRemoval";
208
+ NotificationPreference2["FuelRefill"] = "FuelRefill";
209
+ NotificationPreference2["IgnitionOn"] = "IgnitionOn";
210
+ NotificationPreference2["IgnitionOff"] = "IgnitionOff";
211
+ return NotificationPreference2;
212
+ })(NotificationPreference || {});
213
+
214
+ // src/zod_utils/zod_base_schema.ts
215
+ var OrderBySchema = z2.array(
216
+ z2.object({
217
+ name: stringMandatory("Order Field Name", 0, 255),
218
+ field: stringMandatory("Order Field Name", 0, 255),
219
+ direction: enumMandatory("Order Direction", OrderBy, "asc" /* asc */)
220
+ })
221
+ );
222
+ var BaseQuerySchema = z2.object({
223
+ search: stringOptional("Search", 0, 255, ""),
224
+ status: enumArrayOptional("Status", Status, getAllEnums(Status), 0, 10, true),
225
+ paging: enumOptional("Paging", PAGING, "Yes" /* Yes */),
226
+ page_count: numberOptional("Page Count", 0, 1e3, 100),
227
+ page_index: numberOptional("Page Index", 0, 1e3, 0),
228
+ load_parents: enumOptional("Load Parents", LoadParents, "No" /* No */),
229
+ load_parents_list: stringArrayOptional("Load Parents List"),
230
+ load_child: enumOptional("Load Child", LoadChild, "No" /* No */),
231
+ load_child_list: stringArrayOptional("Load Child List"),
232
+ load_child_count: enumOptional(
233
+ "Load Child",
234
+ LoadChildCount,
235
+ "No" /* No */
236
+ ),
237
+ load_child_count_list: stringArrayOptional("Load Child List"),
238
+ include_details: dynamicJsonSchema("Include Details", {}),
239
+ where_relations: dynamicJsonSchema("Where Relations", {}),
240
+ order_by: OrderBySchema.optional().default([]),
241
+ include_master_data: enumOptional("Include Master Data", YesNo, "No" /* No */),
242
+ date_format_id: single_select_optional("MasterMainDateFormat"),
243
+ time_zone_id: single_select_optional("MasterMainTimeZone")
244
+ });
245
+ var FilePresignedUrlSchema = z2.object({
246
+ file_name: stringMandatory("File Name", 1, 255),
247
+ file_type: enumMandatory("File Type", FileType, "Image" /* Image */)
248
+ });
249
+ var MongoBaseQuerySchema = z2.object({
250
+ search: stringOptional("Search", 0, 255, ""),
251
+ paging: enumOptional("Paging", PAGING, "Yes" /* Yes */),
252
+ page_count: numberOptional("Page Count", 0, 1e3, 100),
253
+ page_index: numberOptional("Page Index", 0, 1e3, 0),
254
+ login_from: enumMandatory("Login From", LoginFrom, "Web" /* Web */),
255
+ date_format_id: single_select_optional("MasterMainDateFormat"),
256
+ // ✅ Single-selection -> MasterMainDateFormat
257
+ time_zone_id: single_select_optional("MasterMainTimeZone")
258
+ // ✅ Single-selection -> MasterMainTimeZone
259
+ });
260
+
261
+ // src/services/gps/features/preferences/user_notification_preferences.service.ts
262
+ var URL = "gps/features/user_notification_preferences";
263
+ var ENDPOINTS = {
264
+ find: `${URL}/search`,
265
+ create: URL,
266
+ update: (id) => `${URL}/${id}`,
267
+ delete: (id) => `${URL}/${id}`
268
+ };
269
+ var UserNotificationPreferencesSchema = z3.object({
270
+ organisation_id: single_select_mandatory("UserOrganisation"),
271
+ notification_name: stringMandatory("Notification Name", 3, 100),
272
+ notification_status: enumMandatory("Notification Status", YesNo, "No" /* No */),
273
+ notification_type: enumMandatory(
274
+ "Notification Type",
275
+ NotificationType,
276
+ "Push" /* Push */
277
+ ),
278
+ mobile_numbers: stringOptional("Mobile Numbers", 0, 300),
279
+ email_ids: stringOptional("Email IDs", 0, 300),
280
+ cc_email_ids: stringOptional("CC email IDs", 0, 300),
281
+ is_all_vehicles: enumMandatory("Is All Vehicles", YesNo, "No" /* No */),
282
+ notification_list: enumArrayMandatory(
283
+ "Notification List",
284
+ NotificationPreference,
285
+ getAllEnums(NotificationPreference)
286
+ ),
287
+ status: enumMandatory("Status", Status, "Active" /* Active */),
288
+ vehicle_ids: multi_select_optional("MasterVehicle"),
289
+ // Multi selection -> MasterVehicle
290
+ user_ids: multi_select_optional("User")
291
+ // Multi selection -> User
292
+ });
293
+ var UserNotificationPreferencesQuerySchema = BaseQuerySchema.extend({
294
+ organisation_ids: multi_select_optional("UserOrganisation"),
295
+ // ✅ Multi-Selection -> UserOrganisation
296
+ notification_preference_ids: multi_select_optional(
297
+ "UserNotificationPreferences"
298
+ ),
299
+ // ✅ Multi-Selection -> UserNotificationPreferences
300
+ notification_status: enumArrayOptional(
301
+ "Notification Status",
302
+ YesNo,
303
+ getAllEnums(YesNo)
304
+ ),
305
+ notification_type: enumArrayOptional(
306
+ "Notification Type",
307
+ NotificationType,
308
+ getAllEnums(NotificationType)
309
+ ),
310
+ is_all_vehicles: enumArrayOptional(
311
+ "Is All Vehicles",
312
+ YesNo,
313
+ getAllEnums(YesNo)
314
+ )
315
+ });
316
+ var toUserNotificationPreferencesPayload = (data) => ({
317
+ organisation_id: data.organisation_id,
318
+ notification_name: data.notification_name,
319
+ notification_status: data.notification_status,
320
+ notification_type: data.notification_type,
321
+ mobile_numbers: data.mobile_numbers ?? "",
322
+ email_ids: data.email_ids ?? "",
323
+ cc_email_ids: data.cc_email_ids ?? "",
324
+ notification_list: data.notification_list ?? [],
325
+ is_all_vehicles: data.is_all_vehicles,
326
+ status: data.status,
327
+ vehicle_ids: data.UserNotificationPreferenceVehicleLink?.map((v) => v.vehicle_id) ?? [],
328
+ user_ids: data.UserNotificationPreferenceUserLink?.map((v) => v.user_id) ?? []
329
+ });
330
+ var newUserNotificationPreferencesPayload = () => ({
331
+ organisation_id: "",
332
+ notification_name: "",
333
+ notification_status: "No" /* No */,
334
+ notification_type: "Push" /* Push */,
335
+ mobile_numbers: "",
336
+ email_ids: "",
337
+ cc_email_ids: "",
338
+ notification_list: [],
339
+ is_all_vehicles: "No" /* No */,
340
+ vehicle_ids: [],
341
+ user_ids: [],
342
+ status: "Active" /* Active */
343
+ });
344
+ var findUserNotificationPreferences = async (data) => {
345
+ return apiPost(ENDPOINTS.find, data);
346
+ };
347
+ var createUserNotificationPreferences = async (data) => {
348
+ return apiPost(ENDPOINTS.create, data);
349
+ };
350
+ var updateUserNotificationPreferences = async (id, data) => {
351
+ return apiPatch(ENDPOINTS.update(id), data);
352
+ };
353
+ var deleteUserNotificationPreferences = async (id) => {
354
+ return apiDelete(ENDPOINTS.delete(id));
355
+ };
356
+ export {
357
+ UserNotificationPreferencesQuerySchema,
358
+ UserNotificationPreferencesSchema,
359
+ createUserNotificationPreferences,
360
+ deleteUserNotificationPreferences,
361
+ findUserNotificationPreferences,
362
+ newUserNotificationPreferencesPayload,
363
+ toUserNotificationPreferencesPayload,
364
+ updateUserNotificationPreferences
365
+ };