playov2-js-utilities 0.3.70 → 0.3.74

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 (82) hide show
  1. package/README.md +28 -28
  2. package/index.js +4 -4
  3. package/lib/constants.js +20 -20
  4. package/lib/cron.js +43 -43
  5. package/lib/db/models/user.js +112 -0
  6. package/lib/db/mongo.js +3 -0
  7. package/lib/db_interface/mongo/index.js +5 -5
  8. package/lib/db_interface/mongo/schemas/activitySchemas/_activityIndex.js +10 -10
  9. package/lib/db_interface/mongo/schemas/activitySchemas/activityInsurance.js +17 -17
  10. package/lib/db_interface/mongo/schemas/activitySchemas/activityLocation.js +104 -104
  11. package/lib/db_interface/mongo/schemas/activitySchemas/activityQueryBlock.js +11 -11
  12. package/lib/db_interface/mongo/schemas/activitySchemas/activityView.js +13 -13
  13. package/lib/db_interface/mongo/schemas/activitySchemas/cronJobLog.js +12 -12
  14. package/lib/db_interface/mongo/schemas/activitySchemas/playogame.request.js +37 -37
  15. package/lib/db_interface/mongo/schemas/activitySchemas/scheduled.tasks.js +52 -52
  16. package/lib/db_interface/mongo/schemas/activitySchemas/userActivity.js +133 -133
  17. package/lib/db_interface/mongo/schemas/gamebookSchemas/_gamebookIndex.js +2 -2
  18. package/lib/db_interface/mongo/schemas/gamebookSchemas/activityNotes.js +19 -19
  19. package/lib/db_interface/mongo/schemas/gamebookSchemas/expense.js +36 -36
  20. package/lib/db_interface/mongo/schemas/gamebookSchemas/expenseLogs.js +13 -13
  21. package/lib/db_interface/mongo/schemas/gamebookSchemas/message.requests.js +29 -29
  22. package/lib/db_interface/mongo/schemas/gamebookSchemas/nonPlayoExpenseUsers.js +14 -14
  23. package/lib/db_interface/mongo/schemas/gamebookSchemas/playpals.js +69 -69
  24. package/lib/db_interface/mongo/schemas/gamebookSchemas/postActivity.js +51 -51
  25. package/lib/db_interface/mongo/schemas/gamebookSchemas/tags.js +12 -12
  26. package/lib/db_interface/mongo/schemas/userSchemas/QuickActions.js +25 -25
  27. package/lib/db_interface/mongo/schemas/userSchemas/_userIndex.js +7 -7
  28. package/lib/db_interface/mongo/schemas/userSchemas/blockedUser.js +11 -11
  29. package/lib/db_interface/mongo/schemas/userSchemas/city.js +62 -62
  30. package/lib/db_interface/mongo/schemas/userSchemas/country.js +63 -63
  31. package/lib/db_interface/mongo/schemas/userSchemas/emailOtp.js +12 -12
  32. package/lib/db_interface/mongo/schemas/userSchemas/emailVerificationToken.js +11 -11
  33. package/lib/db_interface/mongo/schemas/userSchemas/gt.trial.games.js +24 -24
  34. package/lib/db_interface/mongo/schemas/userSchemas/invite.js +14 -14
  35. package/lib/db_interface/mongo/schemas/userSchemas/karmaConfig.js +11 -11
  36. package/lib/db_interface/mongo/schemas/userSchemas/karmaLog.js +28 -28
  37. package/lib/db_interface/mongo/schemas/userSchemas/passwordResetToken.js +11 -11
  38. package/lib/db_interface/mongo/schemas/userSchemas/playo.subscription.pack.js +67 -67
  39. package/lib/db_interface/mongo/schemas/userSchemas/rankings.js +16 -16
  40. package/lib/db_interface/mongo/schemas/userSchemas/sports.js +26 -26
  41. package/lib/db_interface/mongo/schemas/userSchemas/sportsCategory.js +11 -11
  42. package/lib/db_interface/mongo/schemas/userSchemas/tempUser.js +35 -35
  43. package/lib/db_interface/mongo/schemas/userSchemas/trendingSports.js +14 -14
  44. package/lib/db_interface/mongo/schemas/userSchemas/user.activity.health.kit.data.js +26 -26
  45. package/lib/db_interface/mongo/schemas/userSchemas/user.contacts.js +33 -33
  46. package/lib/db_interface/mongo/schemas/userSchemas/user.js +111 -111
  47. package/lib/db_interface/mongo/schemas/userSchemas/userAlerts.js +23 -23
  48. package/lib/db_interface/mongo/schemas/userSchemas/userCredentials.js +50 -50
  49. package/lib/db_interface/mongo/schemas/userSchemas/userFavourites.js +81 -81
  50. package/lib/db_interface/mongo/schemas/userSchemas/userOtp.js +9 -9
  51. package/lib/db_interface/mongo/schemas/userSchemas/userReputation.js +21 -21
  52. package/lib/db_interface/mongo/schemas/userSchemas/userSocial.js +17 -17
  53. package/lib/db_interface/mongo/schemas/userSchemas/year.in.playo.js +51 -51
  54. package/lib/db_interface/mongo/schemas/venueSchemas/_venueIndex.js +3 -3
  55. package/lib/db_interface/mongo/schemas/venueSchemas/ameneties.js +9 -9
  56. package/lib/db_interface/mongo/schemas/venueSchemas/cityArea.js +45 -45
  57. package/lib/db_interface/mongo/schemas/venueSchemas/clubConstraints.js +17 -17
  58. package/lib/db_interface/mongo/schemas/venueSchemas/corporateOffer.js +17 -17
  59. package/lib/db_interface/mongo/schemas/venueSchemas/couponOffers.js +39 -39
  60. package/lib/db_interface/mongo/schemas/venueSchemas/gamebagMember.js +11 -11
  61. package/lib/db_interface/mongo/schemas/venueSchemas/offer.js +48 -48
  62. package/lib/db_interface/mongo/schemas/venueSchemas/thirdParty.js +12 -12
  63. package/lib/db_interface/mongo/schemas/venueSchemas/venue.js +136 -134
  64. package/lib/db_interface/mongo/schemas/venueSchemas/venueEnquires.js +22 -22
  65. package/lib/db_interface/mongo/schemas/venueSchemas/venueMembers.js +14 -14
  66. package/lib/db_interface/mongo/schemas/venueSchemas/venueRating.js +18 -18
  67. package/lib/index.js +22 -23
  68. package/lib/logger.js +115 -115
  69. package/lib/message_publisher/index.js +144 -144
  70. package/lib/middleware.js +46 -46
  71. package/lib/notification-templates.js +254 -254
  72. package/lib/notification.config.js +476 -476
  73. package/lib/playo.utils/playo.error.handler.js +23 -23
  74. package/lib/playo.utils/playo.http.handler.js +162 -162
  75. package/lib/playo.utils/playo.res.generator.js +58 -58
  76. package/lib/profanityFilter/profanityFilter.js +15 -16
  77. package/lib/profanityFilter/profanityWords.js +2 -2
  78. package/lib/ratings/index.js +95 -95
  79. package/lib/request.js +135 -135
  80. package/lib/responseHandler/responseHandler.js +52 -52
  81. package/lib/util.js +151 -151
  82. package/package.json +36 -36
