@timardex/cluemart-server-shared 1.0.150 → 1.0.152

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/dist/index.cjs CHANGED
@@ -1710,7 +1710,7 @@ __export(index_exports, {
1710
1710
  findEventOrImportedMarketById: () => findEventOrImportedMarketById,
1711
1711
  locationGeoSchema: () => locationGeoSchema,
1712
1712
  locationsSchema: () => locationsSchema,
1713
- mongoose: () => import_mongoose30.default,
1713
+ mongoose: () => import_mongoose32.default,
1714
1714
  refundPolicySchema: () => refundPolicySchema,
1715
1715
  relationDatesSchema: () => relationDatesSchema,
1716
1716
  resourceRelationsSchema: () => resourceRelationsSchema,
@@ -10027,6 +10027,37 @@ var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
10027
10027
  }
10028
10028
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10029
10029
  `;
10030
+ var MINI_QUIZ_QUESTION_FIELDS_FRAGMENT = gql`
10031
+ fragment MiniQuizQuestionFields on MiniQuizQuestionType {
10032
+ answers {
10033
+ answer
10034
+ correct
10035
+ }
10036
+ question
10037
+ }
10038
+ `;
10039
+ var MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT = gql`
10040
+ fragment MiniQuizBaseGameFields on MiniQuizBaseGameType {
10041
+ questions {
10042
+ ...MiniQuizQuestionFields
10043
+ }
10044
+ }
10045
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10046
+ `;
10047
+ var MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT = gql`
10048
+ fragment MiniQuizGameDataFields on MiniQuizGameDataType {
10049
+ gameFields {
10050
+ ...MiniQuizBaseGameFields
10051
+ }
10052
+ quizInfo {
10053
+ ...MiniQuizQuestionFields
10054
+ }
10055
+ points
10056
+ streak
10057
+ }
10058
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10059
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10060
+ `;
10030
10061
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10031
10062
  fragment GameHistoryFields on GameHistoryType {
10032
10063
  createdAt
@@ -10044,8 +10075,12 @@ var GAME_DATA_FIELDS_FRAGMENT = gql`
10044
10075
  dailyClue {
10045
10076
  ...DailyClueGameDataFields
10046
10077
  }
10078
+ miniQuiz {
10079
+ ...MiniQuizGameDataFields
10080
+ }
10047
10081
  }
10048
10082
  ${DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT}
10083
+ ${MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT}
10049
10084
  `;
10050
10085
  var GAME_FIELDS_FRAGMENT = gql`
10051
10086
  fragment GameFields on GameType {
@@ -10119,8 +10154,12 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10119
10154
  dailyClue {
10120
10155
  ...DailyClueBaseGameFields
10121
10156
  }
10157
+ miniQuiz {
10158
+ ...MiniQuizBaseGameFields
10159
+ }
10122
10160
  }
