playov2-js-utilities 0.3.60 → 0.3.62

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.
Files changed (41) hide show
  1. package/lib/db_interface/monog/index.js +4 -0
  2. package/lib/db_interface/monog/schemas/activitySchemas/_activityIndex.js +5 -0
  3. package/lib/db_interface/monog/schemas/activitySchemas/activityInsurance.js +17 -0
  4. package/lib/db_interface/monog/schemas/activitySchemas/activityLocation.js +105 -0
  5. package/lib/db_interface/monog/schemas/activitySchemas/activityQueryBlock.js +12 -0
  6. package/lib/db_interface/monog/schemas/activitySchemas/activityView.js +14 -0
  7. package/lib/db_interface/monog/schemas/activitySchemas/cronJobLog.js +13 -0
  8. package/lib/db_interface/monog/schemas/activitySchemas/playogame.request.js +38 -0
  9. package/lib/db_interface/monog/schemas/activitySchemas/scheduled.tasks.js +53 -0
  10. package/lib/db_interface/monog/schemas/activitySchemas/userActivity.js +134 -0
  11. package/lib/db_interface/monog/schemas/userSchemas/QuickActions.js +26 -0
  12. package/lib/db_interface/monog/schemas/userSchemas/_userIndex.js +8 -0
  13. package/lib/db_interface/monog/schemas/userSchemas/blockedUser.js +12 -0
  14. package/lib/db_interface/monog/schemas/userSchemas/city.js +62 -0
  15. package/lib/db_interface/monog/schemas/userSchemas/country.js +64 -0
  16. package/lib/db_interface/monog/schemas/userSchemas/emailOtp.js +13 -0
  17. package/lib/db_interface/monog/schemas/userSchemas/emailVerificationToken.js +12 -0
  18. package/lib/db_interface/monog/schemas/userSchemas/gt.trial.games.js +24 -0
  19. package/lib/db_interface/monog/schemas/userSchemas/invite.js +14 -0
  20. package/lib/db_interface/monog/schemas/userSchemas/karmaConfig.js +12 -0
  21. package/lib/db_interface/monog/schemas/userSchemas/karmaLog.js +29 -0
  22. package/lib/db_interface/monog/schemas/userSchemas/passwordResetToken.js +12 -0
  23. package/lib/db_interface/monog/schemas/userSchemas/playo.subscription.pack.js +67 -0
  24. package/lib/db_interface/monog/schemas/userSchemas/rankings.js +17 -0
  25. package/lib/db_interface/monog/schemas/userSchemas/sports.js +26 -0
  26. package/lib/db_interface/monog/schemas/userSchemas/sportsCategory.js +12 -0
  27. package/lib/db_interface/monog/schemas/userSchemas/tempUser.js +36 -0
  28. package/lib/db_interface/monog/schemas/userSchemas/trendingSports.js +14 -0
  29. package/lib/db_interface/monog/schemas/userSchemas/user.activity.health.kit.data.js +27 -0
  30. package/lib/db_interface/monog/schemas/userSchemas/user.contacts.js +34 -0
  31. package/lib/db_interface/monog/schemas/userSchemas/user.js +111 -0
  32. package/lib/db_interface/monog/schemas/userSchemas/userAlerts.js +24 -0
  33. package/lib/db_interface/monog/schemas/userSchemas/userCredentials.js +50 -0
  34. package/lib/db_interface/monog/schemas/userSchemas/userFavourites.js +81 -0
  35. package/lib/db_interface/monog/schemas/userSchemas/userOtp.js +10 -0
  36. package/lib/db_interface/monog/schemas/userSchemas/userReputation.js +22 -0
  37. package/lib/db_interface/monog/schemas/userSchemas/userSocial.js +18 -0
  38. package/lib/db_interface/monog/schemas/userSchemas/year.in.playo.js +52 -0
  39. package/lib/index.js +3 -0
  40. package/lib/playo.utils/playo.http.handler.js +14 -4
  41. package/package.json +3 -2
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ USER_MODELS: require('./userSchemas/_userIndex.js'),
3
+ ACTIVITY_MODELS: require('./activitySchemas/_activityIndex.js')
4
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ userActivity: require('./userActivity.js'),
3
+ activityInsurance: require('./activityInsurance.js'),
4
+ activityLocation: require('./activityLocation.js'),
5
+ }
@@ -0,0 +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);
@@ -0,0 +1,105 @@
1
+ const mongoose = require('mongoose')
2
+ const Schema = mongoose.Schema
3
+
4
+ const groupSchema = new Schema({
5
+ _id: false,
6
+ groupId: String,
7
+ modTS: Date
8
+ });
9
+
10
+ const activityLocationSchema = new Schema(
11
+ {
12
+ id: { required: true, type: String, unique: true },
13
+ geoLocation: {
14
+ type: { type: String },
15
+ coordinates: [Number],
16
+ },
17
+ date: Date,
18
+ timing: Number,
19
+ startTime: { type: Date, default: "" },
20
+ endTime: { type: Date, default: "" },
21
+ sportId: { required: true, type: String },
22
+ isOnline: { type: Boolean, default: false },
23
+ priority: { type: Number, default: 10 },
24
+ recommended: {type: Boolean, default: false},
25
+ sponsored: { type: Boolean, default: false },
26
+ geoHash: { type: String },
27
+ cityCode: { type: Number },
28
+ countryCode: { type: String, default: "" },
29
+ sponsoredRadius: { type: Number, default: null }, // if null, show across city radius or, show to people in spoecified sponsoredRadius
30
+ full: { type: Boolean, default: false },
31
+ activityType: { type: String, default: "regular" },
32
+ hostId: { type: String, required: true },
33
+ venueId: { default: "", type: String },
34
+ groupId: { type: String, default: "" },
35
+ booking: { type: Boolean, default: false },
36
+ type: { default: 0, type: Number }, // 0 - regular, 1 - pay and join
37
+ minSkill: { type: Number, default: 1, min: 1, max: 5 },// 1-5
38
+ maxSkill: { type: Number, default: 5, min: 1, max: 5 },
39
+ hostType: {
40
+ type: String,
41
+ enum: ['playo-game', 'regular'],
42
+ default: 'regular'
43
+ },
44
+ joinees: [{
45
+ _id: false,
46
+ userId: { type: String, required: true },
47
+ joineeMsg: { type: String, default: "" },
48
+ hostMsg: { type: String, default: "" },
49
+ timestamp: { type: Date, default: Date.now },
50
+ status: { type: Number, required: true, min: -1, max: 4 }, //-1 to 5 ;-1= Request/Revoke,0-Request Pending,1-Request/Accept,2-Request/Reject,3-Accept/Revoked,4-Invited/Pending,5-Invite/Revoke
51
+ ticketCount: { type: Number, default: 1 }, // no of tickets booked
52
+ sentBy: String,
53
+ rejectedBy: { type: String, default: "" }, // differentiate between host and cohost
54
+ muteNotifications: { type: Boolean, default: false },
55
+ amount: { type: Number, default: 0 },
56
+ refunded: { type: Boolean, default: 0 },
57
+ acceptTS: { type: Date, default: null }
58
+ }],
59
+ strictSkill: { type: Boolean, default: false },
60
+ sportsPlayingMode: {
61
+ _id: false,
62
+ name: { type: String, default: '' },
63
+ icon: { type: String, default: '' }
64
+ },
65
+ cohostId: { type: String, default: '' },
66
+ maxPlayers: { type: Number, default: -1 },
67
+ groups: [
68
+ groupSchema
69
+ ],
70
+ location: { type: String, required: true },
71
+ price: { type: Number, default: 0 },
72
+ bookingId: {type:String,default:""},
73
+ bookedBy: {type:String,default:""},//mongoId
74
+ skillSet: { type: Boolean, default: false },
75
+ createdTS: { type: Date, default: Date.now },
76
+ modTS: { type: Date, default: Date.now },
77
+ venueName: { default: "", type: String },
78
+ createdBy: { type: Number, default: 0 },// when booking happened app will create activity for that sport with different createdBy value
79
+ bookingType: { type: Number, default: 0 }, // 0- playo booking, 1-offline
80
+ courtInfo: { type: String, default: "" },
81
+ groupName: { type: String, default: "" },
82
+ currencyTxt: { type: String, default: "" },
83
+ // activityStack: {type: Boolean},
84
+ }
85
+ );
86
+
87
+ module.exports = mongoose.model("activityLocation", activityLocationSchema)
88
+ /*
89
+
90
+ GeoHash length Grid Area width x height
91
+
92
+ 1 ≤ 5,000km X 5,000 Km
93
+ 2 ≤ 1,250km X 625km
94
+ 3 ≤ 156km X 156km
95
+ 4 ≤ 39.1km X 19.5km
96
+ 5 ≤ 4.89km X 4.89km
97
+ 6 ≤ 1.22km X 0.61km
98
+ 7 ≤ 153m X 153m
99
+ 8 ≤ 38.2m X 19.1m
100
+ 9 ≤ 4.77m X 4.77m
101
+ 10 ≤ 1.19m X 0.596m
102
+ 11 ≤ 149mm X 149mm
103
+ 12 ≤ 37.2mm X 18.6mm
104
+
105
+ */
@@ -0,0 +1,12 @@
1
+ const Mongoose = require("mongoose")
2
+ const Schema = Mongoose.Schema
3
+
4
+ const activityQueryBlockSchema = new Schema(
5
+ {
6
+ userId: { type: String, required: true },
7
+ expiry: { type: Date, required: true }
8
+ }
9
+ )
10
+
11
+
12
+ module.exports = Mongoose.model("activityQueryBlock", activityQueryBlockSchema)
@@ -0,0 +1,14 @@
1
+ const Mongoose = require("mongoose")
2
+ const Schema = Mongoose.Schema
3
+
4
+ const activityViewSchema = new Schema(
5
+ {
6
+ userId: { type: String, required: true },
7
+ activityId: { type: String, required: true },
8
+ count: { type: Number, default: 0 },
9
+ createdTS: { type: Date, default: Date.now }
10
+ }
11
+ )
12
+
13
+
14
+ module.exports = Mongoose.model("activityView", activityViewSchema)
@@ -0,0 +1,13 @@
1
+ const MONGOOSE = require("mongoose")
2
+ const Schema = MONGOOSE.Schema
3
+
4
+ const cronJobLogSchema = new Schema(
5
+ {
6
+ id: String,
7
+ scheduledAt: Date,
8
+ type: { type: Number, min: 0, max: 1 }, // 0 - make activity past ; 1 - make activity expired
9
+ modTS: { type: Date, default: Date.now }
10
+ }
11
+ )
12
+
13
+ module.exports = MONGOOSE.model("cronjob", cronJobLogSchema)
@@ -0,0 +1,38 @@
1
+ const Mongoose = require("mongoose")
2
+
3
+ const PlayogameRequest = new Mongoose.Schema(
4
+ {
5
+ id: {
6
+ type: String,
7
+ required: true
8
+ },
9
+ userId: {
10
+ type: String,
11
+ required: true
12
+ },
13
+ areaId: {
14
+ type: String
15
+ },
16
+ sportId: {
17
+ type: String
18
+ },
19
+ venueId: {
20
+ type: String
21
+ },
22
+ createdTS: {
23
+ type: Date,
24
+ default: Date.now
25
+ },
26
+ message: {
27
+ type: String
28
+ },
29
+ date: {
30
+ type: Date
31
+ },
32
+ timingSlot: [
33
+ Number
34
+ ]
35
+ }
36
+ )
37
+
38
+ module.exports = Mongoose.model("playogamerequest", PlayogameRequest);
@@ -0,0 +1,53 @@
1
+ const mongoose = require('mongoose');
2
+ const Schema = mongoose.Schema;
3
+
4
+ // compound index on queueId and taskId and status, so that a task is saved only once per queue
5
+ const scheduledTaskSchema = new Schema({
6
+ taskId: { type: String, required: true },
7
+ queueId: { type: String, required: true },
8
+ ttl: {},
9
+ payload: {
10
+
11
+ },
12
+ activationTime: {
13
+ type: Date, required: true
14
+ },
15
+ cloudProvider: {
16
+ type: String,
17
+ enum: ['GCP', 'AWS'],
18
+ required: true
19
+ },
20
+ status: {
21
+ type: String,
22
+ enum: ['saved', 'executed', 'failed', 'cancelled'],
23
+ default: 'saved',
24
+ required: true
25
+ },
26
+ lastExecutionDetails: {
27
+
28
+ }
29
+ });
30
+
31
+
32
+ // Modelling explaination -
33
+ /**
34
+ * This model acts as an interface to schedule tasks and basically access this code -
35
+ *
36
+ * const messagePayload = {
37
+ httpMethod,
38
+ url,
39
+ headers,
40
+ body,
41
+ query,
42
+ oidcToken: {
43
+ 'serviceAccountEmail': TASK_QUEUE_SERVICE_ACCOUNT
44
+ }
45
+ };
46
+
47
+
48
+ return Publisher.createHttpTask(queueId, messagePayload, { delay }, taskId, requestId);
49
+
50
+ This also requires a compound index on following keys - {queueId, taskId, and status of the saved task}.
51
+ payload is kept to schemaless so as to accomodate further future changes,
52
+ */
53
+ module.exports = mongoose.model('scheduledtasks', scheduledTaskSchema);
@@ -0,0 +1,134 @@
1
+ const mongoose = require('mongoose')
2
+ const Schema = mongoose.Schema
3
+
4
+ const groupSchema = new Schema({
5
+ _id: false,
6
+ groupId: String,
7
+ modTS: Date
8
+ });
9
+
10
+ const UserActivitySchema = new Schema({
11
+ id: { type: String, required: true, unique: true },
12
+ oldPlayoId: { type: String, default: "" },
13
+ hostId: { type: String, required: true },
14
+ sportId: { type: String, required: true },
15
+ date: { type: Date, required: true },
16
+ timing: { type: Number, required: true },
17
+ cohostId: { type: String, default: '' },
18
+ maxPlayers: { type: Number, default: -1 },
19
+ cityCode: { type: Number },
20
+ countryCode: { type: String, default: "" },
21
+ groups: [
22
+ groupSchema
23
+ ],
24
+ joinees: [{
25
+ _id: false,
26
+ userId: { type: String, required: true },
27
+ joineeMsg: { type: String, default: "" },
28
+ hostMsg: { type: String, default: "" },
29
+ timestamp: { type: Date, default: Date.now },
30
+ status: { type: Number, required: true, min: -1, max: 4 }, //-1 to 5 ;-1= Request/Revoke,0-Request Pending,1-Request/Accept,2-Request/Reject,3-Accept/Revoked,4-Invited/Pending,5-Invite/Revoke
31
+ ticketCount: { type: Number, default: 1 }, // no of tickets booked
32
+ sentBy: String,
33
+ rejectedBy: { type: String, default: "" }, // differentiate between host and cohost
34
+ muteNotifications: { type: Boolean, default: false },
35
+ amount: { type: Number, default: 0 },
36
+ refunded: { type: Boolean, default: 0 },
37
+ acceptTS: { type: Date, default: null }
38
+ }],
39
+ queries: [{
40
+ _id: false,
41
+ messageId: String,
42
+ userId: String,
43
+ message: String,
44
+ isAnswered: { type: Boolean, default: false },
45
+ timestamp: Date,
46
+ answer: {
47
+ answerId: String,
48
+ answer: String,
49
+ userId: String,
50
+ timestamp: Date
51
+ }
52
+ }],
53
+ full: { type: Boolean, default: false },
54
+ geoLocation: {
55
+ type: { type: String },
56
+ coordinates: [Number],
57
+ },
58
+ location: { type: String, required: true },
59
+ gameInstructions: { type: String, default: '' },
60
+ gender: { type: Number, default: 2, min: 0, max: 2 }, //0-female 1-male 2-does not matter
61
+ price: { type: Number, default: 0 },
62
+ bookingId: String,
63
+ bookedBy: String,//mongoId
64
+ miscInfo: String,
65
+ shareLink: { type: String, default: "", },
66
+ deferLink: { type: String, default: "" },
67
+ fullLink: { type: String, default: "" },
68
+ startTime: { type: Date, default: null }, // hh:mm:ss
69
+ endTime: { type: Date, default: null }, //hh:mm:ss
70
+ isListed: { type: Boolean, default: true }, // 0-unlisted, 1-listed
71
+ minSkill: { type: Number, default: 1, min: 1, max: 5 },// 1-5
72
+ maxSkill: { type: Number, default: 5, min: 1, max: 5 }, // 1-5
73
+ skillSet: { type: Boolean, default: false },
74
+ booking: { type: Boolean, default: false },
75
+ type: { default: 0, type: Number }, // 0 - regular, 1 - pay and join
76
+ cancelled: { type: Boolean, default: false },
77
+ past: { type: Boolean, default: false },
78
+ createdTS: { type: Date, default: Date.now },
79
+ modTS: { type: Date, default: Date.now },
80
+ tags: [],
81
+ venueId: { default: "", type: String },
82
+ // groupModTS: { type: String, default: Date.now },
83
+ venueName: { default: "", type: String },
84
+ hostLastVisit: Date,
85
+ cohostLastVisit: Date,
86
+ createdBy: { type: Number, default: 0 },// when booking happened app will create activity for that sport with different createdBy value
87
+ bookingType: { type: Number, default: 0 }, // 0- playo booking, 1-offline
88
+ courtInfo: { type: String, default: "" },
89
+ bookedOn: { type: Date },
90
+ expired: { type: Boolean, default: false },
91
+ timeString: String, //For playo-v1 support,
92
+ notifiedBy: { type: Array, default: [] },
93
+ activityType: { type: String, default: "regular" }, // accepted values are regular,coaching,tournament
94
+ isOnline: { type: Boolean, default: false },
95
+ views: { type: Number, default: 0 },
96
+ groupId: { type: String, default: "" },
97
+ groupName: { type: String, default: "" },
98
+ superUser: { type: Boolean, default: false },
99
+ priority: { type: Number, default: 10 },
100
+ muteNotifications: { type: Boolean, default: false },
101
+ currencyTxt: { type: String, default: "" },
102
+ activityStack: Boolean,
103
+ sponsored: { type: Boolean, default: false },
104
+ joineeRules: [String],
105
+ strictSkill: { type: Boolean, default: false },
106
+ sportsPlayingMode: {
107
+ _id: false,
108
+ name: { type: String, default: '' },
109
+ icon: { type: String, default: '' }
110
+ },
111
+ addons: [{
112
+ _id: false,
113
+ userId: { type: String, required: true },
114
+ insurance: { type: Boolean, required: true }
115
+ }],
116
+ hostType: {
117
+ type: String,
118
+ enum: ['playo-game', 'regular'],
119
+ default: 'regular'
120
+ },
121
+ partialPayable: { type: Boolean, default: false },
122
+ payableAtVenue: { type: Number, default: 0 }
123
+
124
+ })
125
+
126
+ // UserActivitySchema.index({ "geoLocation": "2dsphere" })
127
+ // UserActivitySchema.index({ 'hostId': 1 })
128
+ // UserActivitySchema.index({ 'date': 1 }, { 'background': true })
129
+ // UserActivitySchema.index({ 'sportId': 1 })
130
+ // UserActivitySchema.index({ 'modTS': 1 }, { 'background': true })
131
+ // UserActivitySchema.index({ 'joinees.userId': 1, 'joinee.status': 1 }, { 'background': true })
132
+ // UserActivitySchema.index({ "groups.groupId": 1 }, { "background": true })
133
+
134
+ module.exports = mongoose.model('UserActivity', UserActivitySchema)
@@ -0,0 +1,26 @@
1
+ const mongoose = require("mongoose");
2
+ const { Schema } = mongoose;
3
+
4
+ const quickActionsSchema = new Schema(
5
+ {
6
+ actionDismissed: Boolean,
7
+ actionType: { type: String, default: "common" },
8
+ actionParameterId: String, //--> activity Id or relevant id
9
+ userId: String,
10
+ id: String, //--> cumulative data of (actionId + actionType ) => actionType_actionId
11
+ expired: { type: Boolean, default: false },
12
+ palIds: [{
13
+ type: String,
14
+ default: []
15
+ }]
16
+ },
17
+ { timestamps: { createdAt: 'createdTS', updatedAt: "modTS" } }
18
+ )
19
+
20
+ quickActionsSchema.index({ userId: 1 });
21
+ quickActionsSchema.index({ ActionId: 1 });
22
+ quickActionsSchema.index({id: 1});
23
+
24
+ const QuickActions = mongoose.model('QuickActions', quickActionsSchema);
25
+
26
+ module.exports = QuickActions;
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ user: require('./user.js'),
3
+ userFavorite: require("./userFavourites.js"),
4
+ sports: require("./sports.js"),
5
+ cities: require("./city.js"),
6
+ blockedUsers: require("./blockedUser.js"),
7
+ userReputation: require("./userReputation.js"),
8
+ }
@@ -0,0 +1,12 @@
1
+ const mongoose = require('mongoose')
2
+ const Schema = mongoose.Schema
3
+ const blockedUserSchema = new Schema({
4
+ email: { type: String, primary: true, default: "" },
5
+ mobile: { type: String, default: "" },
6
+ createdTS: { type: Date, default: new Date().toISOString() },
7
+ remarks: { type: String, default: "" },
8
+ })
9
+ const blockedUser = mongoose.model('BlockedUser', blockedUserSchema)
10
+
11
+
12
+ module.exports = blockedUser
@@ -0,0 +1,62 @@
1
+ var mongoose = require('mongoose');
2
+ var Schema = mongoose.Schema;
3
+
4
+ var CitySchema = new Schema({
5
+ name: { type: String, required: true },
6
+ cityCode: { type: Number, required: true },
7
+ karmaCredit: {},
8
+ countryCode: { type: String, required: true },
9
+ curCode: { type: String, default: '' },
10
+ sports: String,
11
+ countryId: { type: String, default: "" },
12
+ currencyTxt: { type: String },
13
+ absKarma: Number,
14
+ isKarmaPercent: Boolean,
15
+ karmaPercent: Number,
16
+ karmaRatio: Number,
17
+ karmaOnRefer: Number,
18
+ karmaEnabled: { type: Boolean, default: true },
19
+ karmaForInvitee: Number,
20
+ radius: Number,
21
+ geoLocation: {
22
+ type: { type: String },
23
+ coordinates: []
24
+ },
25
+ timeZone: { type: String, default: "" },
26
+ minOffset: { type: Number, default: -330 },
27
+ countryBound: {
28
+ },
29
+ phoneLength: Number,
30
+ helpline: String,
31
+ helpType: { type: Number, default: 0 }, //0 - Call, 1 - Mail
32
+ countryName: String,
33
+ areaRadius: { type: Number, default: 3 },
34
+ faqUrl: { type: String, default: "" },
35
+ bulkBooking: { type: Boolean, default: false },
36
+ isreviewed: { type: Boolean },
37
+ notificationPref: [
38
+ {
39
+ category: String,
40
+ status: Boolean
41
+ }
42
+ ],
43
+ placeId: { type: String, required: true },
44
+ userFields : [{
45
+ _id : false,
46
+ id: { type: String, required: true },
47
+ name: { type: String, required: true },
48
+ type: { type: String, required: true },
49
+ format: { type: String, required: true },
50
+ mandatoryHosting: { type: Boolean, required: true },
51
+ mandatoryPayment: { type: Boolean, required: true },
52
+ mandatoryOffline: { type: Boolean, required: true },
53
+ priority: { type: Number, required: true },
54
+ venueSpecific: { type: Boolean, default: false },
55
+ unique: { type: Boolean, default: false },
56
+ render: { type: Boolean, default: true }
57
+ }]
58
+ }, { timestamps: { createdAt: 'createdTS', updatedAt: "modTS" } });
59
+
60
+ CitySchema.index({ 'geoLocation': "2dsphere" })
61
+
62
+ module.exports = mongoose.model('City', CitySchema);
@@ -0,0 +1,64 @@
1
+ const MONGOOSE = require("mongoose")
2
+ const Schema = MONGOOSE.Schema
3
+
4
+
5
+
6
+ const countrySchema = new Schema(
7
+ {
8
+
9
+ karmaDebit: {
10
+ isKarmaPercent: Boolean,
11
+ karmaPercent: Number,
12
+ karmaRatio: Number,
13
+ absKarma: Number,
14
+ },
15
+ karmaCredit: {},
16
+ timeZone: { type: String, default: "" },
17
+ timeZoneName: String,
18
+ countryCode: { type: String, required: true },
19
+ countryId: { type: String, default: "" },
20
+ countryAlpha3Code: { type : String, default: ""},
21
+ currencyTxt: { type: String },
22
+ curCode: { type: String, default: "" },
23
+ name: { type: String, required: true },
24
+ language: { type: String, default: "" },
25
+ helpType: { type: Number, default: 0 },
26
+ radius: { type: Number, default: 3 },
27
+ areaRadius: Number,
28
+ helpLine: String,
29
+ geoLocation: {
30
+ type: { type: String }, // type: multipolygon
31
+ coordinates: []
32
+ },
33
+ countryBound: {
34
+ },
35
+ rawOffset: { type: Number, default: 0 },
36
+ dstOffset: { type: Number, default: 0 },
37
+ faqUrl: { type: String, default: "https://playo.co/support/" },
38
+ bulkBooking : { type: Boolean, default: false },
39
+ notificationPref : [
40
+ {
41
+ category: String,
42
+ status: Boolean
43
+ }
44
+ ],
45
+ userFields : [{
46
+ _id : false,
47
+ id: {type: String, required: true },
48
+ name: { type: String, required: true },
49
+ type: { type: String, required: true },
50
+ format: { type: String, required: true },
51
+ mandatoryHosting: { type: Boolean, required: true },
52
+ mandatoryPayment: { type: Boolean, required: true },
53
+ mandatoryOffline: { type: Boolean, required: true },
54
+ priority: { type: Number, required: true },
55
+ venueSpecific: {type: Boolean, default: false },
56
+ unique: { type: Boolean, default: false },
57
+ render: { type: Boolean, default: true }
58
+ }]
59
+ }
60
+ )
61
+
62
+ countrySchema.index({ 'geoLocation': "2dsphere" })
63
+
64
+ module.exports = MONGOOSE.model("country", countrySchema)
@@ -0,0 +1,13 @@
1
+ var mongoose = require('mongoose');
2
+ const Moment = require("moment")
3
+ var Schema = mongoose.Schema;
4
+
5
+ var EmailOtoSchema = new Schema({
6
+ email: { type: String, required: true, unique: true },
7
+ ts: { type: String, default: Moment().add(4,"hours") },
8
+ otp: { type: Number, required: true }
9
+ },{timestamps:{createdAt:"createdTS",updatedAt:"modTS"}});
10
+
11
+
12
+
13
+ module.exports = mongoose.model('emailotp', EmailOtoSchema);
@@ -0,0 +1,12 @@
1
+ const MONGOOSE = require("mongoose")
2
+ const Schema = MONGOOSE.Schema
3
+
4
+ const emailVerificationToken = new Schema(
5
+ {
6
+ userId: { type: String, required: true, unique: true },
7
+ token: String,
8
+ expiry: Date
9
+ }
10
+ , { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } })
11
+
12
+ module.exports = MONGOOSE.model("emailverificationtoken", emailVerificationToken)
@@ -0,0 +1,24 @@
1
+ const mongoose = require("mongoose");
2
+ const Schema = mongoose.Schema;
3
+ const gtTrialGamesSchema = new Schema(
4
+ {
5
+ userId: { type: String, required: true },
6
+ activityId: { type: String, required: true },
7
+ status: {
8
+ type: String,
9
+ required: true,
10
+ default: "pending",
11
+ enum: ["pending", "completed", "cancelled"],
12
+ },
13
+ venueId: { type: String, required: true },
14
+ discountPercentageAvailed: {
15
+ type: Number,
16
+ min: 0,
17
+ max: 100
18
+ }
19
+ },
20
+ { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
21
+ );
22
+ const gtTrialGames = mongoose.model("gtTrialGames", gtTrialGamesSchema);
23
+
24
+ module.exports = gtTrialGames;
@@ -0,0 +1,14 @@
1
+ var mongoose = require('mongoose');
2
+ var Schema = mongoose.Schema;
3
+
4
+ var InviteSchema = new Schema({
5
+ userId: { type: String, required: true },
6
+ invites: [{
7
+ _id: false,
8
+ invitee: { type: String, required: true },
9
+ modTS: { type: Date, default: Date.now },
10
+ tag: String
11
+ }]
12
+ });
13
+
14
+ module.exports = mongoose.model('Invite', InviteSchema);
@@ -0,0 +1,12 @@
1
+ const MONGOOSE = require("mongoose")
2
+ const Schema = MONGOOSE.Schema
3
+
4
+ const karmaConfigSchema = new Schema(
5
+ {
6
+ id: { type: String, default: "" },
7
+ karma: { type: Number, default: 0 },
8
+ remarks: { type: String, default: "" }
9
+ }
10
+ )
11
+
12
+ module.exports = MONGOOSE.model("karmaconfig", karmaConfigSchema)