vr-commons 1.0.146 → 1.0.148
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.device.utils.d.ts +17 -1
- package/dist/utils/admin.device.utils.js +45 -0
- package/dist/validations/admin.devicePayment.validations.d.ts +20 -20
- package/dist/validations/admin.devices.validations.d.ts +28 -95
- package/dist/validations/admin.devices.validations.js +2 -23
- package/dist/validations/appSpecs.validations.d.ts +2 -2
- package/dist/validations/auth.validations.d.ts +8 -8
- package/dist/validations/devicePaymentPlan.validations.d.ts +4 -4
- package/dist/validations/eventlogs.admin.validations.d.ts +22 -22
- package/dist/validations/index.d.ts +1 -1
- package/dist/validations/index.js +2 -3
- package/dist/validations/moderation.validations.d.ts +21 -21
- package/dist/validations/pricings.validations.d.ts +22 -22
- package/dist/validations/product.validations.d.ts +16 -16
- package/dist/validations/profiles.validations.d.ts +30 -30
- package/dist/validations/users.admin.validations.d.ts +12 -12
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserRole } from "vr-models";
|
|
1
|
+
import { Device, UserRole } from "vr-models";
|
|
2
2
|
import { Transaction } from "sequelize";
|
|
3
3
|
import { StockChangeResult } from "./types";
|
|
4
4
|
export declare const stockUtil: {
|
|
@@ -66,4 +66,20 @@ export declare const stockUtil: {
|
|
|
66
66
|
* No letter 'O' to avoid confusion with 0
|
|
67
67
|
*/
|
|
68
68
|
validatePairIdFormat(pairId: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Get devices by pair IDs (returns both RIDER and PASSENGER)
|
|
71
|
+
*/
|
|
72
|
+
getDevicesByPairIds(pairIds: string[], transaction?: any): Promise<Device[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Get devices by serial numbers
|
|
75
|
+
*/
|
|
76
|
+
getDevicesBySerialNumbers(serialNumbers: string[], transaction?: any): Promise<Device[]>;
|
|
77
|
+
/**
|
|
78
|
+
* Validate that exactly one identifier type is provided
|
|
79
|
+
*/
|
|
80
|
+
validateIdentifiers(pairIds?: string[], serialNumbers?: string[]): {
|
|
81
|
+
valid: boolean;
|
|
82
|
+
error?: string | undefined;
|
|
83
|
+
devices?: Device[] | undefined;
|
|
84
|
+
};
|
|
69
85
|
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.stockUtil = void 0;
|
|
4
4
|
// src/utils/stock.util.ts
|
|
5
5
|
const vr_models_1 = require("vr-models");
|
|
6
|
+
const sequelize_1 = require("sequelize");
|
|
6
7
|
const eventLog_utils_1 = require("./eventLog.utils");
|
|
7
8
|
const admin_devices_validations_1 = require("../validations/admin.devices.validations");
|
|
8
9
|
exports.stockUtil = {
|
|
@@ -243,4 +244,48 @@ exports.stockUtil = {
|
|
|
243
244
|
validatePairIdFormat(pairId) {
|
|
244
245
|
return admin_devices_validations_1.PAIR_ID_REGEX.test(pairId);
|
|
245
246
|
},
|
|
247
|
+
/**
|
|
248
|
+
* Get devices by pair IDs (returns both RIDER and PASSENGER)
|
|
249
|
+
*/
|
|
250
|
+
async getDevicesByPairIds(pairIds, transaction) {
|
|
251
|
+
return await vr_models_1.Device.findAll({
|
|
252
|
+
where: {
|
|
253
|
+
pairId: { [sequelize_1.Op.in]: pairIds },
|
|
254
|
+
},
|
|
255
|
+
include: [{ model: vr_models_1.DevicePaymentPlan, as: "paymentPlan" }],
|
|
256
|
+
transaction,
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* Get devices by serial numbers
|
|
261
|
+
*/
|
|
262
|
+
async getDevicesBySerialNumbers(serialNumbers, transaction) {
|
|
263
|
+
return await vr_models_1.Device.findAll({
|
|
264
|
+
where: {
|
|
265
|
+
serialNumber: { [sequelize_1.Op.in]: serialNumbers },
|
|
266
|
+
},
|
|
267
|
+
include: [{ model: vr_models_1.DevicePaymentPlan, as: "paymentPlan" }],
|
|
268
|
+
transaction,
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
/**
|
|
272
|
+
* Validate that exactly one identifier type is provided
|
|
273
|
+
*/
|
|
274
|
+
validateIdentifiers(pairIds, serialNumbers) {
|
|
275
|
+
const hasPairIds = pairIds && pairIds.length > 0;
|
|
276
|
+
const hasSerialNumbers = serialNumbers && serialNumbers.length > 0;
|
|
277
|
+
if (!hasPairIds && !hasSerialNumbers) {
|
|
278
|
+
return {
|
|
279
|
+
valid: false,
|
|
280
|
+
error: "Either pairIds or serialNumbers must be provided",
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
if (hasPairIds && hasSerialNumbers) {
|
|
284
|
+
return {
|
|
285
|
+
valid: false,
|
|
286
|
+
error: "Cannot provide both pairIds and serialNumbers. Choose one.",
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return { valid: true };
|
|
290
|
+
},
|
|
246
291
|
};
|
|
@@ -6,27 +6,27 @@ export declare const createPlanSchema: z.ZodObject<{
|
|
|
6
6
|
pricingId: z.ZodString;
|
|
7
7
|
productId: z.ZodString;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
userId: string;
|
|
10
9
|
productId: string;
|
|
10
|
+
userId: string;
|
|
11
11
|
deviceIds: string[];
|
|
12
12
|
pricingId: string;
|
|
13
13
|
}, {
|
|
14
|
-
userId: string;
|
|
15
14
|
productId: string;
|
|
15
|
+
userId: string;
|
|
16
16
|
deviceIds: string[];
|
|
17
17
|
pricingId: string;
|
|
18
18
|
}>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
body: {
|
|
21
|
-
userId: string;
|
|
22
21
|
productId: string;
|
|
22
|
+
userId: string;
|
|
23
23
|
deviceIds: string[];
|
|
24
24
|
pricingId: string;
|
|
25
25
|
};
|
|
26
26
|
}, {
|
|
27
27
|
body: {
|
|
28
|
-
userId: string;
|
|
29
28
|
productId: string;
|
|
29
|
+
userId: string;
|
|
30
30
|
deviceIds: string[];
|
|
31
31
|
pricingId: string;
|
|
32
32
|
};
|
|
@@ -46,17 +46,17 @@ export declare const listPlansSchema: z.ZodObject<{
|
|
|
46
46
|
limit: number;
|
|
47
47
|
page: number;
|
|
48
48
|
search?: string | undefined;
|
|
49
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
49
50
|
userId?: string | undefined;
|
|
50
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
51
51
|
isOverdue?: "true" | "false" | undefined;
|
|
52
52
|
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
53
53
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
54
54
|
deviceId?: string | undefined;
|
|
55
55
|
}, {
|
|
56
|
-
search?: string | undefined;
|
|
57
56
|
limit?: string | undefined;
|
|
57
|
+
search?: string | undefined;
|
|
58
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
58
59
|
userId?: string | undefined;
|
|
59
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
60
60
|
isOverdue?: "true" | "false" | undefined;
|
|
61
61
|
page?: string | undefined;
|
|
62
62
|
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
@@ -68,8 +68,8 @@ export declare const listPlansSchema: z.ZodObject<{
|
|
|
68
68
|
limit: number;
|
|
69
69
|
page: number;
|
|
70
70
|
search?: string | undefined;
|
|
71
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
71
72
|
userId?: string | undefined;
|
|
72
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
73
73
|
isOverdue?: "true" | "false" | undefined;
|
|
74
74
|
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
75
75
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
@@ -77,10 +77,10 @@ export declare const listPlansSchema: z.ZodObject<{
|
|
|
77
77
|
};
|
|
78
78
|
}, {
|
|
79
79
|
query: {
|
|
80
|
-
search?: string | undefined;
|
|
81
80
|
limit?: string | undefined;
|
|
81
|
+
search?: string | undefined;
|
|
82
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
82
83
|
userId?: string | undefined;
|
|
83
|
-
status?: "ACTIVE" | "DEFAULTED" | "PENDING" | "COMPLETED" | "CANCELLED" | undefined;
|
|
84
84
|
isOverdue?: "true" | "false" | undefined;
|
|
85
85
|
page?: string | undefined;
|
|
86
86
|
sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
|
|
@@ -117,10 +117,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
117
117
|
status: z.ZodOptional<z.ZodEnum<["PENDING", "ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
|
|
118
118
|
includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
|
|
119
119
|
}, "strip", z.ZodTypeAny, {
|
|
120
|
-
status?: "ACTIVE" | "
|
|
120
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
121
121
|
includeCompleted?: "true" | "false" | undefined;
|
|
122
122
|
}, {
|
|
123
|
-
status?: "ACTIVE" | "
|
|
123
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
124
124
|
includeCompleted?: "true" | "false" | undefined;
|
|
125
125
|
}>>;
|
|
126
126
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -128,7 +128,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
128
128
|
userId: string;
|
|
129
129
|
};
|
|
130
130
|
query?: {
|
|
131
|
-
status?: "ACTIVE" | "
|
|
131
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
132
132
|
includeCompleted?: "true" | "false" | undefined;
|
|
133
133
|
} | undefined;
|
|
134
134
|
}, {
|
|
@@ -136,7 +136,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
|
|
|
136
136
|
userId: string;
|
|
137
137
|
};
|
|
138
138
|
query?: {
|
|
139
|
-
status?: "ACTIVE" | "
|
|
139
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
140
140
|
includeCompleted?: "true" | "false" | undefined;
|
|
141
141
|
} | undefined;
|
|
142
142
|
}>;
|
|
@@ -171,30 +171,30 @@ export declare const limitedUpdateSchema: z.ZodObject<{
|
|
|
171
171
|
deviceIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
172
172
|
userId: z.ZodOptional<z.ZodString>;
|
|
173
173
|
}, "strip", z.ZodTypeAny, {
|
|
174
|
-
userId?: string | undefined;
|
|
175
174
|
productId?: string | undefined;
|
|
175
|
+
userId?: string | undefined;
|
|
176
176
|
deviceIds?: string[] | undefined;
|
|
177
177
|
pricingId?: string | undefined;
|
|
178
178
|
}, {
|
|
179
|
-
userId?: string | undefined;
|
|
180
179
|
productId?: string | undefined;
|
|
180
|
+
userId?: string | undefined;
|
|
181
181
|
deviceIds?: string[] | undefined;
|
|
182
182
|
pricingId?: string | undefined;
|
|
183
183
|
}>, {
|
|
184
|
-
userId?: string | undefined;
|
|
185
184
|
productId?: string | undefined;
|
|
185
|
+
userId?: string | undefined;
|
|
186
186
|
deviceIds?: string[] | undefined;
|
|
187
187
|
pricingId?: string | undefined;
|
|
188
188
|
}, {
|
|
189
|
-
userId?: string | undefined;
|
|
190
189
|
productId?: string | undefined;
|
|
190
|
+
userId?: string | undefined;
|
|
191
191
|
deviceIds?: string[] | undefined;
|
|
192
192
|
pricingId?: string | undefined;
|
|
193
193
|
}>;
|
|
194
194
|
}, "strip", z.ZodTypeAny, {
|
|
195
195
|
body: {
|
|
196
|
-
userId?: string | undefined;
|
|
197
196
|
productId?: string | undefined;
|
|
197
|
+
userId?: string | undefined;
|
|
198
198
|
deviceIds?: string[] | undefined;
|
|
199
199
|
pricingId?: string | undefined;
|
|
200
200
|
};
|
|
@@ -203,8 +203,8 @@ export declare const limitedUpdateSchema: z.ZodObject<{
|
|
|
203
203
|
};
|
|
204
204
|
}, {
|
|
205
205
|
body: {
|
|
206
|
-
userId?: string | undefined;
|
|
207
206
|
productId?: string | undefined;
|
|
207
|
+
userId?: string | undefined;
|
|
208
208
|
deviceIds?: string[] | undefined;
|
|
209
209
|
pricingId?: string | undefined;
|
|
210
210
|
};
|
|
@@ -29,68 +29,6 @@ export declare const createDevicePairsSchema: z.ZodObject<{
|
|
|
29
29
|
pairIds: string[];
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
|
-
export declare const createDeviceSchema: z.ZodObject<{
|
|
33
|
-
body: z.ZodObject<{
|
|
34
|
-
serialNumber: z.ZodString;
|
|
35
|
-
productId: z.ZodString;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
productId: string;
|
|
38
|
-
serialNumber: string;
|
|
39
|
-
}, {
|
|
40
|
-
productId: string;
|
|
41
|
-
serialNumber: string;
|
|
42
|
-
}>;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
body: {
|
|
45
|
-
productId: string;
|
|
46
|
-
serialNumber: string;
|
|
47
|
-
};
|
|
48
|
-
}, {
|
|
49
|
-
body: {
|
|
50
|
-
productId: string;
|
|
51
|
-
serialNumber: string;
|
|
52
|
-
};
|
|
53
|
-
}>;
|
|
54
|
-
export declare const updateDeviceSchema: z.ZodObject<{
|
|
55
|
-
params: z.ZodObject<{
|
|
56
|
-
id: z.ZodString;
|
|
57
|
-
}, "strip", z.ZodTypeAny, {
|
|
58
|
-
id: string;
|
|
59
|
-
}, {
|
|
60
|
-
id: string;
|
|
61
|
-
}>;
|
|
62
|
-
body: z.ZodObject<{
|
|
63
|
-
serialNumber: z.ZodOptional<z.ZodString>;
|
|
64
|
-
status: z.ZodOptional<z.ZodEnum<["locked", "unlocked", "disabled"]>>;
|
|
65
|
-
dedicatedUser: z.ZodOptional<z.ZodNullable<z.ZodEnum<["PASSENGER", "RIDER", "N/A"]>>>;
|
|
66
|
-
}, "strip", z.ZodTypeAny, {
|
|
67
|
-
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
68
|
-
serialNumber?: string | undefined;
|
|
69
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
70
|
-
}, {
|
|
71
|
-
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
72
|
-
serialNumber?: string | undefined;
|
|
73
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
74
|
-
}>;
|
|
75
|
-
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
params: {
|
|
77
|
-
id: string;
|
|
78
|
-
};
|
|
79
|
-
body: {
|
|
80
|
-
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
81
|
-
serialNumber?: string | undefined;
|
|
82
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
83
|
-
};
|
|
84
|
-
}, {
|
|
85
|
-
params: {
|
|
86
|
-
id: string;
|
|
87
|
-
};
|
|
88
|
-
body: {
|
|
89
|
-
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
90
|
-
serialNumber?: string | undefined;
|
|
91
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | null | undefined;
|
|
92
|
-
};
|
|
93
|
-
}>;
|
|
94
32
|
export declare const getDeviceSchema: z.ZodObject<{
|
|
95
33
|
params: z.ZodObject<{
|
|
96
34
|
id: z.ZodString;
|
|
@@ -121,53 +59,53 @@ export declare const getDevicesSchema: z.ZodObject<{
|
|
|
121
59
|
sortBy: z.ZodOptional<z.ZodEnum<["serialNumber", "status", "createdAt", "updatedAt"]>>;
|
|
122
60
|
sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
|
|
123
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
limit?: number | undefined;
|
|
63
|
+
search?: string | undefined;
|
|
124
64
|
productId?: string | undefined;
|
|
125
65
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
126
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
127
|
-
page?: number | undefined;
|
|
128
|
-
limit?: number | undefined;
|
|
129
66
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
67
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
130
68
|
isAssigned?: "true" | "false" | undefined;
|
|
131
|
-
|
|
132
|
-
sortBy?: "
|
|
133
|
-
sortOrder?: "
|
|
69
|
+
page?: number | undefined;
|
|
70
|
+
sortBy?: "createdAt" | "updatedAt" | "serialNumber" | "status" | undefined;
|
|
71
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
134
72
|
}, {
|
|
73
|
+
limit?: string | undefined;
|
|
74
|
+
search?: string | undefined;
|
|
135
75
|
productId?: string | undefined;
|
|
136
76
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
137
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
138
|
-
page?: string | undefined;
|
|
139
|
-
limit?: string | undefined;
|
|
140
77
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
78
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
141
79
|
isAssigned?: "true" | "false" | undefined;
|
|
142
|
-
|
|
143
|
-
sortBy?: "
|
|
144
|
-
sortOrder?: "
|
|
80
|
+
page?: string | undefined;
|
|
81
|
+
sortBy?: "createdAt" | "updatedAt" | "serialNumber" | "status" | undefined;
|
|
82
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
145
83
|
}>;
|
|
146
84
|
}, "strip", z.ZodTypeAny, {
|
|
147
85
|
query: {
|
|
86
|
+
limit?: number | undefined;
|
|
87
|
+
search?: string | undefined;
|
|
148
88
|
productId?: string | undefined;
|
|
149
89
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
150
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
151
|
-
page?: number | undefined;
|
|
152
|
-
limit?: number | undefined;
|
|
153
90
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
91
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
154
92
|
isAssigned?: "true" | "false" | undefined;
|
|
155
|
-
|
|
156
|
-
sortBy?: "
|
|
157
|
-
sortOrder?: "
|
|
93
|
+
page?: number | undefined;
|
|
94
|
+
sortBy?: "createdAt" | "updatedAt" | "serialNumber" | "status" | undefined;
|
|
95
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
158
96
|
};
|
|
159
97
|
}, {
|
|
160
98
|
query: {
|
|
99
|
+
limit?: string | undefined;
|
|
100
|
+
search?: string | undefined;
|
|
161
101
|
productId?: string | undefined;
|
|
162
102
|
status?: "locked" | "unlocked" | "disabled" | undefined;
|
|
163
|
-
dedicatedUser?: "PASSENGER" | "RIDER" | "N/A" | undefined;
|
|
164
|
-
page?: string | undefined;
|
|
165
|
-
limit?: string | undefined;
|
|
166
103
|
isPermanentlyUnlocked?: "true" | "false" | undefined;
|
|
104
|
+
dedicatedUser?: "RIDER" | "PASSENGER" | "N/A" | undefined;
|
|
167
105
|
isAssigned?: "true" | "false" | undefined;
|
|
168
|
-
|
|
169
|
-
sortBy?: "
|
|
170
|
-
sortOrder?: "
|
|
106
|
+
page?: string | undefined;
|
|
107
|
+
sortBy?: "createdAt" | "updatedAt" | "serialNumber" | "status" | undefined;
|
|
108
|
+
sortOrder?: "DESC" | "ASC" | undefined;
|
|
171
109
|
};
|
|
172
110
|
}>;
|
|
173
111
|
export declare const deleteDeviceSchema: z.ZodObject<{
|
|
@@ -250,19 +188,19 @@ export declare const disableDeviceSchema: z.ZodObject<{
|
|
|
250
188
|
reason: string;
|
|
251
189
|
}>;
|
|
252
190
|
}, "strip", z.ZodTypeAny, {
|
|
253
|
-
params: {
|
|
254
|
-
id: string;
|
|
255
|
-
};
|
|
256
191
|
body: {
|
|
257
192
|
reason: string;
|
|
258
193
|
};
|
|
259
|
-
}, {
|
|
260
194
|
params: {
|
|
261
195
|
id: string;
|
|
262
196
|
};
|
|
197
|
+
}, {
|
|
263
198
|
body: {
|
|
264
199
|
reason: string;
|
|
265
200
|
};
|
|
201
|
+
params: {
|
|
202
|
+
id: string;
|
|
203
|
+
};
|
|
266
204
|
}>;
|
|
267
205
|
export declare const makePermanentSchema: z.ZodObject<{
|
|
268
206
|
params: z.ZodObject<{
|
|
@@ -284,22 +222,17 @@ export declare const makePermanentSchema: z.ZodObject<{
|
|
|
284
222
|
export declare const checkAvailabilitySchema: z.ZodObject<{
|
|
285
223
|
query: z.ZodObject<{
|
|
286
224
|
productId: z.ZodString;
|
|
287
|
-
quantity: z.ZodEffects<z.ZodEnum<["1", "2"]>, number, "1" | "2">;
|
|
288
225
|
}, "strip", z.ZodTypeAny, {
|
|
289
226
|
productId: string;
|
|
290
|
-
quantity: number;
|
|
291
227
|
}, {
|
|
292
228
|
productId: string;
|
|
293
|
-
quantity: "1" | "2";
|
|
294
229
|
}>;
|
|
295
230
|
}, "strip", z.ZodTypeAny, {
|
|
296
231
|
query: {
|
|
297
232
|
productId: string;
|
|
298
|
-
quantity: number;
|
|
299
233
|
};
|
|
300
234
|
}, {
|
|
301
235
|
query: {
|
|
302
236
|
productId: string;
|
|
303
|
-
quantity: "1" | "2";
|
|
304
237
|
};
|
|
305
238
|
}>;
|
|
@@ -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.
|
|
3
|
+
exports.checkAvailabilitySchema = exports.makePermanentSchema = exports.disableDeviceSchema = exports.adminUnlockDeviceSchema = exports.adminLockDeviceSchema = exports.deleteDeviceSchema = exports.getDevicesSchema = exports.getDeviceSchema = exports.createDevicePairsSchema = exports.deduplicatePairIds = exports.PAIR_ID_REGEX = void 0;
|
|
4
4
|
// src/validations/device.validations.ts
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const vr_models_1 = require("vr-models");
|
|
@@ -36,7 +36,7 @@ exports.createDevicePairsSchema = zod_1.z.object({
|
|
|
36
36
|
pairIds: zod_1.z
|
|
37
37
|
.array(zod_1.z.string().regex(exports.PAIR_ID_REGEX, PAIR_ID_ERROR))
|
|
38
38
|
.min(1, "At least one pair ID required")
|
|
39
|
-
.max(
|
|
39
|
+
.max(100, "Cannot create more than 100 pairs at once"),
|
|
40
40
|
})
|
|
41
41
|
.transform((data) => {
|
|
42
42
|
// ✅ Remove duplicates and keep unique pair IDs
|
|
@@ -47,26 +47,6 @@ exports.createDevicePairsSchema = zod_1.z.object({
|
|
|
47
47
|
};
|
|
48
48
|
}),
|
|
49
49
|
});
|
|
50
|
-
// Create device schema (admin adds new stock)
|
|
51
|
-
exports.createDeviceSchema = zod_1.z.object({
|
|
52
|
-
body: zod_1.z.object({
|
|
53
|
-
serialNumber: deviceBaseSchema.serialNumber,
|
|
54
|
-
productId: deviceBaseSchema.productId,
|
|
55
|
-
// Status defaults to "locked" in model
|
|
56
|
-
// dedicatedUser starts as null
|
|
57
|
-
}),
|
|
58
|
-
});
|
|
59
|
-
// Update device schema
|
|
60
|
-
exports.updateDeviceSchema = zod_1.z.object({
|
|
61
|
-
params: zod_1.z.object({
|
|
62
|
-
id: zod_1.z.string().uuid("Invalid device ID"),
|
|
63
|
-
}),
|
|
64
|
-
body: zod_1.z.object({
|
|
65
|
-
serialNumber: deviceBaseSchema.serialNumber.optional(),
|
|
66
|
-
status: deviceBaseSchema.status,
|
|
67
|
-
dedicatedUser: deviceBaseSchema.dedicatedUser,
|
|
68
|
-
}),
|
|
69
|
-
});
|
|
70
50
|
// Get device by ID schema
|
|
71
51
|
exports.getDeviceSchema = zod_1.z.object({
|
|
72
52
|
params: zod_1.z.object({
|
|
@@ -130,6 +110,5 @@ exports.makePermanentSchema = zod_1.z.object({
|
|
|
130
110
|
exports.checkAvailabilitySchema = zod_1.z.object({
|
|
131
111
|
query: zod_1.z.object({
|
|
132
112
|
productId: zod_1.z.string().uuid("Invalid product ID"),
|
|
133
|
-
quantity: zod_1.z.enum(["1", "2"]).transform(Number), // 1 or 2 devices
|
|
134
113
|
}),
|
|
135
114
|
});
|
|
@@ -792,8 +792,8 @@ export declare const listAppSpecsSchema: z.ZodObject<{
|
|
|
792
792
|
sortBy?: "createdAt" | "updatedAt" | "version" | undefined;
|
|
793
793
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
794
794
|
}, {
|
|
795
|
-
search?: string | undefined;
|
|
796
795
|
limit?: string | undefined;
|
|
796
|
+
search?: string | undefined;
|
|
797
797
|
isActive?: "true" | "false" | undefined;
|
|
798
798
|
page?: string | undefined;
|
|
799
799
|
sortBy?: "createdAt" | "updatedAt" | "version" | undefined;
|
|
@@ -810,8 +810,8 @@ export declare const listAppSpecsSchema: z.ZodObject<{
|
|
|
810
810
|
};
|
|
811
811
|
}, {
|
|
812
812
|
query: {
|
|
813
|
-
search?: string | undefined;
|
|
814
813
|
limit?: string | undefined;
|
|
814
|
+
search?: string | undefined;
|
|
815
815
|
isActive?: "true" | "false" | undefined;
|
|
816
816
|
page?: string | undefined;
|
|
817
817
|
sortBy?: "createdAt" | "updatedAt" | "version" | undefined;
|
|
@@ -98,7 +98,7 @@ export declare const registerSchema: z.ZodObject<{
|
|
|
98
98
|
firstName: string;
|
|
99
99
|
lastName: string;
|
|
100
100
|
password: string;
|
|
101
|
-
role: "
|
|
101
|
+
role: "RIDER" | "PASSENGER";
|
|
102
102
|
contactValue: string;
|
|
103
103
|
gender?: "male" | "female" | undefined;
|
|
104
104
|
birthDate?: number | undefined;
|
|
@@ -113,14 +113,14 @@ export declare const registerSchema: z.ZodObject<{
|
|
|
113
113
|
birthDate?: number | undefined;
|
|
114
114
|
birthMonth?: number | undefined;
|
|
115
115
|
birthYear?: number | undefined;
|
|
116
|
-
role?: "
|
|
116
|
+
role?: "RIDER" | "PASSENGER" | undefined;
|
|
117
117
|
}>;
|
|
118
118
|
}, "strip", z.ZodTypeAny, {
|
|
119
119
|
body: {
|
|
120
120
|
firstName: string;
|
|
121
121
|
lastName: string;
|
|
122
122
|
password: string;
|
|
123
|
-
role: "
|
|
123
|
+
role: "RIDER" | "PASSENGER";
|
|
124
124
|
contactValue: string;
|
|
125
125
|
gender?: "male" | "female" | undefined;
|
|
126
126
|
birthDate?: number | undefined;
|
|
@@ -137,7 +137,7 @@ export declare const registerSchema: z.ZodObject<{
|
|
|
137
137
|
birthDate?: number | undefined;
|
|
138
138
|
birthMonth?: number | undefined;
|
|
139
139
|
birthYear?: number | undefined;
|
|
140
|
-
role?: "
|
|
140
|
+
role?: "RIDER" | "PASSENGER" | undefined;
|
|
141
141
|
};
|
|
142
142
|
}>;
|
|
143
143
|
export declare const riderPasswordRegex: RegExp;
|
|
@@ -362,7 +362,7 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
362
362
|
firstName: string;
|
|
363
363
|
lastName: string;
|
|
364
364
|
password: string;
|
|
365
|
-
role: "
|
|
365
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
366
366
|
contactValue: string;
|
|
367
367
|
jacketId?: string | undefined;
|
|
368
368
|
plateNumber?: string | undefined;
|
|
@@ -374,7 +374,7 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
374
374
|
firstName: string;
|
|
375
375
|
lastName: string;
|
|
376
376
|
password: string;
|
|
377
|
-
role: "
|
|
377
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
378
378
|
contactValue: string;
|
|
379
379
|
jacketId?: string | undefined;
|
|
380
380
|
plateNumber?: string | undefined;
|
|
@@ -388,7 +388,7 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
388
388
|
firstName: string;
|
|
389
389
|
lastName: string;
|
|
390
390
|
password: string;
|
|
391
|
-
role: "
|
|
391
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
392
392
|
contactValue: string;
|
|
393
393
|
jacketId?: string | undefined;
|
|
394
394
|
plateNumber?: string | undefined;
|
|
@@ -402,7 +402,7 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
402
402
|
firstName: string;
|
|
403
403
|
lastName: string;
|
|
404
404
|
password: string;
|
|
405
|
-
role: "
|
|
405
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
406
406
|
contactValue: string;
|
|
407
407
|
jacketId?: string | undefined;
|
|
408
408
|
plateNumber?: string | undefined;
|
|
@@ -9,12 +9,12 @@ export declare const listUserPaymentPlansSchema: z.ZodObject<{
|
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
limit: number;
|
|
11
11
|
page: number;
|
|
12
|
-
status?: "ACTIVE" | "
|
|
12
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
13
13
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
14
14
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
limit?: string | undefined;
|
|
17
|
-
status?: "ACTIVE" | "
|
|
17
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
18
18
|
page?: string | undefined;
|
|
19
19
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
20
20
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
@@ -23,14 +23,14 @@ export declare const listUserPaymentPlansSchema: z.ZodObject<{
|
|
|
23
23
|
query: {
|
|
24
24
|
limit: number;
|
|
25
25
|
page: number;
|
|
26
|
-
status?: "ACTIVE" | "
|
|
26
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
27
27
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
28
28
|
sortOrder?: "DESC" | "ASC" | undefined;
|
|
29
29
|
};
|
|
30
30
|
}, {
|
|
31
31
|
query: {
|
|
32
32
|
limit?: string | undefined;
|
|
33
|
-
status?: "ACTIVE" | "
|
|
33
|
+
status?: "ACTIVE" | "PENDING" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
|
|
34
34
|
page?: string | undefined;
|
|
35
35
|
sortBy?: "createdAt" | "updatedAt" | "status" | "nextInstallmentDueAt" | undefined;
|
|
36
36
|
sortOrder?: "DESC" | "ASC" | undefined;
|