picker-db 5.0.3 → 5.0.6

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.
@@ -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
  };
@@ -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.6",
4
4
  "description": "Picker DB services",
5
5
  "main": "index.js",
6
6
  "scripts": {