10123
10161
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10162
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10124
10163
  `;
10125
10164
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10126
10165
  fragment PostContentDataFields on PostContentData {
@@ -11117,6 +11156,7 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11117
11156
  })(EnumGameStatus || {});
11118
11157
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11119
11158
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
11159
+ EnumGameType2["MINI_QUIZ"] = "miniQuiz";
11120
11160
  return EnumGameType2;
11121
11161
  })(EnumGameType || {});
11122
11162
 
@@ -12362,6 +12402,9 @@ var AppSettingSchema = new MongooseSchema18(
12362
12402
  var AppSettingModel = import_mongoose18.default.models.AppSetting || import_mongoose18.default.model("AppSetting", AppSettingSchema);
12363
12403
 
12364
12404
  // src/mongoose/game/Game.ts
12405
+ var import_mongoose22 = __toESM(require("mongoose"));
12406
+
12407
+ // src/mongoose/game/DailyClue.ts
12365
12408
  var import_mongoose20 = __toESM(require("mongoose"));
12366
12409
 
12367
12410
  // src/mongoose/game/utils.ts
@@ -12374,7 +12417,10 @@ var schemaGameDate = new MongooseSchema19(
12374
12417
  },
12375
12418
  { _id: false }
12376
12419
  );
12377
- var schemaLetters = new MongooseSchema19(
12420
+
12421
+ // src/mongoose/game/DailyClue.ts
12422
+ var MongooseSchema20 = import_mongoose20.default.Schema;
12423
+ var schemaLetters = new MongooseSchema20(
12378
12424
  {
12379
12425
  collected: { required: false, type: [String] },
12380
12426
  solutionShuffled: { required: true, type: [String] }
@@ -12382,14 +12428,14 @@ var schemaLetters = new MongooseSchema19(
12382
12428
  },
12383
12429
  { _id: false }
12384
12430
  );
12385
- var schemaDailyClueBaseGame = new MongooseSchema19(
12431
+ var schemaDailyClueBaseGame = new MongooseSchema20(
12386
12432
  {
12387
12433
  gameDate: { required: true, type: schemaGameDate },
12388
12434
  gameSolution: { required: true, type: String }
12389
12435
  },
12390
12436
  { _id: false }
12391
12437
  );
12392
- var schemaDailyClueGameData = new MongooseSchema19(
12438
+ var schemaDailyClueGameData = new MongooseSchema20(
12393
12439
  {
12394
12440
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12395
12441
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12403,10 +12449,48 @@ var schemaDailyClueGameData = new MongooseSchema19(
12403
12449
  { _id: false }
12404
12450
  );
12405
12451
 
12452
+ // src/mongoose/game/MiniQuiz.ts
12453
+ var import_mongoose21 = __toESM(require("mongoose"));
12454
+ var MongooseSchema21 = import_mongoose21.default.Schema;
12455
+ var schemaMiniQuizAnswers = new MongooseSchema21(
12456
+ {
12457
+ answer: { required: true, type: String },
12458
+ correct: { required: true, type: Boolean }
12459
+ },
12460
+ { _id: false }
12461
+ );
12462
+ var schemaMiniQuizQuestions = new MongooseSchema21(
12463
+ {
12464
+ answers: { required: true, type: [schemaMiniQuizAnswers] },
12465
+ question: { required: true, type: String }
12466
+ },
12467
+ { _id: false }
12468
+ );
12469
+ var schemaMiniQuizBaseGame = new MongooseSchema21(
12470
+ {
12471
+ questions: { required: true, type: [schemaMiniQuizQuestions] }
12472
+ },
12473
+ { _id: false }
12474
+ );
12475
+ var schemaMiniQuizGameData = new MongooseSchema21(
12476
+ {
12477
+ gameFields: { required: true, type: schemaMiniQuizBaseGame },
12478
+ points: { default: 0, required: true, type: Number },
12479
+ quizInfo: {
12480
+ default: null,
12481
+ required: false,
12482
+ type: [schemaMiniQuizQuestions]
12483
+ },
12484
+ streak: { default: 0, required: true, type: Number }
12485
+ },
12486
+ { _id: false }
12487
+ );
12488
+
12406
12489
  // src/mongoose/game/Game.ts
12407
- var MongooseSchema20 = import_mongoose20.default.Schema;
12490
+ var MongooseSchema22 = import_mongoose22.default.Schema;
12408
12491
  var gameDataSchemas = {
12409
- [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12492
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12493
+ [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12410
12494
  };
12411
12495
  var gameDataDefinition = Object.fromEntries(
12412
12496
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12414,7 +12498,7 @@ var gameDataDefinition = Object.fromEntries(
12414
12498
  { default: null, required: false, type: schema16 }
12415
12499
  ])
12416
12500
  );
12417
- var gameHistorySchema = new MongooseSchema20(
12501
+ var gameHistorySchema = new MongooseSchema22(
12418
12502
  {
12419
12503
  createdAt: { required: true, type: Date },
12420
12504
  gameDate: { required: true, type: schemaGameDate },
@@ -12432,7 +12516,7 @@ var gameHistorySchema = new MongooseSchema20(
12432
12516
  },
12433
12517
  { _id: false }
12434
12518
  );
12435
- var gameTypeSchema = new MongooseSchema20(
12519
+ var gameTypeSchema = new MongooseSchema22(
12436
12520
  {
12437
12521
  active: { default: true, required: true, type: Boolean },
12438
12522
  gameData: gameDataDefinition,
@@ -12445,7 +12529,7 @@ var gameTypeSchema = new MongooseSchema20(
12445
12529
  },
12446
12530
  { timestamps: true }
12447
12531
  );
12448
- var schema14 = new MongooseSchema20(
12532
+ var schema14 = new MongooseSchema22(
12449
12533
  {
12450
12534
  active: { default: false, required: true, type: Boolean },
12451
12535
  deletedAt: { default: null, required: false, type: Date },
@@ -12458,12 +12542,12 @@ var schema14 = new MongooseSchema20(
12458
12542
  },
12459
12543
  { timestamps: true }
12460
12544
  );
12461
- var GameModel = import_mongoose20.default.models.Game || import_mongoose20.default.model("Game", schema14);
12545
+ var GameModel = import_mongoose22.default.models.Game || import_mongoose22.default.model("Game", schema14);
12462
12546
 
12463
12547
  // src/mongoose/School.ts
12464
- var import_mongoose21 = __toESM(require("mongoose"));
12465
- var MongooseSchema21 = import_mongoose21.default.Schema;
12466
- var schema15 = new MongooseSchema21(
12548
+ var import_mongoose23 = __toESM(require("mongoose"));
12549
+ var MongooseSchema23 = import_mongoose23.default.Schema;
12550
+ var schema15 = new MongooseSchema23(
12467
12551
  {
12468
12552
  // New schools are active by default
12469
12553
  active: { default: true, required: true, type: Boolean },
@@ -12488,10 +12572,10 @@ var schema15 = new MongooseSchema21(
12488
12572
  },
12489
12573
  { timestamps: true }
12490
12574
  );
12491
- var SchoolModel = import_mongoose21.default.models.School || import_mongoose21.default.model("School", schema15);
12575
+ var SchoolModel = import_mongoose23.default.models.School || import_mongoose23.default.model("School", schema15);
12492
12576
 
12493
12577
  // src/service/database.ts
12494
- var import_mongoose22 = __toESM(require("mongoose"));
12578
+ var import_mongoose24 = __toESM(require("mongoose"));
12495
12579
  var connectToDatabase = async ({
12496
12580
  appName,
12497
12581
  dbName,
@@ -12504,7 +12588,7 @@ var connectToDatabase = async ({
12504
12588
  // Fallback to MongoDB Atlas connection string
12505
12589
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12506
12590
  );
12507
- await import_mongoose22.default.connect(mongoUri);
12591
+ await import_mongoose24.default.connect(mongoUri);
12508
12592
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12509
12593
  console.log(
12510
12594
  `${connectionType} connected from server/src/service/database.ts`
@@ -12683,18 +12767,18 @@ async function updateAdStatuses() {
12683
12767
  }
12684
12768
 
12685
12769
  // src/service/vendor.ts
12686
- var import_mongoose26 = __toESM(require("mongoose"));
12770
+ var import_mongoose28 = __toESM(require("mongoose"));
12687
12771
 
12688
12772
  // src/service/associate.ts
12689
- var import_mongoose24 = __toESM(require("mongoose"));
12773
+ var import_mongoose26 = __toESM(require("mongoose"));
12690
12774
  async function removeAssociateFromResource({
12691
12775
  resourceId,
12692
12776
  resourceOwnerId,
12693
12777
  resourceType
12694
12778
  }) {
12695
12779
  const normalizedResourceId = resourceId.toString();
12696
- const normalizedOwnerId = typeof resourceOwnerId === "string" ? new import_mongoose24.default.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12697
- const session = await import_mongoose24.default.startSession();
12780
+ const normalizedOwnerId = typeof resourceOwnerId === "string" ? new import_mongoose26.default.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12781
+ const session = await import_mongoose26.default.startSession();
12698
12782
  try {
12699
12783
  session.startTransaction();
12700
12784
  const usersWithAssociates = await UserModel.find(
@@ -12780,7 +12864,7 @@ async function removeAssociateFromResource({
12780
12864
 
12781
12865
  // src/service/vendor.ts
12782
12866
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12783
- const session = await import_mongoose26.default.startSession();
12867
+ const session = await import_mongoose28.default.startSession();
12784
12868
  try {
12785
12869
  session.startTransaction();
12786
12870
  const user = await UserModel.findById(userId).select("vendor").lean().session(session);
@@ -12843,12 +12927,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12843
12927
  }
12844
12928
 
12845
12929
  // src/service/objectIdToString.ts
12846
- var import_mongoose28 = __toESM(require("mongoose"));
12930
+ var import_mongoose30 = __toESM(require("mongoose"));
12847
12931
  function convertObjectIdsToStrings(obj) {
12848
12932
  if (obj === null || obj === void 0) {
12849
12933
  return obj;
12850
12934
  }
12851
- if (obj instanceof import_mongoose28.default.Types.ObjectId) {
12935
+ if (obj instanceof import_mongoose30.default.Types.ObjectId) {
12852
12936
  return obj.toString();
12853
12937
  }
12854
12938
  if (Array.isArray(obj)) {
@@ -12879,7 +12963,7 @@ async function findEventOrImportedMarketById(resourceId) {
12879
12963
 
12880
12964
  // src/types/index.ts
12881
12965
  var import_express = __toESM(require("express"));
12882
- var import_mongoose30 = __toESM(require("mongoose"));
12966
+ var import_mongoose32 = __toESM(require("mongoose"));
12883
12967
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12884
12968
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12885
12969
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";