picker-db 5.0.3 → 5.0.7

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/constants.js CHANGED
@@ -462,5 +462,9 @@ module.exports = {
462
462
  PICKUP: "PICKUP",
463
463
  DELIVERY: "DELIVERY",
464
464
  },
465
- }
465
+ SUBTYPES: {
466
+ PICKUP_AND_DELIVER: "PICKUP_AND_DELIVER",
467
+ MULTI_PICKING: "MULTI_PICKING",
468
+ },
469
+ },
466
470
  };
@@ -27,6 +27,7 @@ const BookingDriverDetailsSchema = require("../schemas/bookingDriverDetails");
27
27
  const ConversationSchema = require("../schemas/conversation");
28
28
  const BookingMetadataSchema = require("../schemas/bookingMetadata");
29
29
  const BookingStopSchema = require("../schemas/bookingStop");
30
+ const UserAuditLogSchema = require("../schemas/userAuditLog");
30
31
 
31
32
  /** @param {import("mongoose")} connection */
32
33
  module.exports = (connection) => {
@@ -60,5 +61,6 @@ module.exports = (connection) => {
60
61
  Conversation: connection.model("Conversation", ConversationSchema(connection)),
61
62
  BookingMetadata: connection.model("BookingMetadata", BookingMetadataSchema(connection)),
62
63
  BookingStop: connection.model("BookingStop", BookingStopSchema(connection)),
64
+ UserAuditLog: connection.model("UserAuditLog", UserAuditLogSchema(connection)),
63
65
  };
64
66
  };
@@ -1,4 +1,4 @@
1
- const { VEHICLE_TYPES, PAYMENT_METHODS, BOOKING_TYPES, BOOKING_STATUS, DELIVERY_CHARGE_TYPE, PROOF_OF_DELIVERY, PNF_REASON } = require("../../../constants");
1
+ const { VEHICLE_TYPES, PAYMENT_METHODS, BOOKING_TYPES, BOOKING_STATUS, DELIVERY_CHARGE_TYPE, PROOF_OF_DELIVERY, PNF_REASON, BOOKING } = require("../../../constants");
2
2
  const { DEVICE_TYPES } = require("../../../constants").USER;
3
3
 
4
4
  const PricingDetailsSchema = require("./pricingDetails");
@@ -375,7 +375,11 @@ module.exports = (connection) => {
375
375
  },
376
376
  subtype: {
377
377
  type: String,
378
- default: "PICKUP_AND_DELIVER",
378
+ enum: [
379
+ BOOKING.SUBTYPES.PICKUP_AND_DELIVER,
380
+ BOOKING.SUBTYPES.MULTI_PICKING,
381
+ ],
382
+ default: BOOKING.SUBTYPES.PICKUP_AND_DELIVER,
379
383
  },
380
384
  transactionDetails: {
381
385
  itemCharge: {
@@ -331,6 +331,17 @@ module.exports = (connection) => {
331
331
  dashboardInviteTokenDate: {
332
332
  type: Date,
333
333
  },
334
+ twoFactorEnabled: { type: Boolean, default: false },
335
+ twoFactorSetupCompleted: { type: Boolean, default: false },
336
+ twoFactorSecret: { type: String },
337
+ twoFactorIV: { type: String },
338
+ twoFactorAuthTag: { type: String },
339
+ lastUsedTOTPTimestamp: { type: Number, default: null },
340
+ twoFactorBackupCodes: [{
341
+ hash: { type: String },
342
+ used: { type: Boolean, default: false },
343
+ }],
344
+ twoFactorGraceDeadline: { type: Date, default: null },
334
345
  }, { timestamps: true });
335
346
 
336
347
  return UserSchema;
@@ -0,0 +1,24 @@
1
+ /** @param {import("mongoose")} connection */
2
+ module.exports = (connection) => {
3
+ const UserAuditLogSchema = new connection.base.Schema({
4
+ event: {
5
+ type: String,
6
+ required: true,
7
+ index: true,
8
+ },
9
+ userId: {
10
+ type: connection.base.Schema.ObjectId,
11
+ ref: "User",
12
+ required: true,
13
+ index: true,
14
+ },
15
+ performedBy: {
16
+ type: connection.base.Schema.ObjectId,
17
+ ref: "User",
18
+ },
19
+ ip: { type: String },
20
+ metadata: { type: JSON },
21
+ }, { timestamps: true });
22
+
23
+ return UserAuditLogSchema;
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picker-db",
3
- "version": "5.0.3",
3
+ "version": "5.0.7",
4
4
  "description": "Picker DB services",
5
5
  "main": "index.js",
6
6
  "scripts": {