@@ -1,13 +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
-
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
13
  module.exports = MONGOOSE.model("cronjob", cronJobLogSchema)
@@ -1,38 +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
-
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
38
  module.exports = Mongoose.model("playogamerequest", PlayogameRequest);
@@ -1,53 +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
- */
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
53
  module.exports = mongoose.model('scheduledtasks', scheduledTaskSchema);
@@ -1,134 +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
-
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
+ activityCronTS: { type: Date, default: Date.now, required: false }, // to keep activity-cron taskId unique yet identifiable across updates.
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
134
  module.exports = mongoose.model('UserActivity', UserActivitySchema)
@@ -1,3 +1,3 @@
1
- module.exports = {
2
- playpals: require('./playpals'),
1
+ module.exports = {
2
+ playpals: require('./playpals'),
3
3
  }
@@ -1,20 +1,20 @@
1
- const MONGOOSE = require("mongoose")
2
- const Schema = MONGOOSE.Schema
3
-
4
- const activityNotesSchema = new Schema({
5
- activityId: String,
6
- userId: String,
7
- notes: [{
8
- _id: false,
9
- noteId: String,
10
- note: String,
11
- timestamp: Date,
12
- isRemoved: Boolean
13
- }],
14
- createdTS:{type:Date,default:Date.now},
15
- modTS:{type:Date,default:Date.now}
16
- },{timestamps:{createdAt:"createdTS",updatedAt:"modTS"}})
17
-
18
- activityNotesSchema.index({ 'activityId': 1 })
19
-
1
+ const MONGOOSE = require("mongoose")
2
+ const Schema = MONGOOSE.Schema
3
+
4
+ const activityNotesSchema = new Schema({
5
+ activityId: String,
6
+ userId: String,
7
+ notes: [{
8
+ _id: false,
9
+ noteId: String,
10
+ note: String,
11
+ timestamp: Date,
12
+ isRemoved: Boolean
13
+ }],
14
+ createdTS:{type:Date,default:Date.now},
15
+ modTS:{type:Date,default:Date.now}
16
+ },{timestamps:{createdAt:"createdTS",updatedAt:"modTS"}})
17
+
18
+ activityNotesSchema.index({ 'activityId': 1 })
19
+
20
20
  module.exports = MONGOOSE.model("activityNotes", activityNotesSchema)
@@ -1,36 +1,36 @@
1
- const MONGOOSE = require("mongoose");
2
- const Schema = MONGOOSE.Schema;
3
- const expenseSchema = new Schema(
4
- {
5
- activityId: {type: String, require: true},
6
- costHead: {type: String, require: true},
7
- amount: {type: Number, require: true},
8
- currency: {type: String, require: true},
9
- payerId: {type: String, require: true},
10
- payerName: {type: String, require: true},
11
- authorId: {type: String, require: true},
12
- authorName: {type: String, require: true},
13
- split: [
14
- {
15
- _id: false,
16
- userId: {type: String, require: true},
17
- username: {type: String, require: true},
18
- paidAmount: {type: Number, default: 0}
19
- }
20
- ],
21
- comments: [
22
- {
23
- _id: false,
24
- userId: {type: String, require: true},
25
- comment: {type: String, require: false},
26
- timestamp: {type: Date, require: true}
27
- }
28
- ],
29
- isDeleted: {type: Boolean, default: false}
30
- },
31
- {timestamps: {createdAt: "createdTS", updatedAt: "modTS"}}
32
- );
33
-
34
- expenseSchema.index({activityId: 1, payerId: 1});
35
-
36
- module.exports = MONGOOSE.model("expenses", expenseSchema);
1
+ const MONGOOSE = require("mongoose");
2
+ const Schema = MONGOOSE.Schema;
3
+ const expenseSchema = new Schema(
4
+ {
5
+ activityId: {type: String, require: true},
6
+ costHead: {type: String, require: true},
7
+ amount: {type: Number, require: true},
8
+ currency: {type: String, require: true},
9
+ payerId: {type: String, require: true},
10
+ payerName: {type: String, require: true},
11
+ authorId: {type: String, require: true},
12
+ authorName: {type: String, require: true},
13
+ split: [
14
+ {
15
+ _id: false,
16
+ userId: {type: String, require: true},
17
+ username: {type: String, require: true},
18
+ paidAmount: {type: Number, default: 0}
19
+ }
20
+ ],
21
+ comments: [
22
+ {
23
+ _id: false,
24
+ userId: {type: String, require: true},
25
+ comment: {type: String, require: false},
26
+ timestamp: {type: Date, require: true}
27
+ }
28
+ ],
29
+ isDeleted: {type: Boolean, default: false}
30
+ },
31
+ {timestamps: {createdAt: "createdTS", updatedAt: "modTS"}}
32
+ );
33
+
34
+ expenseSchema.index({activityId: 1, payerId: 1});
35
+
36
+ module.exports = MONGOOSE.model("expenses", expenseSchema);
@@ -1,13 +1,13 @@
1
- const MONGOOSE = require("mongoose");
2
- const Schema = MONGOOSE.Schema;
3
- const expenseLogSchema = new Schema(
4
- {
5
- activityId: {type: String, require: true},
6
- log: {type: String, require: true}
7
- },
8
- {timestamps: {createdAt: "createdTS", updatedAt: "modTS"}}
9
- );
10
-
11
- expenseLogSchema.index({activityId: 1});
12
-
13
- module.exports = MONGOOSE.model("expenseLog", expenseLogSchema);
1
+ const MONGOOSE = require("mongoose");
2
+ const Schema = MONGOOSE.Schema;
3
+ const expenseLogSchema = new Schema(
4
+ {
5
+ activityId: {type: String, require: true},
6
+ log: {type: String, require: true}
7
+ },
8
+ {timestamps: {createdAt: "createdTS", updatedAt: "modTS"}}
9
+ );
10
+
11
+ expenseLogSchema.index({activityId: 1});
12
+
13
+ module.exports = MONGOOSE.model("expenseLog", expenseLogSchema);