vr-commons 1.0.139 → 1.0.141
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/utils/admin.devicePayment.utils.d.ts +2 -0
- package/dist/utils/admin.devicePayment.utils.js +41 -33
- package/dist/validations/admin.devices.validations.d.ts +37 -49
- package/dist/validations/admin.devices.validations.js +30 -21
- package/dist/validations/index.d.ts +1 -1
- package/dist/validations/index.js +3 -4
- package/package.json +1 -1
|
@@ -37,10 +37,12 @@ export declare const DPP_OperationsUtil: {
|
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* Generate installments for a hire purchase plan
|
|
40
|
+
* ✅ Updated to use unitPrice and create one installment at a time
|
|
40
41
|
*/
|
|
41
42
|
generateInstallments(plan: DevicePaymentPlan, transaction?: Transaction): Promise<void>;
|
|
42
43
|
/**
|
|
43
44
|
* Format plan for operation response
|
|
45
|
+
* ✅ Updated to use unitPrice and totalAmount
|
|
44
46
|
*/
|
|
45
47
|
formatPlanForOps(plan: DevicePaymentPlan | null): any;
|
|
46
48
|
};
|
|
@@ -75,7 +75,7 @@ exports.DPP_OperationsUtil = {
|
|
|
75
75
|
}
|
|
76
76
|
// For now, require exact installment amount
|
|
77
77
|
// Could be modified to allow overpayment later
|
|
78
|
-
if (amount !== nextInstallment.amount) {
|
|
78
|
+
if (amount !== Number(nextInstallment.amount)) {
|
|
79
79
|
return {
|
|
80
80
|
valid: false,
|
|
81
81
|
reason: `Payment amount must equal the next installment amount of ${nextInstallment.amount}`,
|
|
@@ -88,12 +88,13 @@ exports.DPP_OperationsUtil = {
|
|
|
88
88
|
* Calculate new values after payment
|
|
89
89
|
*/
|
|
90
90
|
calculatePaymentEffects(plan, amount) {
|
|
91
|
-
|
|
92
|
-
const
|
|
91
|
+
// ✅ Use plan.totalAmount instead of pricingSnapshot.totalAmount
|
|
92
|
+
const totalAmount = Number(plan.totalAmount) || 0;
|
|
93
|
+
const newPaidAmount = Number(plan.paidAmount) + amount;
|
|
94
|
+
const newOutstandingAmount = Math.max(0, totalAmount - newPaidAmount);
|
|
93
95
|
const wasCompleted = plan.status === "COMPLETED";
|
|
94
96
|
const isNowCompleted = newOutstandingAmount <= 0;
|
|
95
|
-
const
|
|
96
|
-
const progress = (newPaidAmount / totalAmount) * 100;
|
|
97
|
+
const progress = totalAmount > 0 ? (newPaidAmount / totalAmount) * 100 : 0;
|
|
97
98
|
return {
|
|
98
99
|
newPaidAmount,
|
|
99
100
|
newOutstandingAmount,
|
|
@@ -104,6 +105,7 @@ exports.DPP_OperationsUtil = {
|
|
|
104
105
|
},
|
|
105
106
|
/**
|
|
106
107
|
* Generate installments for a hire purchase plan
|
|
108
|
+
* ✅ Updated to use unitPrice and create one installment at a time
|
|
107
109
|
*/
|
|
108
110
|
async generateInstallments(plan, transaction) {
|
|
109
111
|
const pricing = plan.pricingSnapshot;
|
|
@@ -112,7 +114,10 @@ exports.DPP_OperationsUtil = {
|
|
|
112
114
|
}
|
|
113
115
|
const InstallmentModel = vr_models_1.Installment;
|
|
114
116
|
const installments = [];
|
|
115
|
-
|
|
117
|
+
// ✅ Get device count from plan
|
|
118
|
+
const deviceCount = plan.devices?.length || 1;
|
|
119
|
+
const installmentAmount = Number(pricing.installmentAmount) * deviceCount;
|
|
120
|
+
const dueDate = new Date();
|
|
116
121
|
if (pricing.installmentFrequency === "DAILY") {
|
|
117
122
|
dueDate.setDate(dueDate.getDate() + 1);
|
|
118
123
|
}
|
|
@@ -122,33 +127,29 @@ exports.DPP_OperationsUtil = {
|
|
|
122
127
|
else if (pricing.installmentFrequency === "MONTHLY") {
|
|
123
128
|
dueDate.setMonth(dueDate.getMonth() + 1);
|
|
124
129
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
else if (pricing.installmentFrequency === "MONTHLY") {
|
|
142
|
-
dueDate.setMonth(dueDate.getMonth() + 1);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
await InstallmentModel.bulkCreate(installments, { transaction });
|
|
130
|
+
// ✅ Create only the first installment (not all at once)
|
|
131
|
+
const firstInstallment = {
|
|
132
|
+
devicePaymentPlanId: plan.id,
|
|
133
|
+
installmentNumber: 1,
|
|
134
|
+
amount: installmentAmount,
|
|
135
|
+
paidAmount: 0.0,
|
|
136
|
+
dueDate: new Date(dueDate),
|
|
137
|
+
status: "PENDING",
|
|
138
|
+
isAutoGenerated: true,
|
|
139
|
+
metadata: {
|
|
140
|
+
totalInstallments: pricing.installmentCount,
|
|
141
|
+
remainingInstallments: pricing.installmentCount - 1,
|
|
142
|
+
createdAt: new Date().toISOString(),
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
await InstallmentModel.create(firstInstallment, { transaction });
|
|
146
146
|
// Set the first installment as next due
|
|
147
|
-
plan.nextInstallmentDueAt =
|
|
147
|
+
plan.nextInstallmentDueAt = firstInstallment.dueDate;
|
|
148
148
|
await plan.save({ transaction });
|
|
149
149
|
},
|
|
150
150
|
/**
|
|
151
151
|
* Format plan for operation response
|
|
152
|
+
* ✅ Updated to use unitPrice and totalAmount
|
|
152
153
|
*/
|
|
153
154
|
formatPlanForOps(plan) {
|
|
154
155
|
if (!plan)
|
|
@@ -158,6 +159,7 @@ exports.DPP_OperationsUtil = {
|
|
|
158
159
|
id: plan.id,
|
|
159
160
|
userId: plan.userId,
|
|
160
161
|
pricingSnapshot: plan.pricingSnapshot,
|
|
162
|
+
totalAmount: plan.totalAmount, // ✅ Added
|
|
161
163
|
paidAmount: plan.paidAmount,
|
|
162
164
|
outstandingAmount: plan.outstandingAmount,
|
|
163
165
|
lastPaymentAt: plan.lastPaymentAt,
|
|
@@ -170,21 +172,27 @@ exports.DPP_OperationsUtil = {
|
|
|
170
172
|
user: plan.user || null,
|
|
171
173
|
installments: plan.installments || [],
|
|
172
174
|
};
|
|
173
|
-
|
|
175
|
+
// ✅ Use plan.totalAmount instead of pricingSnapshot.totalAmount
|
|
176
|
+
const totalAmount = Number(planData.totalAmount) || 0;
|
|
174
177
|
const hasInstallments = (planData.installments?.length ?? 0) > 0;
|
|
175
178
|
return {
|
|
176
179
|
id: planData.id,
|
|
177
180
|
userId: planData.userId,
|
|
178
181
|
pricingSnapshot: {
|
|
182
|
+
id: planData.pricingSnapshot?.id || null,
|
|
183
|
+
name: planData.pricingSnapshot?.name || null,
|
|
179
184
|
type: planData.pricingSnapshot?.type || null,
|
|
180
|
-
|
|
185
|
+
unitPrice: planData.pricingSnapshot?.unitPrice || 0, // ✅ Changed from totalAmount
|
|
181
186
|
downPayment: planData.pricingSnapshot?.downPayment || 0,
|
|
182
187
|
installmentAmount: planData.pricingSnapshot?.installmentAmount || null,
|
|
183
188
|
installmentFrequency: planData.pricingSnapshot?.installmentFrequency || null,
|
|
184
189
|
installmentCount: planData.pricingSnapshot?.installmentCount || null,
|
|
185
190
|
gracePeriodDays: planData.pricingSnapshot?.gracePeriodDays || 2,
|
|
186
191
|
autoLockOnMiss: planData.pricingSnapshot?.autoLockOnMiss ?? true,
|
|
192
|
+
minOrderQuantity: planData.pricingSnapshot?.minOrderQuantity || 1,
|
|
193
|
+
maxOrderQuantity: planData.pricingSnapshot?.maxOrderQuantity || 1,
|
|
187
194
|
},
|
|
195
|
+
totalAmount: totalAmount, // ✅ Added
|
|
188
196
|
paidAmount: planData.paidAmount || 0,
|
|
189
197
|
outstandingAmount: planData.outstandingAmount || 0,
|
|
190
198
|
lastPaymentAt: planData.lastPaymentAt,
|
|
@@ -196,9 +204,9 @@ exports.DPP_OperationsUtil = {
|
|
|
196
204
|
devices: planData.devices || [],
|
|
197
205
|
user: planData.user || null,
|
|
198
206
|
installments: planData.installments || [],
|
|
199
|
-
progress: totalAmount > 0 ? (plan.paidAmount / totalAmount) * 100 : 0,
|
|
200
|
-
canEdit: plan.paidAmount === 0,
|
|
201
|
-
canDelete: plan.paidAmount === 0,
|
|
207
|
+
progress: totalAmount > 0 ? (Number(plan.paidAmount) / totalAmount) * 100 : 0,
|
|
208
|
+
canEdit: Number(plan.paidAmount) === 0,
|
|
209
|
+
canDelete: Number(plan.paidAmount) === 0,
|
|
202
210
|
isOverdue: false,
|
|
203
211
|
hasInstallments,
|
|
204
212
|
};
|
|
@@ -1,46 +1,34 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const createDevicePairsSchema: z.ZodEffects<z.ZodObject<{
|
|
3
3
|
body: z.ZodObject<{
|
|
4
|
-
serialNumber: z.ZodString;
|
|
5
4
|
productId: z.ZodString;
|
|
5
|
+
pairIds: z.ZodArray<z.ZodString, "many">;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
7
|
productId: string;
|
|
8
|
-
|
|
8
|
+
pairIds: string[];
|
|
9
9
|
}, {
|
|
10
10
|
productId: string;
|
|
11
|
-
|
|
11
|
+
pairIds: string[];
|
|
12
12
|
}>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
body: {
|
|
15
15
|
productId: string;
|
|
16
|
-
|
|
16
|
+
pairIds: string[];
|
|
17
17
|
};
|
|
18
18
|
}, {
|
|
19
19
|
body: {
|
|
20
20
|
productId: string;
|
|
21
|
-
|
|
21
|
+
pairIds: string[];
|
|
22
22
|
};
|
|
23
|
-
}
|
|
24
|
-
export declare const bulkCreateDevicesSchema: z.ZodObject<{
|
|
25
|
-
body: z.ZodObject<{
|
|
26
|
-
productId: z.ZodString;
|
|
27
|
-
serialNumbers: z.ZodArray<z.ZodString, "many">;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
productId: string;
|
|
30
|
-
serialNumbers: string[];
|
|
31
|
-
}, {
|
|
32
|
-
productId: string;
|
|
33
|
-
serialNumbers: string[];
|
|
34
|
-
}>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
}>, {
|
|
36
24
|
body: {
|
|
37
25
|
productId: string;
|
|
38
|
-
|
|
26
|
+
pairIds: string[];
|
|
39
27
|
};
|
|
40
28
|
}, {
|
|
41
29
|
body: {
|
|
42
30
|
productId: string;
|
|
43
|
-
|
|
31
|
+
pairIds: string[];
|
|
44
32
|
};
|
|
45
33
|
}>;
|
|
46
34
|
export declare const updateDeviceSchema: z.ZodObject<{
|
|
@@ -65,23 +53,23 @@ export declare const updateDeviceSchema: z.ZodObject<{
|
|
|
65
53
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
66
54
|
}>;
|
|
67
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
params: {
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
68
59
|
body: {
|
|
69
60
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
70
61
|
serialNumber?: string | undefined;
|
|
71
62
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
72
63
|
};
|
|
64
|
+
}, {
|
|
73
65
|
params: {
|
|
74
66
|
id: string;
|
|
75
67
|
};
|
|
76
|
-
}, {
|
|
77
68
|
body: {
|
|
78
69
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
79
70
|
serialNumber?: string | undefined;
|
|
80
71
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
81
72
|
};
|
|
82
|
-
params: {
|
|
83
|
-
id: string;
|
|
84
|
-
};
|
|
85
73
|
}>;
|
|
86
74
|
export declare const getDeviceSchema: z.ZodObject<{
|
|
87
75
|
params: z.ZodObject<{
|
|
@@ -113,53 +101,53 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
113
101
|
sortBy: z.ZodOptional<z.ZodEnum<["serialNumber", "status", "createdAt", "updatedAt"]>>;
|
|
114
102
|
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
115
103
|
}, "strip", z.ZodTypeAny, {
|
|
116
|
-
search?: string | undefined;
|
|
117
|
-
limit?: number | undefined;
|
|
118
104
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
119
|
-
page?: number | undefined;
|
|
120
|
-
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
121
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
122
105
|
productId?: string | undefined;
|
|
123
106
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
107
|
+
page?: number | undefined;
|
|
108
|
+
limit?: number | undefined;
|
|
124
109
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
125
110
|
isAssigned?: "true" | "false" | undefined;
|
|
126
|
-
}, {
|
|
127
111
|
search?: string | undefined;
|
|
128
|
-
|
|
112
|
+
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
113
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
114
|
+
}, {
|
|
129
115
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
130
|
-
page?: string | undefined;
|
|
131
|
-
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
132
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
133
116
|
productId?: string | undefined;
|
|
134
117
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
118
|
+
page?: string | undefined;
|
|
119
|
+
limit?: string | undefined;
|
|
135
120
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
136
121
|
isAssigned?: "true" | "false" | undefined;
|
|
122
|
+
search?: string | undefined;
|
|
123
|
+
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
124
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
137
125
|
}>;
|
|
138
126
|
}, "strip", z.ZodTypeAny, {
|
|
139
127
|
query: {
|
|
140
|
-
search?: string | undefined;
|
|
141
|
-
limit?: number | undefined;
|
|
142
128
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
143
|
-
page?: number | undefined;
|
|
144
|
-
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
145
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
146
129
|
productId?: string | undefined;
|
|
147
130
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
131
|
+
page?: number | undefined;
|
|
132
|
+
limit?: number | undefined;
|
|
148
133
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
149
134
|
isAssigned?: "true" | "false" | undefined;
|
|
135
|
+
search?: string | undefined;
|
|
136
|
+
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
137
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
150
138
|
};
|
|
151
139
|
}, {
|
|
152
140
|
query: {
|
|
153
|
-
search?: string | undefined;
|
|
154
|
-
limit?: string | undefined;
|
|
155
141
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
156
|
-
page?: string | undefined;
|
|
157
|
-
sortBy?: "createdAt" | "updatedAt" | "status" | "serialNumber" | undefined;
|
|
158
|
-
sortOrder?: "DESC" | "ASC" | undefined;
|
|
159
142
|
productId?: string | undefined;
|
|
160
143
|
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
144
|
+
page?: string | undefined;
|
|
145
|
+
limit?: string | undefined;
|
|
161
146
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
162
147
|
isAssigned?: "true" | "false" | undefined;
|
|
148
|
+
search?: string | undefined;
|
|
149
|
+
sortBy?: "status" | "serialNumber" | "createdAt" | "updatedAt" | undefined;
|
|
150
|
+
sortOrder?: "ASC" | "DESC" | undefined;
|
|
163
151
|
};
|
|
164
152
|
}>;
|
|
165
153
|
export declare const deleteDeviceSchema: z.ZodObject<{
|
|
@@ -242,19 +230,19 @@ export declare const disableDeviceSchema: z.ZodObject<{
|
|
|
242
230
|
reason: string;
|
|
243
231
|
}>;
|
|
244
232
|
}, "strip", z.ZodTypeAny, {
|
|
245
|
-
body: {
|
|
246
|
-
reason: string;
|
|
247
|
-
};
|
|
248
233
|
params: {
|
|
249
234
|
id: string;
|
|
250
235
|
};
|
|
251
|
-
}, {
|
|
252
236
|
body: {
|
|
253
237
|
reason: string;
|
|
254
238
|
};
|
|
239
|
+
}, {
|
|
255
240
|
params: {
|
|
256
241
|
id: string;
|
|
257
242
|
};
|
|
243
|
+
body: {
|
|
244
|
+
reason: string;
|
|
245
|
+
};
|
|
258
246
|
}>;
|
|
259
247
|
export declare const makePermanentSchema: z.ZodObject<{
|
|
260
248
|
params: z.ZodObject<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkAvailabilitySchema = exports.makePermanentSchema = exports.disableDeviceSchema = exports.adminUnlockDeviceSchema = exports.adminLockDeviceSchema = exports.deleteDeviceSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.updateDeviceSchema = exports.
|
|
3
|
+
exports.checkAvailabilitySchema = exports.makePermanentSchema = exports.disableDeviceSchema = exports.adminUnlockDeviceSchema = exports.adminLockDeviceSchema = exports.deleteDeviceSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.updateDeviceSchema = exports.createDevicePairsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const vr_models_1 = require("vr-models");
|
|
6
6
|
// Constants
|
|
@@ -16,28 +16,37 @@ const deviceBaseSchema = {
|
|
|
16
16
|
isPermanentlyUnlocked: zod_1.z.boolean().optional(),
|
|
17
17
|
dedicatedUser: zod_1.z.enum(vr_models_1.DEVICE_DEDICATION).nullable().optional(),
|
|
18
18
|
};
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
// ✅ Pair ID format: 2 letters + 3 numbers + 1 letter
|
|
20
|
+
// Example: AA001A, AB123B, XZ999Z
|
|
21
|
+
// No letter 'O' to avoid confusion with 0
|
|
22
|
+
const PAIR_ID_REGEX = /^[A-NP-Z]{2}[0-9]{3}[A-NP-Z]{1}$/;
|
|
23
|
+
const PAIR_ID_ERROR = "Pair ID must be 6 characters: 2 letters (A-Z, excluding O) + 3 digits + 1 letter (A-Z, excluding O). Example: AA001A";
|
|
24
|
+
// ✅ Helper to validate pair IDs are unique in body
|
|
25
|
+
const validateUniquePairIds = (pairIds) => {
|
|
26
|
+
const unique = new Set(pairIds);
|
|
27
|
+
return unique.size === pairIds.length;
|
|
28
|
+
};
|
|
29
|
+
// ✅ ONLY bulk create - no single device creation
|
|
30
|
+
exports.createDevicePairsSchema = zod_1.z
|
|
31
|
+
.object({
|
|
30
32
|
body: zod_1.z.object({
|
|
31
|
-
productId:
|
|
32
|
-
|
|
33
|
-
.array(zod_1.z
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
.max(64, "Serial number too long")
|
|
37
|
-
.regex(/^[A-Z0-9-]+$/, "Serial number must contain only uppercase letters, numbers, and hyphens"))
|
|
38
|
-
.min(1, "At least one serial number required")
|
|
39
|
-
.max(100, "Cannot create more than 100 devices at once"),
|
|
33
|
+
productId: zod_1.z.string().uuid("Invalid product ID"),
|
|
34
|
+
pairIds: zod_1.z
|
|
35
|
+
.array(zod_1.z.string().regex(PAIR_ID_REGEX, PAIR_ID_ERROR))
|
|
36
|
+
.min(1, "At least one pair ID required")
|
|
37
|
+
.max(50, "Cannot create more than 50 pairs at once"),
|
|
40
38
|
}),
|
|
39
|
+
})
|
|
40
|
+
.superRefine((data, ctx) => {
|
|
41
|
+
const { pairIds } = data.body;
|
|
42
|
+
// ✅ Ensure no duplicate pair IDs in the request body
|
|
43
|
+
if (!validateUniquePairIds(pairIds)) {
|
|
44
|
+
ctx.addIssue({
|
|
45
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
46
|
+
message: `Duplicate pair IDs found. Please ensure all pair IDs are unique.`,
|
|
47
|
+
path: ["pairIds"],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
41
50
|
});
|
|
42
51
|
// Update device schema
|
|
43
52
|
exports.updateDeviceSchema = zod_1.z.object({
|
|
@@ -10,6 +10,6 @@ export { updateProfileSchema, requestPhoneChangeSchema, verifyPhoneChangeSchema,
|
|
|
10
10
|
export { updateAdminSchema, updateRiderSchema, deleteUserSchema, getUserSchema, getUsersSchema, hireAdminSchema, promoteAdminSchema, demoteAdminSchema, fireEmployeeSchema, upgradeToRiderSchema, resetPasswordSchema, } from "./users.admin.validations";
|
|
11
11
|
export { createProductSchema, updateProductSchema, getProductSchema, getProductsSchema, deactivateProductSchema, activateProductSchema, deleteProductSchema, updateStockSchema, } from "./product.validations";
|
|
12
12
|
export { createPricingSchema, updatePricingSchema, getPricingSchema, getPricingsSchema, deletePricingSchema, } from "./pricings.validations";
|
|
13
|
-
export { checkAvailabilitySchema,
|
|
13
|
+
export { checkAvailabilitySchema, createDevicePairsSchema, adminLockDeviceSchema, adminUnlockDeviceSchema, updateDeviceSchema, getDeviceSchema, getDevicesSchema, deleteDeviceSchema, disableDeviceSchema, makePermanentSchema, } from "./admin.devices.validations";
|
|
14
14
|
export { createPlanSchema, limitedUpdateSchema, getDevicePlanSchema, getPlanSchema, getUserPlansSchema, listPlansSchema, recordPaymentSchema, deletePlanSchema, } from "./admin.devicePayment.validations";
|
|
15
15
|
export { listEventLogsSchema, getEventLogSchema, } from "./eventlogs.admin.validations";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAppSpecsSchema = exports.activateAppSpecsSchema = exports.getActiveAppSpecsSchema = exports.listAppSpecsSchema = exports.updateAppSpecsSchema = exports.createAppSpecsSchema = exports.exportBansSchema = exports.createSuspensionSchema = exports.createBanSchema = exports.extendSuspensionSchema = exports.revokeSuspensionSchema = exports.revokeBanSchema = exports.reviewAppealSchema = exports.listSuspensionsSchema = exports.listPendingAppealsSchema = exports.listBansSchema = exports.getUserBansSchema = exports.getUserSuspensionsSchema = exports.getSuspensionSchema = exports.getUserRestrictionsSchema = exports.getBanSchema = exports.submitSuspensionAppealSchema = exports.submitBanAppealSchema = exports.deactivateAccountSchema = exports.createRiderSchema = exports.updateRiderProfileSchema = exports.updatePassengerProfileSchema = exports.passengerSignupSchema = exports.viewProfileSchema = exports.getAllUsersSchema = exports.updateUserProfileSchema = exports.getUserByIdSchema = exports.createUserSchema = exports.googleLoginSchema = exports.completePassengerProfileSchema = exports.checkRiderAccountSchema = exports.setRiderPasswordSchema = exports.riderPasswordRegex = exports.passwordRegex = exports.emailRegex = exports.phoneRegex = exports.requestOtpSchema = exports.resendOtpSchema = exports.verifyOtpSchema = exports.registerSchema = exports.refreshTokenSchema = exports.userLoginSchema = exports.forgotPasswordSchema = exports.riderLoginSchema = exports.validate = void 0;
|
|
4
|
-
exports.makePermanentSchema = exports.disableDeviceSchema = exports.deleteDeviceSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.updateDeviceSchema = exports.adminUnlockDeviceSchema = exports.adminLockDeviceSchema = exports.
|
|
5
|
-
exports.getEventLogSchema = exports.listEventLogsSchema = exports.deletePlanSchema = exports.recordPaymentSchema = exports.listPlansSchema = exports.getUserPlansSchema = exports.getPlanSchema = exports.getDevicePlanSchema = exports.limitedUpdateSchema = exports.createPlanSchema =
|
|
4
|
+
exports.makePermanentSchema = exports.disableDeviceSchema = exports.deleteDeviceSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.updateDeviceSchema = exports.adminUnlockDeviceSchema = exports.adminLockDeviceSchema = exports.createDevicePairsSchema = exports.checkAvailabilitySchema = exports.deletePricingSchema = exports.getPricingsSchema = exports.getPricingSchema = exports.updatePricingSchema = exports.createPricingSchema = exports.updateStockSchema = exports.deleteProductSchema = exports.activateProductSchema = exports.deactivateProductSchema = exports.getProductsSchema = exports.getProductSchema = exports.updateProductSchema = exports.createProductSchema = exports.resetPasswordSchema = exports.upgradeToRiderSchema = exports.fireEmployeeSchema = exports.demoteAdminSchema = exports.promoteAdminSchema = exports.hireAdminSchema = exports.getUsersSchema = exports.getUserSchema = exports.deleteUserSchema = exports.updateRiderSchema = exports.updateAdminSchema = exports.registerRiderSchema = exports.riderPasswordSchema = exports.changePasswordSchema = exports.strongPasswordRegex = exports.deleteAccountSchema = exports.verifyPhoneChangeSchema = exports.requestPhoneChangeSchema = exports.updateProfileSchema = exports.getInstallmentsSchema = exports.getInstallmentByIdSchema = exports.payInstallmentSchema = exports.serialRegex = exports.extendSessionSchema = exports.unlockDeviceSchema = exports.getUserPaymentPlanSchema = exports.listUserPaymentPlansSchema = void 0;
|
|
5
|
+
exports.getEventLogSchema = exports.listEventLogsSchema = exports.deletePlanSchema = exports.recordPaymentSchema = exports.listPlansSchema = exports.getUserPlansSchema = exports.getPlanSchema = exports.getDevicePlanSchema = exports.limitedUpdateSchema = exports.createPlanSchema = void 0;
|
|
6
6
|
var validate_validations_1 = require("./validate.validations");
|
|
7
7
|
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_validations_1.validate; } });
|
|
8
8
|
var auth_validations_1 = require("./auth.validations");
|
|
@@ -115,7 +115,7 @@ Object.defineProperty(exports, "getPricingsSchema", { enumerable: true, get: fun
|
|
|
115
115
|
Object.defineProperty(exports, "deletePricingSchema", { enumerable: true, get: function () { return pricings_validations_1.deletePricingSchema; } });
|
|
116
116
|
var admin_devices_validations_1 = require("./admin.devices.validations");
|
|
117
117
|
Object.defineProperty(exports, "checkAvailabilitySchema", { enumerable: true, get: function () { return admin_devices_validations_1.checkAvailabilitySchema; } });
|
|
118
|
-
Object.defineProperty(exports, "
|
|
118
|
+
Object.defineProperty(exports, "createDevicePairsSchema", { enumerable: true, get: function () { return admin_devices_validations_1.createDevicePairsSchema; } });
|
|
119
119
|
Object.defineProperty(exports, "adminLockDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.adminLockDeviceSchema; } });
|
|
120
120
|
Object.defineProperty(exports, "adminUnlockDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.adminUnlockDeviceSchema; } });
|
|
121
121
|
Object.defineProperty(exports, "updateDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.updateDeviceSchema; } });
|
|
@@ -124,7 +124,6 @@ Object.defineProperty(exports, "getDevicesSchema", { enumerable: true, get: func
|
|
|
124
124
|
Object.defineProperty(exports, "deleteDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.deleteDeviceSchema; } });
|
|
125
125
|
Object.defineProperty(exports, "disableDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.disableDeviceSchema; } });
|
|
126
126
|
Object.defineProperty(exports, "makePermanentSchema", { enumerable: true, get: function () { return admin_devices_validations_1.makePermanentSchema; } });
|
|
127
|
-
Object.defineProperty(exports, "createDeviceSchema", { enumerable: true, get: function () { return admin_devices_validations_1.createDeviceSchema; } });
|
|
128
127
|
var admin_devicePayment_validations_1 = require("./admin.devicePayment.validations");
|
|
129
128
|
Object.defineProperty(exports, "createPlanSchema", { enumerable: true, get: function () { return admin_devicePayment_validations_1.createPlanSchema; } });
|
|
130
129
|
Object.defineProperty(exports, "limitedUpdateSchema", { enumerable: true, get: function () { return admin_devicePayment_validations_1.limitedUpdateSchema; } });
|