vr-commons 1.0.40 → 1.0.41
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventAction, EventActorType } from "vr-models";
|
|
2
|
+
import { Transaction } from "sequelize";
|
|
2
3
|
interface LogEventInput {
|
|
3
4
|
actorId?: string | null;
|
|
4
5
|
actorType?: EventActorType;
|
|
@@ -8,6 +9,7 @@ interface LogEventInput {
|
|
|
8
9
|
metadata?: Record<string, any>;
|
|
9
10
|
ipAddress?: string | null;
|
|
10
11
|
userAgent?: string | null;
|
|
12
|
+
transaction?: Transaction;
|
|
11
13
|
}
|
|
12
|
-
export declare const logEvent: ({ actorId, actorType, action, entity, entityId, metadata, ipAddress, userAgent }: LogEventInput) => Promise<void>;
|
|
14
|
+
export declare const logEvent: ({ actorId, actorType, action, entity, entityId, metadata, ipAddress, userAgent, transaction, }: LogEventInput) => Promise<void>;
|
|
13
15
|
export {};
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logEvent = void 0;
|
|
4
4
|
const vr_models_1 = require("vr-models");
|
|
5
|
-
const logEvent = async ({ actorId = null, actorType = "SYSTEM", action, entity, entityId = null, metadata = {}, ipAddress = null, userAgent = null
|
|
5
|
+
const logEvent = async ({ actorId = null, actorType = "SYSTEM", action, entity, entityId = null, metadata = {}, ipAddress = null, userAgent = null, transaction, // Optional transaction parameter
|
|
6
|
+
}) => {
|
|
6
7
|
try {
|
|
8
|
+
// Create event log with optional transaction
|
|
7
9
|
await vr_models_1.EventLog.create({
|
|
8
10
|
actorId,
|
|
9
11
|
actorType,
|
|
@@ -12,11 +14,12 @@ const logEvent = async ({ actorId = null, actorType = "SYSTEM", action, entity,
|
|
|
12
14
|
entityId,
|
|
13
15
|
metadata,
|
|
14
16
|
ipAddress,
|
|
15
|
-
userAgent
|
|
16
|
-
});
|
|
17
|
+
userAgent,
|
|
18
|
+
}, { transaction }); // Pass transaction if provided
|
|
17
19
|
}
|
|
18
20
|
catch (err) {
|
|
19
21
|
console.log("Error Logging event ::::::", err);
|
|
22
|
+
// Don't throw - event logging should not break the main operation
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
25
|
exports.logEvent = logEvent;
|
|
@@ -14,22 +14,22 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
14
14
|
firstName: string;
|
|
15
15
|
lastName: string;
|
|
16
16
|
phoneNumber: string;
|
|
17
|
-
nationalId: string;
|
|
18
17
|
password: string;
|
|
19
|
-
|
|
18
|
+
nationalId: string;
|
|
19
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
20
|
+
jacketId?: string | null | undefined;
|
|
20
21
|
email?: string | null | undefined;
|
|
21
22
|
plateNumber?: string | null | undefined;
|
|
22
|
-
jacketId?: string | null | undefined;
|
|
23
23
|
}, {
|
|
24
24
|
firstName: string;
|
|
25
25
|
lastName: string;
|
|
26
26
|
phoneNumber: string;
|
|
27
|
-
nationalId: string;
|
|
28
27
|
password: string;
|
|
29
|
-
|
|
28
|
+
nationalId: string;
|
|
29
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
30
|
+
jacketId?: string | null | undefined;
|
|
30
31
|
email?: string | null | undefined;
|
|
31
32
|
plateNumber?: string | null | undefined;
|
|
32
|
-
jacketId?: string | null | undefined;
|
|
33
33
|
}>;
|
|
34
34
|
headers: z.ZodObject<{
|
|
35
35
|
authorization: z.ZodString;
|
|
@@ -43,12 +43,12 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
43
43
|
firstName: string;
|
|
44
44
|
lastName: string;
|
|
45
45
|
phoneNumber: string;
|
|
46
|
-
nationalId: string;
|
|
47
46
|
password: string;
|
|
48
|
-
|
|
47
|
+
nationalId: string;
|
|
48
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
49
|
+
jacketId?: string | null | undefined;
|
|
49
50
|
email?: string | null | undefined;
|
|
50
51
|
plateNumber?: string | null | undefined;
|
|
51
|
-
jacketId?: string | null | undefined;
|
|
52
52
|
};
|
|
53
53
|
headers: {
|
|
54
54
|
authorization: string;
|
|
@@ -58,12 +58,12 @@ export declare const createUserSchema: z.ZodObject<{
|
|
|
58
58
|
firstName: string;
|
|
59
59
|
lastName: string;
|
|
60
60
|
phoneNumber: string;
|
|
61
|
-
nationalId: string;
|
|
62
61
|
password: string;
|
|
63
|
-
|
|
62
|
+
nationalId: string;
|
|
63
|
+
role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
|
|
64
|
+
jacketId?: string | null | undefined;
|
|
64
65
|
email?: string | null | undefined;
|
|
65
66
|
plateNumber?: string | null | undefined;
|
|
66
|
-
jacketId?: string | null | undefined;
|
|
67
67
|
};
|
|
68
68
|
headers: {
|
|
69
69
|
authorization: string;
|
|
@@ -166,9 +166,6 @@ export declare const updateUserProfileSchema: z.ZodObject<{
|
|
|
166
166
|
authorization: string;
|
|
167
167
|
}>;
|
|
168
168
|
}, "strip", z.ZodTypeAny, {
|
|
169
|
-
params: {
|
|
170
|
-
userId: string;
|
|
171
|
-
};
|
|
172
169
|
body: {
|
|
173
170
|
firstName?: string | undefined;
|
|
174
171
|
lastName?: string | undefined;
|
|
@@ -180,13 +177,13 @@ export declare const updateUserProfileSchema: z.ZodObject<{
|
|
|
180
177
|
isSuspended?: boolean | undefined;
|
|
181
178
|
isDeactivated?: boolean | undefined;
|
|
182
179
|
};
|
|
180
|
+
params: {
|
|
181
|
+
userId: string;
|
|
182
|
+
};
|
|
183
183
|
headers: {
|
|
184
184
|
authorization: string;
|
|
185
185
|
};
|
|
186
186
|
}, {
|
|
187
|
-
params: {
|
|
188
|
-
userId: string;
|
|
189
|
-
};
|
|
190
187
|
body: {
|
|
191
188
|
firstName?: string | undefined;
|
|
192
189
|
lastName?: string | undefined;
|
|
@@ -198,6 +195,9 @@ export declare const updateUserProfileSchema: z.ZodObject<{
|
|
|
198
195
|
isSuspended?: boolean | undefined;
|
|
199
196
|
isDeactivated?: boolean | undefined;
|
|
200
197
|
};
|
|
198
|
+
params: {
|
|
199
|
+
userId: string;
|
|
200
|
+
};
|
|
201
201
|
headers: {
|
|
202
202
|
authorization: string;
|
|
203
203
|
};
|
|
@@ -216,29 +216,29 @@ export declare const getAllUsersSchema: z.ZodObject<{
|
|
|
216
216
|
sortBy: z.ZodDefault<z.ZodEnum<["firstName", "lastLoginAt", "createdAt"]>>;
|
|
217
217
|
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
218
218
|
}, "strip", z.ZodTypeAny, {
|
|
219
|
-
sortBy: "firstName" | "lastLoginAt" | "createdAt";
|
|
220
219
|
order: "asc" | "desc";
|
|
221
|
-
|
|
220
|
+
sortBy: "firstName" | "lastLoginAt" | "createdAt";
|
|
221
|
+
search?: string | undefined;
|
|
222
|
+
limit?: number | undefined;
|
|
222
223
|
isActive?: boolean | undefined;
|
|
223
224
|
isSuspended?: boolean | undefined;
|
|
225
|
+
role?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
|
|
224
226
|
page?: number | undefined;
|
|
225
|
-
limit?: number | undefined;
|
|
226
227
|
isBanned?: boolean | undefined;
|
|
227
|
-
search?: string | undefined;
|
|
228
228
|
startDate?: string | undefined;
|
|
229
229
|
endDate?: string | undefined;
|
|
230
230
|
}, {
|
|
231
|
-
|
|
231
|
+
search?: string | undefined;
|
|
232
|
+
order?: "asc" | "desc" | undefined;
|
|
233
|
+
limit?: string | undefined;
|
|
232
234
|
isActive?: "true" | "false" | undefined;
|
|
233
235
|
isSuspended?: "true" | "false" | undefined;
|
|
236
|
+
role?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
|
|
234
237
|
page?: string | undefined;
|
|
235
|
-
limit?: string | undefined;
|
|
236
238
|
isBanned?: "true" | "false" | undefined;
|
|
237
|
-
search?: string | undefined;
|
|
238
239
|
startDate?: string | undefined;
|
|
239
240
|
endDate?: string | undefined;
|
|
240
241
|
sortBy?: "firstName" | "lastLoginAt" | "createdAt" | undefined;
|
|
241
|
-
order?: "asc" | "desc" | undefined;
|
|
242
242
|
}>;
|
|
243
243
|
headers: z.ZodObject<{
|
|
244
244
|
authorization: z.ZodString;
|
|
@@ -248,38 +248,38 @@ export declare const getAllUsersSchema: z.ZodObject<{
|
|
|
248
248
|
authorization: string;
|
|
249
249
|
}>;
|
|
250
250
|
}, "strip", z.ZodTypeAny, {
|
|
251
|
-
headers: {
|
|
252
|
-
authorization: string;
|
|
253
|
-
};
|
|
254
251
|
query: {
|
|
255
|
-
sortBy: "firstName" | "lastLoginAt" | "createdAt";
|
|
256
252
|
order: "asc" | "desc";
|
|
257
|
-
|
|
253
|
+
sortBy: "firstName" | "lastLoginAt" | "createdAt";
|
|
254
|
+
search?: string | undefined;
|
|
255
|
+
limit?: number | undefined;
|
|
258
256
|
isActive?: boolean | undefined;
|
|
259
257
|
isSuspended?: boolean | undefined;
|
|
258
|
+
role?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
|
|
260
259
|
page?: number | undefined;
|
|
261
|
-
limit?: number | undefined;
|
|
262
260
|
isBanned?: boolean | undefined;
|
|
263
|
-
search?: string | undefined;
|
|
264
261
|
startDate?: string | undefined;
|
|
265
262
|
endDate?: string | undefined;
|
|
266
263
|
};
|
|
267
|
-
}, {
|
|
268
264
|
headers: {
|
|
269
265
|
authorization: string;
|
|
270
266
|
};
|
|
267
|
+
}, {
|
|
271
268
|
query: {
|
|
272
|
-
|
|
269
|
+
search?: string | undefined;
|
|
270
|
+
order?: "asc" | "desc" | undefined;
|
|
271
|
+
limit?: string | undefined;
|
|
273
272
|
isActive?: "true" | "false" | undefined;
|
|
274
273
|
isSuspended?: "true" | "false" | undefined;
|
|
274
|
+
role?: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN" | undefined;
|
|
275
275
|
page?: string | undefined;
|
|
276
|
-
limit?: string | undefined;
|
|
277
276
|
isBanned?: "true" | "false" | undefined;
|
|
278
|
-
search?: string | undefined;
|
|
279
277
|
startDate?: string | undefined;
|
|
280
278
|
endDate?: string | undefined;
|
|
281
279
|
sortBy?: "firstName" | "lastLoginAt" | "createdAt" | undefined;
|
|
282
|
-
|
|
280
|
+
};
|
|
281
|
+
headers: {
|
|
282
|
+
authorization: string;
|
|
283
283
|
};
|
|
284
284
|
}>;
|
|
285
285
|
export declare const viewProfileSchema: z.ZodObject<{
|
|
@@ -297,16 +297,16 @@ export declare const viewProfileSchema: z.ZodObject<{
|
|
|
297
297
|
headers: {
|
|
298
298
|
authorization: string;
|
|
299
299
|
};
|
|
300
|
-
params?: {} | undefined;
|
|
301
300
|
body?: {} | undefined;
|
|
302
301
|
query?: {} | undefined;
|
|
302
|
+
params?: {} | undefined;
|
|
303
303
|
}, {
|
|
304
304
|
headers: {
|
|
305
305
|
authorization: string;
|
|
306
306
|
};
|
|
307
|
-
params?: {} | undefined;
|
|
308
307
|
body?: {} | undefined;
|
|
309
308
|
query?: {} | undefined;
|
|
309
|
+
params?: {} | undefined;
|
|
310
310
|
}>;
|
|
311
311
|
export declare const passengerSignupSchema: z.ZodObject<{
|
|
312
312
|
body: z.ZodObject<{
|
|
@@ -323,19 +323,19 @@ export declare const passengerSignupSchema: z.ZodObject<{
|
|
|
323
323
|
lastName: string;
|
|
324
324
|
phoneNumber: string;
|
|
325
325
|
nationalId: string;
|
|
326
|
+
jacketId?: string | undefined;
|
|
326
327
|
email?: string | null | undefined;
|
|
327
328
|
password?: string | null | undefined;
|
|
328
329
|
plateNumber?: string | null | undefined;
|
|
329
|
-
jacketId?: string | undefined;
|
|
330
330
|
}, {
|
|
331
331
|
firstName: string;
|
|
332
332
|
lastName: string;
|
|
333
333
|
phoneNumber: string;
|
|
334
334
|
nationalId: string;
|
|
335
|
+
jacketId?: string | undefined;
|
|
335
336
|
email?: string | null | undefined;
|
|
336
337
|
password?: string | null | undefined;
|
|
337
338
|
plateNumber?: string | null | undefined;
|
|
338
|
-
jacketId?: string | undefined;
|
|
339
339
|
}>;
|
|
340
340
|
headers: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
341
341
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -344,10 +344,10 @@ export declare const passengerSignupSchema: z.ZodObject<{
|
|
|
344
344
|
lastName: string;
|
|
345
345
|
phoneNumber: string;
|
|
346
346
|
nationalId: string;
|
|
347
|
+
jacketId?: string | undefined;
|
|
347
348
|
email?: string | null | undefined;
|
|
348
349
|
password?: string | null | undefined;
|
|
349
350
|
plateNumber?: string | null | undefined;
|
|
350
|
-
jacketId?: string | undefined;
|
|
351
351
|
};
|
|
352
352
|
headers?: {} | undefined;
|
|
353
353
|
}, {
|
|
@@ -356,10 +356,10 @@ export declare const passengerSignupSchema: z.ZodObject<{
|
|
|
356
356
|
lastName: string;
|
|
357
357
|
phoneNumber: string;
|
|
358
358
|
nationalId: string;
|
|
359
|
+
jacketId?: string | undefined;
|
|
359
360
|
email?: string | null | undefined;
|
|
360
361
|
password?: string | null | undefined;
|
|
361
362
|
plateNumber?: string | null | undefined;
|
|
362
|
-
jacketId?: string | undefined;
|
|
363
363
|
};
|
|
364
364
|
headers?: {} | undefined;
|
|
365
365
|
}>;
|
|
@@ -419,16 +419,16 @@ export declare const createRiderSchema: z.ZodObject<{
|
|
|
419
419
|
firstName: string;
|
|
420
420
|
lastName: string;
|
|
421
421
|
phoneNumber: string;
|
|
422
|
-
nationalId: string;
|
|
423
|
-
plateNumber: string;
|
|
424
422
|
jacketId: string;
|
|
423
|
+
plateNumber: string;
|
|
424
|
+
nationalId: string;
|
|
425
425
|
}, {
|
|
426
426
|
firstName: string;
|
|
427
427
|
lastName: string;
|
|
428
428
|
phoneNumber: string;
|
|
429
|
-
nationalId: string;
|
|
430
|
-
plateNumber: string;
|
|
431
429
|
jacketId: string;
|
|
430
|
+
plateNumber: string;
|
|
431
|
+
nationalId: string;
|
|
432
432
|
}>;
|
|
433
433
|
params: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
434
434
|
query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
@@ -437,23 +437,23 @@ export declare const createRiderSchema: z.ZodObject<{
|
|
|
437
437
|
firstName: string;
|
|
438
438
|
lastName: string;
|
|
439
439
|
phoneNumber: string;
|
|
440
|
-
nationalId: string;
|
|
441
|
-
plateNumber: string;
|
|
442
440
|
jacketId: string;
|
|
441
|
+
plateNumber: string;
|
|
442
|
+
nationalId: string;
|
|
443
443
|
};
|
|
444
|
-
params?: {} | undefined;
|
|
445
444
|
query?: {} | undefined;
|
|
445
|
+
params?: {} | undefined;
|
|
446
446
|
}, {
|
|
447
447
|
body: {
|
|
448
448
|
firstName: string;
|
|
449
449
|
lastName: string;
|
|
450
450
|
phoneNumber: string;
|
|
451
|
-
nationalId: string;
|
|
452
|
-
plateNumber: string;
|
|
453
451
|
jacketId: string;
|
|
452
|
+
plateNumber: string;
|
|
453
|
+
nationalId: string;
|
|
454
454
|
};
|
|
455
|
-
params?: {} | undefined;
|
|
456
455
|
query?: {} | undefined;
|
|
456
|
+
params?: {} | undefined;
|
|
457
457
|
}>;
|
|
458
458
|
export declare const updateRiderProfileSchema: z.ZodObject<{
|
|
459
459
|
params: z.ZodObject<{
|
|
@@ -474,30 +474,30 @@ export declare const updateRiderProfileSchema: z.ZodObject<{
|
|
|
474
474
|
firstName: string;
|
|
475
475
|
lastName: string;
|
|
476
476
|
phoneNumber: string;
|
|
477
|
-
nationalId: string;
|
|
478
|
-
plateNumber: string;
|
|
479
477
|
jacketId: string;
|
|
478
|
+
plateNumber: string;
|
|
479
|
+
nationalId: string;
|
|
480
480
|
}, {
|
|
481
481
|
firstName: string;
|
|
482
482
|
lastName: string;
|
|
483
483
|
phoneNumber: string;
|
|
484
|
-
nationalId: string;
|
|
485
|
-
plateNumber: string;
|
|
486
484
|
jacketId: string;
|
|
485
|
+
plateNumber: string;
|
|
486
|
+
nationalId: string;
|
|
487
487
|
}>, {
|
|
488
488
|
firstName: string;
|
|
489
489
|
lastName: string;
|
|
490
490
|
phoneNumber: string;
|
|
491
|
-
nationalId: string;
|
|
492
|
-
plateNumber: string;
|
|
493
491
|
jacketId: string;
|
|
492
|
+
plateNumber: string;
|
|
493
|
+
nationalId: string;
|
|
494
494
|
}, {
|
|
495
495
|
firstName: string;
|
|
496
496
|
lastName: string;
|
|
497
497
|
phoneNumber: string;
|
|
498
|
-
nationalId: string;
|
|
499
|
-
plateNumber: string;
|
|
500
498
|
jacketId: string;
|
|
499
|
+
plateNumber: string;
|
|
500
|
+
nationalId: string;
|
|
501
501
|
}>;
|
|
502
502
|
query: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
503
503
|
headers: z.ZodObject<{
|
|
@@ -508,32 +508,32 @@ export declare const updateRiderProfileSchema: z.ZodObject<{
|
|
|
508
508
|
authorization: string;
|
|
509
509
|
}>;
|
|
510
510
|
}, "strip", z.ZodTypeAny, {
|
|
511
|
-
params: {
|
|
512
|
-
id: string;
|
|
513
|
-
};
|
|
514
511
|
body: {
|
|
515
512
|
firstName: string;
|
|
516
513
|
lastName: string;
|
|
517
514
|
phoneNumber: string;
|
|
518
|
-
nationalId: string;
|
|
519
|
-
plateNumber: string;
|
|
520
515
|
jacketId: string;
|
|
516
|
+
plateNumber: string;
|
|
517
|
+
nationalId: string;
|
|
518
|
+
};
|
|
519
|
+
params: {
|
|
520
|
+
id: string;
|
|
521
521
|
};
|
|
522
522
|
headers: {
|
|
523
523
|
authorization: string;
|
|
524
524
|
};
|
|
525
525
|
query?: {} | undefined;
|
|
526
526
|
}, {
|
|
527
|
-
params: {
|
|
528
|
-
id: string;
|
|
529
|
-
};
|
|
530
527
|
body: {
|
|
531
528
|
firstName: string;
|
|
532
529
|
lastName: string;
|
|
533
530
|
phoneNumber: string;
|
|
534
|
-
nationalId: string;
|
|
535
|
-
plateNumber: string;
|
|
536
531
|
jacketId: string;
|
|
532
|
+
plateNumber: string;
|
|
533
|
+
nationalId: string;
|
|
534
|
+
};
|
|
535
|
+
params: {
|
|
536
|
+
id: string;
|
|
537
537
|
};
|
|
538
538
|
headers: {
|
|
539
539
|
authorization: string;
|