picker-db 5.0.2 → 5.0.3
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
package/modules/picker/index.js
CHANGED
|
@@ -45,6 +45,25 @@ class PickerMongoDBService {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Wrapper around 'insertMany' method
|
|
50
|
+
* @description Inserts multiple documents in the database
|
|
51
|
+
* @param {string} modelName Name of the model for this operation
|
|
52
|
+
* @param {object[]} arrObjToSave Array of documents to save
|
|
53
|
+
* @returns {Promise<object[]>}
|
|
54
|
+
*/
|
|
55
|
+
async createMany (modelName, arrObjToSave) {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
this.models[modelName].insertMany(arrObjToSave)
|
|
58
|
+
.then((res) => {
|
|
59
|
+
return resolve(res);
|
|
60
|
+
})
|
|
61
|
+
.catch((err) => {
|
|
62
|
+
return reject(err);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
48
67
|
/**
|
|
49
68
|
* Wrapper around 'find' method
|
|
50
69
|
* @description Returns all documents that match the query
|
|
@@ -26,6 +26,7 @@ const MiniBookingSchema = require("../schemas/miniBooking");
|
|
|
26
26
|
const BookingDriverDetailsSchema = require("../schemas/bookingDriverDetails");
|
|
27
27
|
const ConversationSchema = require("../schemas/conversation");
|
|
28
28
|
const BookingMetadataSchema = require("../schemas/bookingMetadata");
|
|
29
|
+
const BookingStopSchema = require("../schemas/bookingStop");
|
|
29
30
|
|
|
30
31
|
/** @param {import("mongoose")} connection */
|
|
31
32
|
module.exports = (connection) => {
|
|
@@ -58,5 +59,6 @@ module.exports = (connection) => {
|
|
|
58
59
|
BookingDriverDetails: connection.model("BookingDriverDetails", BookingDriverDetailsSchema(connection)),
|
|
59
60
|
Conversation: connection.model("Conversation", ConversationSchema(connection)),
|
|
60
61
|
BookingMetadata: connection.model("BookingMetadata", BookingMetadataSchema(connection)),
|
|
62
|
+
BookingStop: connection.model("BookingStop", BookingStopSchema(connection)),
|
|
61
63
|
};
|
|
62
64
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const { BOOKING } = require("../../../constants");
|
|
2
|
+
|
|
3
|
+
module.exports = (connection) => {
|
|
4
|
+
const BookingStopSchema = new connection.base.Schema({
|
|
5
|
+
bookingID: {
|
|
6
|
+
type: connection.base.Schema.ObjectId,
|
|
7
|
+
ref: "Bookings",
|
|
8
|
+
index: true,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
type: {
|
|
12
|
+
type: String,
|
|
13
|
+
enum: [BOOKING.BOOKING_STOP_TYPES.PICKUP, BOOKING.BOOKING_STOP_TYPES.DELIVERY],
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
business: {
|
|
17
|
+
type: connection.base.Schema.ObjectId,
|
|
18
|
+
ref: "User",
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
address: {
|
|
22
|
+
type: String,
|
|
23
|
+
},
|
|
24
|
+
coordinates: {
|
|
25
|
+
type: {
|
|
26
|
+
type: String,
|
|
27
|
+
enum: ["Point"],
|
|
28
|
+
},
|
|
29
|
+
coordinates: {
|
|
30
|
+
type: [Number],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
city: {
|
|
34
|
+
type: String,
|
|
35
|
+
},
|
|
36
|
+
zipCode: {
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
references: {
|
|
40
|
+
type: String,
|
|
41
|
+
},
|
|
42
|
+
orderIndex: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
}, { timestamps: true, strict: false });
|
|
47
|
+
|
|
48
|
+
return BookingStopSchema;
|
|
49
|
+
};
|
|
@@ -331,17 +331,6 @@ 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 },
|
|
345
334
|
}, { timestamps: true });
|
|
346
335
|
|
|
347
336
|
return UserSchema;
|