playov2-js-utilities 0.4.3 → 0.4.5
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/README.md +28 -28
- package/index.js +4 -4
- package/lib/constants.js +20 -20
- package/lib/cron.js +43 -43
- package/lib/db/models/user.js +112 -112
- package/lib/db/mongo.js +2 -2
- package/lib/db_interface/mongo/index.js +7 -6
- package/lib/db_interface/mongo/schemas/activitySchemas/_activityIndex.js +11 -11
- package/lib/db_interface/mongo/schemas/activitySchemas/activityInsurance.js +17 -17
- package/lib/db_interface/mongo/schemas/activitySchemas/activityLocation.js +118 -118
- package/lib/db_interface/mongo/schemas/activitySchemas/activityQueryBlock.js +11 -11
- package/lib/db_interface/mongo/schemas/activitySchemas/activityView.js +13 -13
- package/lib/db_interface/mongo/schemas/activitySchemas/cronJobLog.js +12 -12
- package/lib/db_interface/mongo/schemas/activitySchemas/playogame.request.js +37 -37
- package/lib/db_interface/mongo/schemas/activitySchemas/postActivity.js +51 -51
- package/lib/db_interface/mongo/schemas/activitySchemas/scheduled.tasks.js +52 -52
- package/lib/db_interface/mongo/schemas/activitySchemas/userActivity.js +151 -151
- package/lib/db_interface/mongo/schemas/gamebookSchemas/_gamebookIndex.js +2 -2
- package/lib/db_interface/mongo/schemas/gamebookSchemas/activityNotes.js +19 -19
- package/lib/db_interface/mongo/schemas/gamebookSchemas/expense.js +36 -36
- package/lib/db_interface/mongo/schemas/gamebookSchemas/expenseLogs.js +13 -13
- package/lib/db_interface/mongo/schemas/gamebookSchemas/message.requests.js +29 -29
- package/lib/db_interface/mongo/schemas/gamebookSchemas/nonPlayoExpenseUsers.js +14 -14
- package/lib/db_interface/mongo/schemas/gamebookSchemas/playpals.js +69 -69
- package/lib/db_interface/mongo/schemas/gamebookSchemas/postActivity.js +51 -51
- package/lib/db_interface/mongo/schemas/gamebookSchemas/tags.js +12 -12
- package/lib/db_interface/mongo/schemas/groupSchemas/_groupIndex.js +5 -5
- package/lib/db_interface/mongo/schemas/groupSchemas/group.js +60 -60
- package/lib/db_interface/mongo/schemas/groupSchemas/groupMember.js +23 -23
- package/lib/db_interface/mongo/schemas/groupSchemas/groupMessage.js +28 -28
- package/lib/db_interface/mongo/schemas/groupSchemas/groupReport.js +14 -14
- package/lib/db_interface/mongo/schemas/jerseySchemas/_jerseyIndex.js +3 -0
- package/lib/db_interface/mongo/schemas/jerseySchemas/jerseyInventory.js +59 -0
- package/lib/db_interface/mongo/schemas/userSchemas/QuickActions.js +25 -25
- package/lib/db_interface/mongo/schemas/userSchemas/_userIndex.js +31 -31
- package/lib/db_interface/mongo/schemas/userSchemas/blockedUser.js +11 -11
- package/lib/db_interface/mongo/schemas/userSchemas/city.js +67 -67
- package/lib/db_interface/mongo/schemas/userSchemas/country.js +63 -63
- package/lib/db_interface/mongo/schemas/userSchemas/emailOtp.js +12 -12
- package/lib/db_interface/mongo/schemas/userSchemas/emailVerificationToken.js +11 -11
- package/lib/db_interface/mongo/schemas/userSchemas/gt.trial.games.js +24 -24
- package/lib/db_interface/mongo/schemas/userSchemas/invite.js +14 -14
- package/lib/db_interface/mongo/schemas/userSchemas/karmaConfig.js +11 -11
- package/lib/db_interface/mongo/schemas/userSchemas/karmaLog.js +28 -28
- package/lib/db_interface/mongo/schemas/userSchemas/leaderboard.js +25 -25
- package/lib/db_interface/mongo/schemas/userSchemas/passwordResetToken.js +11 -11
- package/lib/db_interface/mongo/schemas/userSchemas/playo.subscription.pack.js +65 -65
- package/lib/db_interface/mongo/schemas/userSchemas/rankings.js +16 -16
- package/lib/db_interface/mongo/schemas/userSchemas/sports.js +26 -26
- package/lib/db_interface/mongo/schemas/userSchemas/sportsCategory.js +11 -11
- package/lib/db_interface/mongo/schemas/userSchemas/tempUser.js +35 -35
- package/lib/db_interface/mongo/schemas/userSchemas/trendingSports.js +14 -14
- package/lib/db_interface/mongo/schemas/userSchemas/user.activity.health.kit.data.js +25 -25
- package/lib/db_interface/mongo/schemas/userSchemas/user.js +111 -111
- package/lib/db_interface/mongo/schemas/userSchemas/userAlerts.js +23 -23
- package/lib/db_interface/mongo/schemas/userSchemas/userContacts.js +29 -29
- package/lib/db_interface/mongo/schemas/userSchemas/userCredentials.js +49 -49
- package/lib/db_interface/mongo/schemas/userSchemas/userFavourites.js +81 -81
- package/lib/db_interface/mongo/schemas/userSchemas/userOtp.js +9 -9
- package/lib/db_interface/mongo/schemas/userSchemas/userReputation.js +21 -21
- package/lib/db_interface/mongo/schemas/userSchemas/userSocial.js +17 -17
- package/lib/db_interface/mongo/schemas/userSchemas/year.in.playo.js +51 -51
- package/lib/db_interface/mongo/schemas/userSchemas/yearInPlayoStats.js +35 -35
- package/lib/db_interface/mongo/schemas/venueSchemas/_venueIndex.js +3 -3
- package/lib/db_interface/mongo/schemas/venueSchemas/ameneties.js +9 -9
- package/lib/db_interface/mongo/schemas/venueSchemas/cityArea.js +45 -45
- package/lib/db_interface/mongo/schemas/venueSchemas/clubConstraints.js +17 -17
- package/lib/db_interface/mongo/schemas/venueSchemas/corporateOffer.js +17 -17
- package/lib/db_interface/mongo/schemas/venueSchemas/couponOffers.js +39 -39
- package/lib/db_interface/mongo/schemas/venueSchemas/gamebagMember.js +11 -11
- package/lib/db_interface/mongo/schemas/venueSchemas/offer.js +48 -48
- package/lib/db_interface/mongo/schemas/venueSchemas/thirdParty.js +12 -12
- package/lib/db_interface/mongo/schemas/venueSchemas/venue.js +136 -136
- package/lib/db_interface/mongo/schemas/venueSchemas/venueEnquires.js +22 -22
- package/lib/db_interface/mongo/schemas/venueSchemas/venueMembers.js +14 -14
- package/lib/db_interface/mongo/schemas/venueSchemas/venueRating.js +18 -18
- package/lib/index.js +22 -22
- package/lib/logger.js +115 -115
- package/lib/message_publisher/index.js +144 -144
- package/lib/middleware.js +46 -46
- package/lib/notification-templates.js +254 -254
- package/lib/notification.config.js +476 -476
- package/lib/playo.utils/playo.error.handler.js +23 -23
- package/lib/playo.utils/playo.http.handler.js +162 -162
- package/lib/playo.utils/playo.res.generator.js +58 -58
- package/lib/profanityFilter/profanityFilter.js +16 -15
- package/lib/profanityFilter/profanityWords.js +2 -2
- package/lib/ratings/index.js +95 -95
- package/lib/request.js +135 -135
- package/lib/responseHandler/responseHandler.js +52 -52
- package/lib/util.js +151 -151
- package/package.json +37 -36
- package/run.js +13 -0
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# README #
|
|
2
|
-
|
|
3
|
-
This README would normally document whatever steps are necessary to get your application up and running.
|
|
4
|
-
|
|
5
|
-
### What is this repository for? ###
|
|
6
|
-
|
|
7
|
-
* Quick summary
|
|
8
|
-
* Version
|
|
9
|
-
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
|
10
|
-
|
|
11
|
-
### How do I get set up? ###
|
|
12
|
-
|
|
13
|
-
* Summary of set up
|
|
14
|
-
* Configuration
|
|
15
|
-
* Dependencies
|
|
16
|
-
* Database configuration
|
|
17
|
-
* How to run tests
|
|
18
|
-
* Deployment instructions
|
|
19
|
-
|
|
20
|
-
### Contribution guidelines ###
|
|
21
|
-
|
|
22
|
-
* Writing tests
|
|
23
|
-
* Code review
|
|
24
|
-
* Other guidelines
|
|
25
|
-
|
|
26
|
-
### Who do I talk to? ###
|
|
27
|
-
|
|
28
|
-
* Repo owner or admin
|
|
1
|
+
# README #
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get your application up and running.
|
|
4
|
+
|
|
5
|
+
### What is this repository for? ###
|
|
6
|
+
|
|
7
|
+
* Quick summary
|
|
8
|
+
* Version
|
|
9
|
+
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
|
10
|
+
|
|
11
|
+
### How do I get set up? ###
|
|
12
|
+
|
|
13
|
+
* Summary of set up
|
|
14
|
+
* Configuration
|
|
15
|
+
* Dependencies
|
|
16
|
+
* Database configuration
|
|
17
|
+
* How to run tests
|
|
18
|
+
* Deployment instructions
|
|
19
|
+
|
|
20
|
+
### Contribution guidelines ###
|
|
21
|
+
|
|
22
|
+
* Writing tests
|
|
23
|
+
* Code review
|
|
24
|
+
* Other guidelines
|
|
25
|
+
|
|
26
|
+
### Who do I talk to? ###
|
|
27
|
+
|
|
28
|
+
* Repo owner or admin
|
|
29
29
|
* Other community or team contact
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// This will expose all the functionalities as a common interface
|
|
2
|
-
// Todo - Type definitions
|
|
3
|
-
|
|
4
|
-
module.exports = require('./lib');
|
|
1
|
+
// This will expose all the functionalities as a common interface
|
|
2
|
+
// Todo - Type definitions
|
|
3
|
+
|
|
4
|
+
module.exports = require('./lib');
|
package/lib/constants.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
const USER_INDIVIDUAL_RATINGS = Object.freeze({
|
|
3
|
-
1: "Beginner",
|
|
4
|
-
2: "Amateur",
|
|
5
|
-
3: "Intermediate",
|
|
6
|
-
4: "Advanced",
|
|
7
|
-
5: "professional"
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const RATINGS_WEIGHTAGE = Object.freeze({
|
|
11
|
-
'new': 0.9,
|
|
12
|
-
'old': 0.1
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const DEFAULT_TIME_ZONE = 'Asia/Kolkata';
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
USER_INDIVIDUAL_RATINGS,
|
|
19
|
-
RATINGS_WEIGHTAGE,
|
|
20
|
-
DEFAULT_TIME_ZONE
|
|
1
|
+
|
|
2
|
+
const USER_INDIVIDUAL_RATINGS = Object.freeze({
|
|
3
|
+
1: "Beginner",
|
|
4
|
+
2: "Amateur",
|
|
5
|
+
3: "Intermediate",
|
|
6
|
+
4: "Advanced",
|
|
7
|
+
5: "professional"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const RATINGS_WEIGHTAGE = Object.freeze({
|
|
11
|
+
'new': 0.9,
|
|
12
|
+
'old': 0.1
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const DEFAULT_TIME_ZONE = 'Asia/Kolkata';
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
USER_INDIVIDUAL_RATINGS,
|
|
19
|
+
RATINGS_WEIGHTAGE,
|
|
20
|
+
DEFAULT_TIME_ZONE
|
|
21
21
|
}
|
package/lib/cron.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file will have all cron related utilities - (e.g. - schedulers etc.).
|
|
3
|
-
* Try to contain service common utilities here.
|
|
4
|
-
*/
|
|
5
|
-
const Constants = require('./constants');
|
|
6
|
-
const { CronJob } = require('cron');
|
|
7
|
-
const Utils = require('./util')
|
|
8
|
-
|
|
9
|
-
const cronner = (
|
|
10
|
-
cronTime,
|
|
11
|
-
onTime = Utils.noop,
|
|
12
|
-
onComplete = Utils.noop,
|
|
13
|
-
timeZone = Constants.DEFAULT_TIME_ZONE,
|
|
14
|
-
context = this,
|
|
15
|
-
runOnInit,
|
|
16
|
-
utcOffset,
|
|
17
|
-
) => {
|
|
18
|
-
const job = new CronJob({
|
|
19
|
-
cronTime,
|
|
20
|
-
// when the time specified by pattern is matched
|
|
21
|
-
onTick: onTime,
|
|
22
|
-
// onComplete
|
|
23
|
-
onComplete,
|
|
24
|
-
// whether the cron should start on constructor invoke (or whether .start() needs to be called)
|
|
25
|
-
start: false,
|
|
26
|
-
// timezone -> defaults to Asia/Kolkata
|
|
27
|
-
timeZone,
|
|
28
|
-
// the context to bind the onTime method to
|
|
29
|
-
context,
|
|
30
|
-
// flat to start cron on invocation of the module
|
|
31
|
-
runOnInit,
|
|
32
|
-
// the utc offset to run the cron at
|
|
33
|
-
utcOffset
|
|
34
|
-
});
|
|
35
|
-
job.start();
|
|
36
|
-
return job;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
module.exports = {
|
|
40
|
-
cronner
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file will have all cron related utilities - (e.g. - schedulers etc.).
|
|
3
|
+
* Try to contain service common utilities here.
|
|
4
|
+
*/
|
|
5
|
+
const Constants = require('./constants');
|
|
6
|
+
const { CronJob } = require('cron');
|
|
7
|
+
const Utils = require('./util')
|
|
8
|
+
|
|
9
|
+
const cronner = (
|
|
10
|
+
cronTime,
|
|
11
|
+
onTime = Utils.noop,
|
|
12
|
+
onComplete = Utils.noop,
|
|
13
|
+
timeZone = Constants.DEFAULT_TIME_ZONE,
|
|
14
|
+
context = this,
|
|
15
|
+
runOnInit,
|
|
16
|
+
utcOffset,
|
|
17
|
+
) => {
|
|
18
|
+
const job = new CronJob({
|
|
19
|
+
cronTime,
|
|
20
|
+
// when the time specified by pattern is matched
|
|
21
|
+
onTick: onTime,
|
|
22
|
+
// onComplete
|
|
23
|
+
onComplete,
|
|
24
|
+
// whether the cron should start on constructor invoke (or whether .start() needs to be called)
|
|
25
|
+
start: false,
|
|
26
|
+
// timezone -> defaults to Asia/Kolkata
|
|
27
|
+
timeZone,
|
|
28
|
+
// the context to bind the onTime method to
|
|
29
|
+
context,
|
|
30
|
+
// flat to start cron on invocation of the module
|
|
31
|
+
runOnInit,
|
|
32
|
+
// the utc offset to run the cron at
|
|
33
|
+
utcOffset
|
|
34
|
+
});
|
|
35
|
+
job.start();
|
|
36
|
+
return job;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
cronner
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
package/lib/db/models/user.js
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const Schema = mongoose.Schema;
|
|
3
|
-
|
|
4
|
-
const userSchema = new Schema({
|
|
5
|
-
id: { type: String, required: true, unique: true },
|
|
6
|
-
fName: { type: String, default: "" },
|
|
7
|
-
lName: { type: String, default: "" },
|
|
8
|
-
userName: {type: String, default: ""},
|
|
9
|
-
email: { type: String, primary: true, default: "" },
|
|
10
|
-
officialEmail: { type: String, required: false },
|
|
11
|
-
mobile: { type: String, default: "" },
|
|
12
|
-
oldPlayoId: { type: String, default: "" },
|
|
13
|
-
lastActiveAreaName: { type: String, default: "" },
|
|
14
|
-
active: { type: Date, default: Date.now },
|
|
15
|
-
phoneCountryCode: { type: String, default: "" },
|
|
16
|
-
countryCode: { type: String, default: "" },
|
|
17
|
-
cityCode: { type: Number, default: 1 },
|
|
18
|
-
profilePicUrl: { type: String, default: "" },
|
|
19
|
-
gender: { type: Number, default: 2, min: 0, max: 3 }, // 0-female , 1-male, 2-does not matter;3-others
|
|
20
|
-
karma: { type: Number, default: 0 },
|
|
21
|
-
karmaRedeem: { type: Number, default: 0 },
|
|
22
|
-
city: { type: String, default: "" },
|
|
23
|
-
geoLocation: {
|
|
24
|
-
type: { type: String, enum: ['Point'], default: 'Point' },
|
|
25
|
-
coordinates: {
|
|
26
|
-
type : [Number], default: [0, 0]
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
geoLocationCity: {
|
|
30
|
-
type: { type: String },
|
|
31
|
-
coordinates: []
|
|
32
|
-
},
|
|
33
|
-
bio: { type: String, default: "" },
|
|
34
|
-
palsCount: Number,
|
|
35
|
-
emailVerified: { type: Boolean, default: false },
|
|
36
|
-
officialEmailVerified: { type: Boolean, default: false },
|
|
37
|
-
verified: { type: Boolean, default: false },
|
|
38
|
-
reportCount: Number,
|
|
39
|
-
superUser: { type: Boolean, default: false },
|
|
40
|
-
venueId: { type: String, default: "" },
|
|
41
|
-
rules: { type: String, default: "" },
|
|
42
|
-
messages: [ // for notifications
|
|
43
|
-
{
|
|
44
|
-
key: String,
|
|
45
|
-
value: String
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
isOnApplozic: { type: Boolean, default: false },
|
|
49
|
-
lastPlayed: { type: Date, default: null },
|
|
50
|
-
helpTS: { type: Date, default: Date.now },
|
|
51
|
-
deviceType: { type: Number, default: -1 }, //11-ios, 0-android - 11 is correct for ios
|
|
52
|
-
deviceModel: { type: String, default: "" },
|
|
53
|
-
gcmRegId: [],
|
|
54
|
-
iosRegId: [],
|
|
55
|
-
iosBadge: { type: Number, default: 0 },
|
|
56
|
-
version: { type: Number, default: 0 },
|
|
57
|
-
onesignalId: [],
|
|
58
|
-
shareLink: { type: String, default: "" },
|
|
59
|
-
deferLink: { type: String, default: "" },
|
|
60
|
-
chatStatus: { type: Number, default: 0 },
|
|
61
|
-
fullLink: { type: String, default: "" },
|
|
62
|
-
referralLink: { type: String, default: null },
|
|
63
|
-
lastResetOn: { type: Date, default: null },
|
|
64
|
-
oldEmail: { type: String, default: "" },
|
|
65
|
-
oldMobile: { type: String, default: "" },
|
|
66
|
-
publicActivityLimit: { type: Number, default: 5 },
|
|
67
|
-
placeId: { type: String },
|
|
68
|
-
paytmOpenId: { type: String },
|
|
69
|
-
paidHostName: { type: String, default: "" },
|
|
70
|
-
paidHostCity: { type: String, default: "" },
|
|
71
|
-
activityHistory: [
|
|
72
|
-
{
|
|
73
|
-
_id: false,
|
|
74
|
-
activityId: { type: String, unique: true },
|
|
75
|
-
activityTS: Date
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
lastProcessed: Date,
|
|
79
|
-
calendarLink: { type: String, default: "" },
|
|
80
|
-
activityStack: Boolean, // config which informs whether user's activities are to be stacked
|
|
81
|
-
extraFields: [{
|
|
82
|
-
_id: false,
|
|
83
|
-
id: { type: String, required: true },
|
|
84
|
-
value: { type: String, required: true }
|
|
85
|
-
}],
|
|
86
|
-
lastContactSyncedAt : {
|
|
87
|
-
type: Date,
|
|
88
|
-
default: null
|
|
89
|
-
},
|
|
90
|
-
onboardSource: {
|
|
91
|
-
type: String,
|
|
92
|
-
enum: ['web', 'android', 'ios', 'others'],
|
|
93
|
-
default: 'others'
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
timestamps: {
|
|
98
|
-
createdAt: 'createdTS',
|
|
99
|
-
updatedAt: 'modTS'
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
userSchema.index({ 'onesignalId': 1 }, { 'background': true })
|
|
104
|
-
userSchema.index({ 'mobile': 1 })
|
|
105
|
-
userSchema.index({ 'email': 1 }, { collation: { locale: "en", strength: 2 } }) // case insensitive index
|
|
106
|
-
userSchema.index({ 'officialEmail': 1 }, { collation: { locale: "en", strength: 2 } }) // case insensitive index
|
|
107
|
-
|
|
108
|
-
userSchema.index({ 'oldPlayoId': 1 })
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const User = mongoose.model('User', userSchema);
|
|
112
|
-
module.exports = User;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
const userSchema = new Schema({
|
|
5
|
+
id: { type: String, required: true, unique: true },
|
|
6
|
+
fName: { type: String, default: "" },
|
|
7
|
+
lName: { type: String, default: "" },
|
|
8
|
+
userName: {type: String, default: ""},
|
|
9
|
+
email: { type: String, primary: true, default: "" },
|
|
10
|
+
officialEmail: { type: String, required: false },
|
|
11
|
+
mobile: { type: String, default: "" },
|
|
12
|
+
oldPlayoId: { type: String, default: "" },
|
|
13
|
+
lastActiveAreaName: { type: String, default: "" },
|
|
14
|
+
active: { type: Date, default: Date.now },
|
|
15
|
+
phoneCountryCode: { type: String, default: "" },
|
|
16
|
+
countryCode: { type: String, default: "" },
|
|
17
|
+
cityCode: { type: Number, default: 1 },
|
|
18
|
+
profilePicUrl: { type: String, default: "" },
|
|
19
|
+
gender: { type: Number, default: 2, min: 0, max: 3 }, // 0-female , 1-male, 2-does not matter;3-others
|
|
20
|
+
karma: { type: Number, default: 0 },
|
|
21
|
+
karmaRedeem: { type: Number, default: 0 },
|
|
22
|
+
city: { type: String, default: "" },
|
|
23
|
+
geoLocation: {
|
|
24
|
+
type: { type: String, enum: ['Point'], default: 'Point' },
|
|
25
|
+
coordinates: {
|
|
26
|
+
type : [Number], default: [0, 0]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
geoLocationCity: {
|
|
30
|
+
type: { type: String },
|
|
31
|
+
coordinates: []
|
|
32
|
+
},
|
|
33
|
+
bio: { type: String, default: "" },
|
|
34
|
+
palsCount: Number,
|
|
35
|
+
emailVerified: { type: Boolean, default: false },
|
|
36
|
+
officialEmailVerified: { type: Boolean, default: false },
|
|
37
|
+
verified: { type: Boolean, default: false },
|
|
38
|
+
reportCount: Number,
|
|
39
|
+
superUser: { type: Boolean, default: false },
|
|
40
|
+
venueId: { type: String, default: "" },
|
|
41
|
+
rules: { type: String, default: "" },
|
|
42
|
+
messages: [ // for notifications
|
|
43
|
+
{
|
|
44
|
+
key: String,
|
|
45
|
+
value: String
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
isOnApplozic: { type: Boolean, default: false },
|
|
49
|
+
lastPlayed: { type: Date, default: null },
|
|
50
|
+
helpTS: { type: Date, default: Date.now },
|
|
51
|
+
deviceType: { type: Number, default: -1 }, //11-ios, 0-android - 11 is correct for ios
|
|
52
|
+
deviceModel: { type: String, default: "" },
|
|
53
|
+
gcmRegId: [],
|
|
54
|
+
iosRegId: [],
|
|
55
|
+
iosBadge: { type: Number, default: 0 },
|
|
56
|
+
version: { type: Number, default: 0 },
|
|
57
|
+
onesignalId: [],
|
|
58
|
+
shareLink: { type: String, default: "" },
|
|
59
|
+
deferLink: { type: String, default: "" },
|
|
60
|
+
chatStatus: { type: Number, default: 0 },
|
|
61
|
+
fullLink: { type: String, default: "" },
|
|
62
|
+
referralLink: { type: String, default: null },
|
|
63
|
+
lastResetOn: { type: Date, default: null },
|
|
64
|
+
oldEmail: { type: String, default: "" },
|
|
65
|
+
oldMobile: { type: String, default: "" },
|
|
66
|
+
publicActivityLimit: { type: Number, default: 5 },
|
|
67
|
+
placeId: { type: String },
|
|
68
|
+
paytmOpenId: { type: String },
|
|
69
|
+
paidHostName: { type: String, default: "" },
|
|
70
|
+
paidHostCity: { type: String, default: "" },
|
|
71
|
+
activityHistory: [
|
|
72
|
+
{
|
|
73
|
+
_id: false,
|
|
74
|
+
activityId: { type: String, unique: true },
|
|
75
|
+
activityTS: Date
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
lastProcessed: Date,
|
|
79
|
+
calendarLink: { type: String, default: "" },
|
|
80
|
+
activityStack: Boolean, // config which informs whether user's activities are to be stacked
|
|
81
|
+
extraFields: [{
|
|
82
|
+
_id: false,
|
|
83
|
+
id: { type: String, required: true },
|
|
84
|
+
value: { type: String, required: true }
|
|
85
|
+
}],
|
|
86
|
+
lastContactSyncedAt : {
|
|
87
|
+
type: Date,
|
|
88
|
+
default: null
|
|
89
|
+
},
|
|
90
|
+
onboardSource: {
|
|
91
|
+
type: String,
|
|
92
|
+
enum: ['web', 'android', 'ios', 'others'],
|
|
93
|
+
default: 'others'
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
timestamps: {
|
|
98
|
+
createdAt: 'createdTS',
|
|
99
|
+
updatedAt: 'modTS'
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
userSchema.index({ 'onesignalId': 1 }, { 'background': true })
|
|
104
|
+
userSchema.index({ 'mobile': 1 })
|
|
105
|
+
userSchema.index({ 'email': 1 }, { collation: { locale: "en", strength: 2 } }) // case insensitive index
|
|
106
|
+
userSchema.index({ 'officialEmail': 1 }, { collation: { locale: "en", strength: 2 } }) // case insensitive index
|
|
107
|
+
|
|
108
|
+
userSchema.index({ 'oldPlayoId': 1 })
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const User = mongoose.model('User', userSchema);
|
|
112
|
+
module.exports = User;
|
package/lib/db/mongo.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
USER_SCHEMA : require("./models/user")
|
|
1
|
+
module.exports = {
|
|
2
|
+
USER_SCHEMA : require("./models/user")
|
|
3
3
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
USER_MODELS: require('./schemas/userSchemas/_userIndex.js'),
|
|
3
|
-
ACTIVITY_MODELS: require('./schemas/activitySchemas/_activityIndex.js'),
|
|
4
|
-
VENUE_MODELS: require('./schemas/venueSchemas/_venueIndex.js'),
|
|
5
|
-
GAMEBOOK_MODELS: require('./schemas/gamebookSchemas/_gamebookIndex.js'),
|
|
6
|
-
GROUP_MODELS:require('./schemas/groupSchemas/_groupIndex.js')
|
|
1
|
+
module.exports = {
|
|
2
|
+
USER_MODELS: require('./schemas/userSchemas/_userIndex.js'),
|
|
3
|
+
ACTIVITY_MODELS: require('./schemas/activitySchemas/_activityIndex.js'),
|
|
4
|
+
VENUE_MODELS: require('./schemas/venueSchemas/_venueIndex.js'),
|
|
5
|
+
GAMEBOOK_MODELS: require('./schemas/gamebookSchemas/_gamebookIndex.js'),
|
|
6
|
+
GROUP_MODELS:require('./schemas/groupSchemas/_groupIndex.js'),
|
|
7
|
+
JERSEY_MODELS: require('./schemas/jerseySchemas/_jerseyIndex.js'),
|
|
7
8
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
userActivities: require('./userActivity.js'),
|
|
3
|
-
activityInsurance: require('./activityInsurance.js'),
|
|
4
|
-
activityLocations: require('./activityLocation.js'),
|
|
5
|
-
activityViews: require('./activityView.js'),
|
|
6
|
-
cronJobLogs: require('./cronJobLog.js'),
|
|
7
|
-
activityQueryBlocks: require('./activityQueryBlock.js'),
|
|
8
|
-
activityInsurances: require('./activityInsurance.js'),
|
|
9
|
-
playoGameRequests: require('./playogame.request.js'),
|
|
10
|
-
schedularTasks: require('./scheduled.tasks'),
|
|
11
|
-
postActivities: require('./postActivity.js')
|
|
1
|
+
module.exports = {
|
|
2
|
+
userActivities: require('./userActivity.js'),
|
|
3
|
+
activityInsurance: require('./activityInsurance.js'),
|
|
4
|
+
activityLocations: require('./activityLocation.js'),
|
|
5
|
+
activityViews: require('./activityView.js'),
|
|
6
|
+
cronJobLogs: require('./cronJobLog.js'),
|
|
7
|
+
activityQueryBlocks: require('./activityQueryBlock.js'),
|
|
8
|
+
activityInsurances: require('./activityInsurance.js'),
|
|
9
|
+
playoGameRequests: require('./playogame.request.js'),
|
|
10
|
+
schedularTasks: require('./scheduled.tasks'),
|
|
11
|
+
postActivities: require('./postActivity.js')
|
|
12
12
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var mongoose = require('mongoose');
|
|
2
|
-
var Schema = mongoose.Schema;
|
|
3
|
-
|
|
4
|
-
var InsuranceSchema = new Schema({
|
|
5
|
-
isEnabled: { type: Boolean, default: false },
|
|
6
|
-
insuranceFee: { type: Number, default: 9 },
|
|
7
|
-
insuranceDefault: {
|
|
8
|
-
startDate: { type: Date, required: true },
|
|
9
|
-
endDate: { type: Date, required: true },
|
|
10
|
-
fee: { type: Number, default: 0 }
|
|
11
|
-
},
|
|
12
|
-
insuranceInfo: { type: String, required: true },
|
|
13
|
-
freeInsuranceInfo: { type: String, required: true },
|
|
14
|
-
countryCode: { type: String, default: '+91' }
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
module.exports = mongoose.model('activityInsurance', InsuranceSchema);
|
|
1
|
+
var mongoose = require('mongoose');
|
|
2
|
+
var Schema = mongoose.Schema;
|
|
3
|
+
|
|
4
|
+
var InsuranceSchema = new Schema({
|
|
5
|
+
isEnabled: { type: Boolean, default: false },
|
|
6
|
+
insuranceFee: { type: Number, default: 9 },
|
|
7
|
+
insuranceDefault: {
|
|
8
|
+
startDate: { type: Date, required: true },
|
|
9
|
+
endDate: { type: Date, required: true },
|
|
10
|
+
fee: { type: Number, default: 0 }
|
|
11
|
+
},
|
|
12
|
+
insuranceInfo: { type: String, required: true },
|
|
13
|
+
freeInsuranceInfo: { type: String, required: true },
|
|
14
|
+
countryCode: { type: String, default: '+91' }
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
module.exports = mongoose.model('activityInsurance', InsuranceSchema);
|