picker-db 3.4.0
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/.editorconfig +8 -0
- package/.eslintignore +9 -0
- package/.eslintrc.json +35 -0
- package/.nvmrc +1 -0
- package/.vscode/settings.json +11 -0
- package/README.md +21 -0
- package/bitbucket-pipelines.yml +24 -0
- package/constants.js +420 -0
- package/index.js +5 -0
- package/lib/Logger/index.js +45 -0
- package/lib/Mongo/index.js +126 -0
- package/modules/picker/index.js +259 -0
- package/modules/picker/models/identityCounter.js +15 -0
- package/modules/picker/models/index.js +50 -0
- package/modules/picker/schemas/address.js +74 -0
- package/modules/picker/schemas/adminSetting.js +125 -0
- package/modules/picker/schemas/balanceTransaction.js +132 -0
- package/modules/picker/schemas/bill.js +70 -0
- package/modules/picker/schemas/bookingProduct.js +50 -0
- package/modules/picker/schemas/bookings.js +699 -0
- package/modules/picker/schemas/business.js +231 -0
- package/modules/picker/schemas/businessCategory.js +61 -0
- package/modules/picker/schemas/customer.js +28 -0
- package/modules/picker/schemas/driver.js +162 -0
- package/modules/picker/schemas/fareSettings.js +122 -0
- package/modules/picker/schemas/fraudBooking.js +21 -0
- package/modules/picker/schemas/identityCounter.js +10 -0
- package/modules/picker/schemas/kmRange.js +27 -0
- package/modules/picker/schemas/massDelivery.js +119 -0
- package/modules/picker/schemas/notification.js +76 -0
- package/modules/picker/schemas/paymentezCustomer.js +41 -0
- package/modules/picker/schemas/paymentezTransaction.js +67 -0
- package/modules/picker/schemas/preference.js +40 -0
- package/modules/picker/schemas/pricingDetails.js +90 -0
- package/modules/picker/schemas/referralUsage.js +33 -0
- package/modules/picker/schemas/region.js +75 -0
- package/modules/picker/schemas/review.js +42 -0
- package/modules/picker/schemas/session.js +25 -0
- package/modules/picker/schemas/superRegion.js +41 -0
- package/modules/picker/schemas/user.js +337 -0
- package/package.json +29 -0
- package/playground/testConnection.js +24 -0
- package/playground/testService.js +27 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
const { TYPES } = require("../../../constants").BUSINESS;
|
|
2
|
+
const { DEVICE_TYPES } = require("../../../constants").USER;
|
|
3
|
+
const { PAYMENT_METHODS } = require("../../../constants");
|
|
4
|
+
|
|
5
|
+
const FareSettingsSchema = require("./fareSettings");
|
|
6
|
+
|
|
7
|
+
/** @param {import("mongoose")} connection */
|
|
8
|
+
module.exports = (connection) => {
|
|
9
|
+
const WebhookSchema = new connection.base.Schema({
|
|
10
|
+
url: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
}, { timestamps: false, _id: false });
|
|
19
|
+
|
|
20
|
+
const ScheduleSchema = new connection.base.Schema({
|
|
21
|
+
day: {
|
|
22
|
+
type: Number,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
open: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
close: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
isOpen: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
}, { _id: false });
|
|
38
|
+
|
|
39
|
+
const SettingsSchema = new connection.base.Schema({
|
|
40
|
+
maxDeliveryDistance: {
|
|
41
|
+
type: Number,
|
|
42
|
+
min: 0,
|
|
43
|
+
max: 100,
|
|
44
|
+
}, // In kms
|
|
45
|
+
commission: {
|
|
46
|
+
type: Number,
|
|
47
|
+
min: 0,
|
|
48
|
+
max: 100,
|
|
49
|
+
}, // Percentage
|
|
50
|
+
searchMaxDistance: {
|
|
51
|
+
type: Number,
|
|
52
|
+
min: 0,
|
|
53
|
+
max: 100,
|
|
54
|
+
}, // In kms. For driver search
|
|
55
|
+
personalizedSMR: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
},
|
|
58
|
+
deliveryFee: {
|
|
59
|
+
type: {
|
|
60
|
+
type: String,
|
|
61
|
+
},
|
|
62
|
+
value: {
|
|
63
|
+
type: Number,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
}, { _id: false, timestamps: false });
|
|
67
|
+
|
|
68
|
+
const BusinessSchema = new connection.base.Schema({
|
|
69
|
+
companyMobile: {
|
|
70
|
+
type: String,
|
|
71
|
+
index: true,
|
|
72
|
+
trim: true,
|
|
73
|
+
sparse: true,
|
|
74
|
+
},
|
|
75
|
+
companyCountryCode: { type: String },
|
|
76
|
+
companyFullMobile: {
|
|
77
|
+
type: String,
|
|
78
|
+
index: true,
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
companyName: { type: String },
|
|
82
|
+
businessCategories: [{
|
|
83
|
+
type: connection.base.Schema.ObjectId,
|
|
84
|
+
ref: "BusinessCategory",
|
|
85
|
+
}],
|
|
86
|
+
storeType: {
|
|
87
|
+
type: String,
|
|
88
|
+
required: true,
|
|
89
|
+
enum: [
|
|
90
|
+
TYPES.EXTERNAL,
|
|
91
|
+
TYPES.MARKETPLACE,
|
|
92
|
+
TYPES.SHOP_ORDER,
|
|
93
|
+
],
|
|
94
|
+
default: TYPES.MARKETPLACE,
|
|
95
|
+
},
|
|
96
|
+
schedule: { type: [ScheduleSchema] },
|
|
97
|
+
tags: [{ type: String }],
|
|
98
|
+
// #region Verification control
|
|
99
|
+
isEmailVerified: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
required: true,
|
|
103
|
+
},
|
|
104
|
+
emailVerificationToken: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: false,
|
|
107
|
+
},
|
|
108
|
+
emailVerificationTokenUpdatedAt: {
|
|
109
|
+
type: Date,
|
|
110
|
+
},
|
|
111
|
+
otpResendTimes: { type: Number, max: 3 },
|
|
112
|
+
// #endregion Verification control
|
|
113
|
+
|
|
114
|
+
frontImage: {
|
|
115
|
+
thumbnail: { type: String, default: null },
|
|
116
|
+
original: { type: String, default: null },
|
|
117
|
+
},
|
|
118
|
+
// #region Location
|
|
119
|
+
latitude: {
|
|
120
|
+
type: Number,
|
|
121
|
+
default: null,
|
|
122
|
+
},
|
|
123
|
+
longitude: {
|
|
124
|
+
type: Number,
|
|
125
|
+
default: null,
|
|
126
|
+
},
|
|
127
|
+
fullAddress: { type: String },
|
|
128
|
+
// #endregion Location
|
|
129
|
+
|
|
130
|
+
avgTime: {
|
|
131
|
+
value: {
|
|
132
|
+
type: Number,
|
|
133
|
+
default: 0,
|
|
134
|
+
},
|
|
135
|
+
text: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: "",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
// #region Device information
|
|
142
|
+
deviceType: {
|
|
143
|
+
type: String,
|
|
144
|
+
enum: [
|
|
145
|
+
DEVICE_TYPES.IOS,
|
|
146
|
+
DEVICE_TYPES.ANDROID,
|
|
147
|
+
DEVICE_TYPES.WEB,
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
appVersion: { type: String },
|
|
151
|
+
deviceToken: {
|
|
152
|
+
type: String,
|
|
153
|
+
trim: true,
|
|
154
|
+
index: true,
|
|
155
|
+
sparse: true,
|
|
156
|
+
},
|
|
157
|
+
// #endregion Device information
|
|
158
|
+
|
|
159
|
+
productTypes: [{
|
|
160
|
+
type: String,
|
|
161
|
+
}],
|
|
162
|
+
|
|
163
|
+
// #region Approval information
|
|
164
|
+
approvedBy: {
|
|
165
|
+
type: connection.base.Schema.ObjectId,
|
|
166
|
+
ref: "User",
|
|
167
|
+
},
|
|
168
|
+
rejectedBy: {
|
|
169
|
+
type: connection.base.Schema.ObjectId,
|
|
170
|
+
ref: "User",
|
|
171
|
+
},
|
|
172
|
+
approvedDate: {
|
|
173
|
+
type: Date,
|
|
174
|
+
},
|
|
175
|
+
rejectedDate: {
|
|
176
|
+
type: Date,
|
|
177
|
+
},
|
|
178
|
+
// #endregion Approval information
|
|
179
|
+
|
|
180
|
+
status: {
|
|
181
|
+
type: String,
|
|
182
|
+
},
|
|
183
|
+
onDutyFlag: {
|
|
184
|
+
type: Boolean,
|
|
185
|
+
default: true,
|
|
186
|
+
},
|
|
187
|
+
fareSettings: [FareSettingsSchema(connection)],
|
|
188
|
+
totalRatingPoints: {
|
|
189
|
+
type: Number,
|
|
190
|
+
min: 0,
|
|
191
|
+
default: 0,
|
|
192
|
+
},
|
|
193
|
+
totalRatingCount: {
|
|
194
|
+
type: Number,
|
|
195
|
+
min: 0,
|
|
196
|
+
default: 0,
|
|
197
|
+
},
|
|
198
|
+
totalBookingsCompleted: {
|
|
199
|
+
type: Number,
|
|
200
|
+
min: 0,
|
|
201
|
+
default: 0,
|
|
202
|
+
},
|
|
203
|
+
totalApprovedProducts: {
|
|
204
|
+
type: Number,
|
|
205
|
+
min: 0,
|
|
206
|
+
default: 0,
|
|
207
|
+
},
|
|
208
|
+
dynamicLink: {
|
|
209
|
+
type: String,
|
|
210
|
+
},
|
|
211
|
+
aditionalInfo: {
|
|
212
|
+
type: String,
|
|
213
|
+
},
|
|
214
|
+
webhooks: [WebhookSchema],
|
|
215
|
+
smrVia: [String],
|
|
216
|
+
paymentMethod: {
|
|
217
|
+
type: String,
|
|
218
|
+
required: true,
|
|
219
|
+
enum: [
|
|
220
|
+
PAYMENT_METHODS.CARD.TEXT,
|
|
221
|
+
PAYMENT_METHODS.CASH.TEXT,
|
|
222
|
+
PAYMENT_METHODS.BOTH.TEXT,
|
|
223
|
+
],
|
|
224
|
+
default: PAYMENT_METHODS.CARD.TEXT,
|
|
225
|
+
},
|
|
226
|
+
settings: SettingsSchema,
|
|
227
|
+
|
|
228
|
+
}, { timestamps: true });
|
|
229
|
+
|
|
230
|
+
return BusinessSchema;
|
|
231
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** @param {import("mongoose")} connection */
|
|
2
|
+
module.exports = (connection) => {
|
|
3
|
+
const namesSchema = new connection.base.Schema({
|
|
4
|
+
text: { type: String },
|
|
5
|
+
lang: { type: String },
|
|
6
|
+
}, { _id: false });
|
|
7
|
+
|
|
8
|
+
const BusinessCategorySchema = new connection.base.Schema({
|
|
9
|
+
name: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
image: {
|
|
14
|
+
thumbnail: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: null,
|
|
17
|
+
},
|
|
18
|
+
original: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: null,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
order: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 100,
|
|
26
|
+
},
|
|
27
|
+
isDeleted: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
tag: {
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
productTypes: [{
|
|
35
|
+
type: String,
|
|
36
|
+
}],
|
|
37
|
+
commission: {
|
|
38
|
+
type: Number,
|
|
39
|
+
required: true,
|
|
40
|
+
min: 0,
|
|
41
|
+
max: 100,
|
|
42
|
+
},
|
|
43
|
+
names: [
|
|
44
|
+
namesSchema,
|
|
45
|
+
],
|
|
46
|
+
superRegions: [{
|
|
47
|
+
type: connection.base.Schema.ObjectId,
|
|
48
|
+
ref: "SuperRegion",
|
|
49
|
+
}],
|
|
50
|
+
isVisible: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
showClosedBusinesses: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true,
|
|
57
|
+
},
|
|
58
|
+
}, { timestamps: true });
|
|
59
|
+
|
|
60
|
+
return BusinessCategorySchema;
|
|
61
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { DEVICE_TYPES } = require("../../../constants").USER;
|
|
2
|
+
|
|
3
|
+
const FareSettingsSchema = require("./fareSettings");
|
|
4
|
+
|
|
5
|
+
/** @param {import("mongoose")} connection */
|
|
6
|
+
module.exports = (connection) => {
|
|
7
|
+
const CustomerSchema = new connection.base.Schema({
|
|
8
|
+
deviceType: {
|
|
9
|
+
type: String,
|
|
10
|
+
enum: [
|
|
11
|
+
DEVICE_TYPES.IOS,
|
|
12
|
+
DEVICE_TYPES.ANDROID,
|
|
13
|
+
DEVICE_TYPES.WEB,
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
appVersion: { type: String },
|
|
17
|
+
deviceToken: {
|
|
18
|
+
type: String,
|
|
19
|
+
trim: true,
|
|
20
|
+
index: true,
|
|
21
|
+
sparse: true,
|
|
22
|
+
},
|
|
23
|
+
tag: { type: String },
|
|
24
|
+
fareSettings: [FareSettingsSchema(connection)],
|
|
25
|
+
}, { timestamps: true });
|
|
26
|
+
|
|
27
|
+
return CustomerSchema;
|
|
28
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const { PAYMENT, TYPE, ACCOUNTING_TYPE } = require("../../../constants").DRIVER;
|
|
2
|
+
const { DEVICE_TYPES } = require("../../../constants").USER;
|
|
3
|
+
const { VEHICLE_TYPES } = require("../../../constants");
|
|
4
|
+
|
|
5
|
+
/** @param {import("mongoose")} connection */
|
|
6
|
+
module.exports = (connection) => {
|
|
7
|
+
const DriverSchema = new connection.base.Schema({
|
|
8
|
+
currentDriverLocation: {
|
|
9
|
+
type: { type: String, default: "Point" },
|
|
10
|
+
coordinates: { type: [Number], default: [0, 0] },
|
|
11
|
+
},
|
|
12
|
+
deviceType: {
|
|
13
|
+
type: String,
|
|
14
|
+
enum: [
|
|
15
|
+
DEVICE_TYPES.IOS,
|
|
16
|
+
DEVICE_TYPES.ANDROID,
|
|
17
|
+
DEVICE_TYPES.WEB,
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
appVersion: { type: String },
|
|
21
|
+
deviceToken: {
|
|
22
|
+
type: String,
|
|
23
|
+
trim: true,
|
|
24
|
+
index: true,
|
|
25
|
+
sparse: true,
|
|
26
|
+
},
|
|
27
|
+
vehicleType: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: null,
|
|
30
|
+
},
|
|
31
|
+
carType: {
|
|
32
|
+
type: Number,
|
|
33
|
+
enum: [
|
|
34
|
+
VEHICLE_TYPES.BIKE.INDEX,
|
|
35
|
+
VEHICLE_TYPES.LITE.INDEX,
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
vehicleColor: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: null,
|
|
41
|
+
},
|
|
42
|
+
vehicleYear: { type: Number },
|
|
43
|
+
MCNumber: {
|
|
44
|
+
type: String,
|
|
45
|
+
unique: true,
|
|
46
|
+
},
|
|
47
|
+
vehicleModelName: { type: String },
|
|
48
|
+
onDutyFlag: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
lastOnDutyFlagTime: { type: Date },
|
|
53
|
+
isActive: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
tag: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "",
|
|
61
|
+
},
|
|
62
|
+
payment: {
|
|
63
|
+
type: {
|
|
64
|
+
type: String,
|
|
65
|
+
enum: [
|
|
66
|
+
PAYMENT.PERCENTAGE,
|
|
67
|
+
PAYMENT.ABSOLUTE,
|
|
68
|
+
PAYMENT.OVER_MINIMUM,
|
|
69
|
+
PAYMENT.PERCENTAGE_MINIMUM,
|
|
70
|
+
PAYMENT.ABSOLUTE_MINIMUM,
|
|
71
|
+
],
|
|
72
|
+
default: PAYMENT.ABSOLUTE,
|
|
73
|
+
},
|
|
74
|
+
value: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 4,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
batteryPercentage: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: null,
|
|
82
|
+
},
|
|
83
|
+
batteryStatus: {
|
|
84
|
+
type: Number,
|
|
85
|
+
enum: [1, 2, 3, 4, 5, null],
|
|
86
|
+
default: null,
|
|
87
|
+
},
|
|
88
|
+
totalPickerPoints: {
|
|
89
|
+
type: Number,
|
|
90
|
+
},
|
|
91
|
+
type: {
|
|
92
|
+
type: String,
|
|
93
|
+
enum: [
|
|
94
|
+
TYPE.STARTER,
|
|
95
|
+
TYPE.SENIOR,
|
|
96
|
+
TYPE.MCGYVER,
|
|
97
|
+
TYPE.PREMIUM,
|
|
98
|
+
],
|
|
99
|
+
default: TYPE.STARTER,
|
|
100
|
+
},
|
|
101
|
+
paymentBalance: {
|
|
102
|
+
type: Number,
|
|
103
|
+
},
|
|
104
|
+
wallet: {
|
|
105
|
+
type: Number,
|
|
106
|
+
min: 0,
|
|
107
|
+
default: 0,
|
|
108
|
+
},
|
|
109
|
+
bookingsCompleted: {
|
|
110
|
+
type: Number,
|
|
111
|
+
min: 0,
|
|
112
|
+
default: 0,
|
|
113
|
+
},
|
|
114
|
+
// ACCOUNTING DATA
|
|
115
|
+
paymentMethod: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: null,
|
|
118
|
+
},
|
|
119
|
+
workBalance: {
|
|
120
|
+
type: Number,
|
|
121
|
+
min: 0,
|
|
122
|
+
default: 0,
|
|
123
|
+
},
|
|
124
|
+
accountingType: {
|
|
125
|
+
type: String,
|
|
126
|
+
enum: [
|
|
127
|
+
ACCOUNTING_TYPE.OLD,
|
|
128
|
+
ACCOUNTING_TYPE.NEW,
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
// Personal information
|
|
132
|
+
personalInformation: {
|
|
133
|
+
profession: { type: String },
|
|
134
|
+
professionTime: { type: String },
|
|
135
|
+
review: { type: String },
|
|
136
|
+
linkedin: { type: String },
|
|
137
|
+
firstName: { type: String },
|
|
138
|
+
},
|
|
139
|
+
approvedBy: {
|
|
140
|
+
type: connection.base.Schema.ObjectId,
|
|
141
|
+
ref: "User",
|
|
142
|
+
},
|
|
143
|
+
approvedDate: {
|
|
144
|
+
type: Date,
|
|
145
|
+
},
|
|
146
|
+
geoSparkToken: {
|
|
147
|
+
type: String,
|
|
148
|
+
},
|
|
149
|
+
automaticAcceptation: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: false,
|
|
152
|
+
},
|
|
153
|
+
validatedOTP: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
},
|
|
156
|
+
lastOTPValidation: {
|
|
157
|
+
type: Date,
|
|
158
|
+
},
|
|
159
|
+
}, { timestamps: true });
|
|
160
|
+
|
|
161
|
+
return DriverSchema;
|
|
162
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
|
|
2
|
+
const _ = require("lodash");
|
|
3
|
+
|
|
4
|
+
const KmRangeSchema = require("./kmRange");
|
|
5
|
+
|
|
6
|
+
const { VEHICLE_TYPES } = require("../../../constants");
|
|
7
|
+
const { RUSH_HOUR_INCREASE_TYPES } = require("../../../constants").FARE;
|
|
8
|
+
|
|
9
|
+
/** @param {import("mongoose")} connection */
|
|
10
|
+
module.exports = (connection) => {
|
|
11
|
+
const FareSettingsSchema = new connection.base.Schema({
|
|
12
|
+
distanceRange: {
|
|
13
|
+
type: Number,
|
|
14
|
+
required: true,
|
|
15
|
+
min: 0,
|
|
16
|
+
},
|
|
17
|
+
baseFare: {
|
|
18
|
+
type: Number,
|
|
19
|
+
min: 0,
|
|
20
|
+
},
|
|
21
|
+
perKmCharge: {
|
|
22
|
+
type: Number,
|
|
23
|
+
min: 0,
|
|
24
|
+
},
|
|
25
|
+
perMinuteCharge: {
|
|
26
|
+
type: Number,
|
|
27
|
+
min: 0,
|
|
28
|
+
},
|
|
29
|
+
baseDistance: {
|
|
30
|
+
type: Number,
|
|
31
|
+
min: 0,
|
|
32
|
+
},
|
|
33
|
+
freeTime: {
|
|
34
|
+
type: Number,
|
|
35
|
+
min: 0,
|
|
36
|
+
},
|
|
37
|
+
averageTime: {
|
|
38
|
+
type: Number,
|
|
39
|
+
min: 0,
|
|
40
|
+
},
|
|
41
|
+
carType: {
|
|
42
|
+
type: Number,
|
|
43
|
+
enum: [
|
|
44
|
+
VEHICLE_TYPES.BIKE.INDEX,
|
|
45
|
+
VEHICLE_TYPES.LITE.INDEX,
|
|
46
|
+
],
|
|
47
|
+
index: true,
|
|
48
|
+
unique: false,
|
|
49
|
+
},
|
|
50
|
+
carName: {
|
|
51
|
+
type: String,
|
|
52
|
+
enum: [
|
|
53
|
+
VEHICLE_TYPES.BIKE.TEXT,
|
|
54
|
+
VEHICLE_TYPES.LITE.TEXT,
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
cancellationPolicy: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: null,
|
|
60
|
+
},
|
|
61
|
+
cancellationFreeTimeInSecond: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: 0,
|
|
64
|
+
},
|
|
65
|
+
minimumCancellationFee: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 1,
|
|
68
|
+
},
|
|
69
|
+
commissionCharge: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: 25,
|
|
72
|
+
},
|
|
73
|
+
notShowTimeLimit: { // In seconds
|
|
74
|
+
type: Number,
|
|
75
|
+
default: 10,
|
|
76
|
+
},
|
|
77
|
+
notShowCustomerCharge: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 0.50,
|
|
80
|
+
},
|
|
81
|
+
notShowDriverCommission: {
|
|
82
|
+
type: Number,
|
|
83
|
+
default: 0.50,
|
|
84
|
+
},
|
|
85
|
+
regionID: {
|
|
86
|
+
type: connection.base.Schema.ObjectId,
|
|
87
|
+
ref: "Region",
|
|
88
|
+
default: null,
|
|
89
|
+
index: true,
|
|
90
|
+
sparse: true,
|
|
91
|
+
},
|
|
92
|
+
superRegionID: {
|
|
93
|
+
type: connection.base.Schema.ObjectId,
|
|
94
|
+
ref: "SuperRegion",
|
|
95
|
+
default: null,
|
|
96
|
+
index: true,
|
|
97
|
+
sparse: true,
|
|
98
|
+
},
|
|
99
|
+
kmRanges: [KmRangeSchema(connection)],
|
|
100
|
+
rainCharge: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 0,
|
|
103
|
+
min: 0,
|
|
104
|
+
},
|
|
105
|
+
rushHourIncreaseType: {
|
|
106
|
+
type: String,
|
|
107
|
+
enum: _.values(RUSH_HOUR_INCREASE_TYPES),
|
|
108
|
+
},
|
|
109
|
+
rushHourIncreaseCoefficient: {
|
|
110
|
+
type: Number,
|
|
111
|
+
default: 0,
|
|
112
|
+
min: 0,
|
|
113
|
+
},
|
|
114
|
+
rushHourIncrementAmount: {
|
|
115
|
+
type: Number,
|
|
116
|
+
default: 0,
|
|
117
|
+
min: 0,
|
|
118
|
+
},
|
|
119
|
+
}, { _id: false });
|
|
120
|
+
|
|
121
|
+
return FareSettingsSchema;
|
|
122
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @param {import("mongoose")} connection */
|
|
2
|
+
module.exports = (connection) => {
|
|
3
|
+
const FraudBookingSchema = new connection.base.Schema({
|
|
4
|
+
bookingID: {
|
|
5
|
+
type: connection.base.Schema.ObjectId,
|
|
6
|
+
ref: "Bookings",
|
|
7
|
+
index: true,
|
|
8
|
+
},
|
|
9
|
+
registeredBy: {
|
|
10
|
+
type: connection.base.Schema.ObjectId,
|
|
11
|
+
ref: "User",
|
|
12
|
+
index: true,
|
|
13
|
+
sparse: true,
|
|
14
|
+
},
|
|
15
|
+
reasons: [{
|
|
16
|
+
type: String,
|
|
17
|
+
}],
|
|
18
|
+
}, { timestamps: true });
|
|
19
|
+
|
|
20
|
+
return FraudBookingSchema;
|
|
21
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @param {import("mongoose")} connection */
|
|
2
|
+
module.exports = (connection) => {
|
|
3
|
+
const CounterSchema = new connection.base.Schema({
|
|
4
|
+
model: { type: String, required: true, index: true },
|
|
5
|
+
field: { type: String, required: true },
|
|
6
|
+
count: { type: Number, default: 0 },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
return CounterSchema;
|
|
10
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
/** @param {import("mongoose")} connection */
|
|
3
|
+
module.exports = (connection) => {
|
|
4
|
+
// #region Internal Schemas
|
|
5
|
+
const KmRangeSchema = new connection.base.Schema({
|
|
6
|
+
min: {
|
|
7
|
+
type: Number,
|
|
8
|
+
min: 0,
|
|
9
|
+
max: 1000,
|
|
10
|
+
default: 0,
|
|
11
|
+
},
|
|
12
|
+
max: {
|
|
13
|
+
type: Number,
|
|
14
|
+
min: 0,
|
|
15
|
+
max: 1000,
|
|
16
|
+
default: 100,
|
|
17
|
+
},
|
|
18
|
+
amount: {
|
|
19
|
+
type: Number,
|
|
20
|
+
min: 0,
|
|
21
|
+
max: 1000,
|
|
22
|
+
default: 0,
|
|
23
|
+
},
|
|
24
|
+
}, { _id: false });
|
|
25
|
+
|
|
26
|
+
return KmRangeSchema;
|
|
27
|
+
};
|