playov2-js-utilities 0.3.70 → 0.3.73

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 +134 -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,29 +1,29 @@
1
- const Mongoose = require('mongoose');
2
- const Schema = Mongoose.Schema;
3
- const messagerequestSchema = new Schema(
4
- {
5
- receiverId: { // person who recieves the message request to be acted upon
6
- type: String,
7
- required: true
8
- },
9
- senderId: { //
10
- type: String,
11
- required: true
12
- },
13
- message: {
14
- type: String,
15
- required: true
16
- },
17
- status: {
18
- type: String,
19
- required: true,
20
- enum: ['pending', 'deleted', 'blocked', 'accepted'],
21
- default: 'pending'
22
- }
23
-
24
- }, { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
25
- );
26
-
27
- module.exports = Mongoose.model('messagerequests', messagerequestSchema);
28
-
29
- // compound index on receiverId,
1
+ const Mongoose = require('mongoose');
2
+ const Schema = Mongoose.Schema;
3
+ const messagerequestSchema = new Schema(
4
+ {
5
+ receiverId: { // person who recieves the message request to be acted upon
6
+ type: String,
7
+ required: true
8
+ },
9
+ senderId: { //
10
+ type: String,
11
+ required: true
12
+ },
13
+ message: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ status: {
18
+ type: String,
19
+ required: true,
20
+ enum: ['pending', 'deleted', 'blocked', 'accepted'],
21
+ default: 'pending'
22
+ }
23
+
24
+ }, { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
25
+ );
26
+
27
+ module.exports = Mongoose.model('messagerequests', messagerequestSchema);
28
+
29
+ // compound index on receiverId,
@@ -1,14 +1,14 @@
1
- const MONGOOSE = require("mongoose");
2
- const Schema = MONGOOSE.Schema;
3
- const nonPlayoExpenseUsersSchema = new Schema(
4
- {
5
- userId: {type: String, require: true},
6
- name: {type: String, require: true},
7
- activityId: {type: String, require: true}
8
- },
9
- {timestamps: {createdAt: "createdTS", updatedAt: "modTS"}}
10
- );
11
-
12
- nonPlayoExpenseUsersSchema.index({userId: 1, activityId: 1});
13
-
14
- module.exports = MONGOOSE.model("nonPlayoExpenseUsers", nonPlayoExpenseUsersSchema);
1
+ const MONGOOSE = require("mongoose");
2
+ const Schema = MONGOOSE.Schema;
3
+ const nonPlayoExpenseUsersSchema = new Schema(
4
+ {
5
+ userId: {type: String, require: true},
6
+ name: {type: String, require: true},
7
+ activityId: {type: String, require: true}
8
+ },
9
+ {timestamps: {createdAt: "createdTS", updatedAt: "modTS"}}
10
+ );
11
+
12
+ nonPlayoExpenseUsersSchema.index({userId: 1, activityId: 1});
13
+
14
+ module.exports = MONGOOSE.model("nonPlayoExpenseUsers", nonPlayoExpenseUsersSchema);
@@ -1,69 +1,69 @@
1
- const MONGOOSE = require('mongoose');
2
- const Schema = MONGOOSE.Schema;
3
- const playpalSchema = new Schema(
4
- {
5
- userId: { type: String, required: true },
6
- palId: { type: String, required: true },
7
- ratings: [
8
- {
9
- _id: false,
10
- sportId: { type: String, required: true },
11
- previousRating: { type: Number, default: 0 },
12
- rating: { type: Number, default: 0 },
13
- timestamp: Date,
14
- sportRemoved: { type: Boolean, default: false }
15
- }
16
- ],
17
- blocked: { type: Boolean, default: false }, // true - if user blocks playpal
18
- removed: { type: Boolean, default: false },
19
- isBlocked: { type: Boolean, default: false }, // true - if playpal blocks user
20
- activities: [],
21
- reputation: [{
22
- _id: false,
23
- reputationId: Number,
24
- value: Number,
25
- timestamp: Date
26
- }],
27
- reputationLog: [{
28
- _id: false,
29
- log: [{
30
- _id: false,
31
- reputationId: Number,
32
- value: Number,
33
- timestamp: Date
34
- }]
35
- }],
36
- expenses: [{
37
- _id: false,
38
- activityId: { type: String, required: true },
39
- amount: { type: Number, default: 0 },
40
- paidAmount: { type: Number, default: 0 },
41
- currency: { type: String, default: "" },
42
- comments: []
43
- }],
44
- isNewPal: {
45
- type: Boolean,
46
- default: false
47
- },
48
- lastMutedAt: {
49
- type: Date,
50
- default: null
51
- },
52
- mutedTill: {
53
- type: Date,
54
- default: null
55
- },
56
- tags: {
57
- type: Array,
58
- default: []
59
- },
60
- createdTS: { type: Date, default: Date.now },
61
- modTS: { type: Date, default: Date.now },
62
- lastPlayed: { type: Date, default: Date.now },
63
- }, { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
64
- );
65
-
66
- playpalSchema.index({ 'userId': 1 });
67
- playpalSchema.index({ 'palId': 1 });
68
-
69
- module.exports = MONGOOSE.model('playpal', playpalSchema);
1
+ const MONGOOSE = require('mongoose');
2
+ const Schema = MONGOOSE.Schema;
3
+ const playpalSchema = new Schema(
4
+ {
5
+ userId: { type: String, required: true },
6
+ palId: { type: String, required: true },
7
+ ratings: [
8
+ {
9
+ _id: false,
10
+ sportId: { type: String, required: true },
11
+ previousRating: { type: Number, default: 0 },
12
+ rating: { type: Number, default: 0 },
13
+ timestamp: Date,
14
+ sportRemoved: { type: Boolean, default: false }
15
+ }
16
+ ],
17
+ blocked: { type: Boolean, default: false }, // true - if user blocks playpal
18
+ removed: { type: Boolean, default: false },
19
+ isBlocked: { type: Boolean, default: false }, // true - if playpal blocks user
20
+ activities: [],
21
+ reputation: [{
22
+ _id: false,
23
+ reputationId: Number,
24
+ value: Number,
25
+ timestamp: Date
26
+ }],
27
+ reputationLog: [{
28
+ _id: false,
29
+ log: [{
30
+ _id: false,
31
+ reputationId: Number,
32
+ value: Number,
33
+ timestamp: Date
34
+ }]
35
+ }],
36
+ expenses: [{
37
+ _id: false,
38
+ activityId: { type: String, required: true },
39
+ amount: { type: Number, default: 0 },
40
+ paidAmount: { type: Number, default: 0 },
41
+ currency: { type: String, default: "" },
42
+ comments: []
43
+ }],
44
+ isNewPal: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ lastMutedAt: {
49
+ type: Date,
50
+ default: null
51
+ },
52
+ mutedTill: {
53
+ type: Date,
54
+ default: null
55
+ },
56
+ tags: {
57
+ type: Array,
58
+ default: []
59
+ },
60
+ createdTS: { type: Date, default: Date.now },
61
+ modTS: { type: Date, default: Date.now },
62
+ lastPlayed: { type: Date, default: Date.now },
63
+ }, { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
64
+ );
65
+
66
+ playpalSchema.index({ 'userId': 1 });
67
+ playpalSchema.index({ 'palId': 1 });
68
+
69
+ module.exports = MONGOOSE.model('playpal', playpalSchema);
@@ -1,51 +1,51 @@
1
- const MONGOOSE = require("mongoose");
2
- const Schema = MONGOOSE.Schema;
3
- const postActivitySchema = new Schema(
4
- {
5
- activityId: { type: String, required: true, primary: true },
6
- date: { type: Date }, // activity date
7
- timing: { type: Number }, // activity timing
8
- startTime: { type: Date }, // activity startTime
9
- endTime: { type: Date }, //activity endTime
10
- userId: { type: String, required: true, primary: true },
11
- location: { type: String, default: "" },
12
- sportId: String,
13
- hostId: { type: String, default: "" },
14
- matchHappened: { type: Boolean, default: true },
15
- matchRating: { type: Number, default: -1 }, // -1 nothing, 0-thumbsdown, 1-thumbsup
16
- userPlayed: { type: Boolean, default: true }, // updated if user rates himself noshow and after calculating majority of noshow
17
- expired: { type: Boolean, default: false },
18
- pals: [
19
- {
20
- _id: false,
21
- palId: { type: String, require: true },
22
- noshow: { type: Boolean, default: false },
23
- noshowSwitch: { type: Boolean, default: false }, // to show noshow switch or not
24
- rating: { type: Number, default: 0 },
25
- newPlaypal: { type: Boolean, default: false },
26
- timestamp: { type: Date, default: Date.now },
27
- reputation: [
28
- {
29
- _id: false,
30
- reputationId: Number,
31
- value: Number
32
- }
33
- ],
34
- userName: String,
35
- firstRatedOn: { type: Date, default: null },
36
- isRemoved: { type: Boolean, default: false }, // made true if this pal removes sport from his fav
37
- userPresent : { type: Boolean, default: null } // if false user explicitly states the user wasn't present in game which adds user's rating to be considered for no-show pool
38
- }
39
- ],
40
- cancelled: { type: Boolean, default: false },
41
- noshow: { type: Boolean, default: false },
42
- createdTS: { type: Date, default: Date.now },
43
- modTS: { type: Date, default: Date.now },
44
- removed: { type: Boolean, default: false } // made true if this user removes this sport from his fav
45
- },
46
- { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
47
- );
48
-
49
- postActivitySchema.index({ userId: 1, activityId: 1 }, { unique: true });
50
-
51
- module.exports = MONGOOSE.model("postActivity", postActivitySchema);
1
+ const MONGOOSE = require("mongoose");
2
+ const Schema = MONGOOSE.Schema;
3
+ const postActivitySchema = new Schema(
4
+ {
5
+ activityId: { type: String, required: true, primary: true },
6
+ date: { type: Date }, // activity date
7
+ timing: { type: Number }, // activity timing
8
+ startTime: { type: Date }, // activity startTime
9
+ endTime: { type: Date }, //activity endTime
10
+ userId: { type: String, required: true, primary: true },
11
+ location: { type: String, default: "" },
12
+ sportId: String,
13
+ hostId: { type: String, default: "" },
14
+ matchHappened: { type: Boolean, default: true },
15
+ matchRating: { type: Number, default: -1 }, // -1 nothing, 0-thumbsdown, 1-thumbsup
16
+ userPlayed: { type: Boolean, default: true }, // updated if user rates himself noshow and after calculating majority of noshow
17
+ expired: { type: Boolean, default: false },
18
+ pals: [
19
+ {
20
+ _id: false,
21
+ palId: { type: String, require: true },
22
+ noshow: { type: Boolean, default: false },
23
+ noshowSwitch: { type: Boolean, default: false }, // to show noshow switch or not
24
+ rating: { type: Number, default: 0 },
25
+ newPlaypal: { type: Boolean, default: false },
26
+ timestamp: { type: Date, default: Date.now },
27
+ reputation: [
28
+ {
29
+ _id: false,
30
+ reputationId: Number,
31
+ value: Number
32
+ }
33
+ ],
34
+ userName: String,
35
+ firstRatedOn: { type: Date, default: null },
36
+ isRemoved: { type: Boolean, default: false }, // made true if this pal removes sport from his fav
37
+ userPresent : { type: Boolean, default: null } // if false user explicitly states the user wasn't present in game which adds user's rating to be considered for no-show pool
38
+ }
39
+ ],
40
+ cancelled: { type: Boolean, default: false },
41
+ noshow: { type: Boolean, default: false },
42
+ createdTS: { type: Date, default: Date.now },
43
+ modTS: { type: Date, default: Date.now },
44
+ removed: { type: Boolean, default: false } // made true if this user removes this sport from his fav
45
+ },
46
+ { timestamps: { createdAt: "createdTS", updatedAt: "modTS" } }
47
+ );
48
+
49
+ postActivitySchema.index({ userId: 1, activityId: 1 }, { unique: true });
50
+
51
+ module.exports = MONGOOSE.model("postActivity", postActivitySchema);
@@ -1,13 +1,13 @@
1
- const MONGOOSE = require('mongoose');
2
- const { Schema } = MONGOOSE;
3
-
4
- const tagSchema = new Schema({
5
- tagId: { type: String, required: true },
6
- tagName: { type: String, required: true },
7
- tagColor: { type: String, required: true },
8
- ownerId: {type: String, required: true},
9
- isSystemTag: { type: Boolean, default: false },
10
- isDeleted: { type: Boolean, default: false },
11
- }, { timestamps: { createdAt: 'createdTS', updatedAt: 'modTS' } });
12
-
1
+ const MONGOOSE = require('mongoose');
2
+ const { Schema } = MONGOOSE;
3
+
4
+ const tagSchema = new Schema({
5
+ tagId: { type: String, required: true },
6
+ tagName: { type: String, required: true },
7
+ tagColor: { type: String, required: true },
8
+ ownerId: {type: String, required: true},
9
+ isSystemTag: { type: Boolean, default: false },
10
+ isDeleted: { type: Boolean, default: false },
11
+ }, { timestamps: { createdAt: 'createdTS', updatedAt: 'modTS' } });
12
+
13
13
  module.exports = MONGOOSE.model('tag', tagSchema);
@@ -1,26 +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
-
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
26
  module.exports = QuickActions;
@@ -1,8 +1,8 @@
1
- module.exports = {
2
- users: require('./user.js'),
3
- userFavorites: require("./userFavourites.js"),
4
- sports: require("./sports.js"),
5
- cities: require("./city.js"),
6
- blockedUsers: require("./blockedUser.js"),
7
- userReputations: require("./userReputation.js"),
1
+ module.exports = {
2
+ users: require('./user.js'),
3
+ userFavorites: require("./userFavourites.js"),
4
+ sports: require("./sports.js"),
5
+ cities: require("./city.js"),
6
+ blockedUsers: require("./blockedUser.js"),
7
+ userReputations: require("./userReputation.js"),
8
8
  }
@@ -1,12 +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
-
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
12
  module.exports = blockedUser
@@ -1,62 +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);
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);