@timardex/cluemart-server-shared 1.0.150 → 1.0.151

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,41 @@ 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
+ gameDate {
10042
+ ...GameDateFields
10043
+ }
10044
+ questions {
10045
+ ...MiniQuizQuestionFields
10046
+ }
10047
+ }
10048
+ ${GAME_DATE_FIELDS_FRAGMENT}
10049
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10050
+ `;
10051
+ var MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT = gql`
10052
+ fragment MiniQuizGameDataFields on MiniQuizGameDataType {
10053
+ gameFields {
10054
+ ...MiniQuizBaseGameFields
10055
+ }
10056
+ quizInfo {
10057
+ ...MiniQuizQuestionFields
10058
+ }
10059
+ points
10060
+ streak
10061
+ }
10062
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10063
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10064
+ `;
10030
10065
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10031
10066
  fragment GameHistoryFields on GameHistoryType {
10032
10067
  createdAt
@@ -10044,8 +10079,12 @@ var GAME_DATA_FIELDS_FRAGMENT = gql`
10044
10079
  dailyClue {
10045
10080
  ...DailyClueGameDataFields
10046
10081
  }
10082
+ miniQuiz {
10083
+ ...MiniQuizGameDataFields
10084
+ }
10047
10085
  }
10048
10086
  ${DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT}
10087
+ ${MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT}
10049
10088
  `;
10050
10089
  var GAME_FIELDS_FRAGMENT = gql`
10051
10090
  fragment GameFields on GameType {
@@ -10119,8 +10158,12 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10119
10158
  dailyClue {
10120
10159
  ...DailyClueBaseGameFields
10121
10160
  }
10161
+ miniQuiz {
10162
+ ...MiniQuizBaseGameFields
10163
+ }
10122
10164
  }
10123
10165
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10166
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10124
10167
  `;
10125
10168
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10126
10169
  fragment PostContentDataFields on PostContentData {
@@ -11117,6 +11160,7 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11117
11160
  })(EnumGameStatus || {});
11118
11161
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11119
11162
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
11163
+ EnumGameType2["MINI_QUIZ"] = "miniQuiz";
11120
11164
  return EnumGameType2;
11121
11165
  })(EnumGameType || {});
11122
11166
 
@@ -12362,6 +12406,9 @@ var AppSettingSchema = new MongooseSchema18(
12362
12406
  var AppSettingModel = import_mongoose18.default.models.AppSetting || import_mongoose18.default.model("AppSetting", AppSettingSchema);
12363
12407
 
12364
12408
  // src/mongoose/game/Game.ts
12409
+ var import_mongoose22 = __toESM(require("mongoose"));
12410
+
12411
+ // src/mongoose/game/DailyClue.ts
12365
12412
  var import_mongoose20 = __toESM(require("mongoose"));
12366
12413
 
12367
12414
  // src/mongoose/game/utils.ts
@@ -12374,7 +12421,10 @@ var schemaGameDate = new MongooseSchema19(
12374
12421
  },
12375
12422
  { _id: false }
12376
12423
  );
12377
- var schemaLetters = new MongooseSchema19(
12424
+
12425
+ // src/mongoose/game/DailyClue.ts
12426
+ var MongooseSchema20 = import_mongoose20.default.Schema;
12427
+ var schemaLetters = new MongooseSchema20(
12378
12428
  {
12379
12429
  collected: { required: false, type: [String] },
12380
12430
  solutionShuffled: { required: true, type: [String] }
@@ -12382,14 +12432,14 @@ var schemaLetters = new MongooseSchema19(
12382
12432
  },
12383
12433
  { _id: false }
12384
12434
  );
12385
- var schemaDailyClueBaseGame = new MongooseSchema19(
12435
+ var schemaDailyClueBaseGame = new MongooseSchema20(
12386
12436
  {
12387
12437
  gameDate: { required: true, type: schemaGameDate },
12388
12438
  gameSolution: { required: true, type: String }
12389
12439
  },
12390
12440
  { _id: false }
12391
12441
  );
12392
- var schemaDailyClueGameData = new MongooseSchema19(
12442
+ var schemaDailyClueGameData = new MongooseSchema20(
12393
12443
  {
12394
12444
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12395
12445
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12403,10 +12453,49 @@ var schemaDailyClueGameData = new MongooseSchema19(
12403
12453
  { _id: false }
12404
12454
  );
12405
12455
 
12456
+ // src/mongoose/game/MiniQuiz.ts
12457
+ var import_mongoose21 = __toESM(require("mongoose"));
12458
+ var MongooseSchema21 = import_mongoose21.default.Schema;
12459
+ var schemaMiniQuizAnswers = new MongooseSchema21(
12460
+ {
12461
+ answer: { required: true, type: String },
12462
+ correct: { required: true, type: Boolean }
12463
+ },
12464
+ { _id: false }
12465
+ );
12466
+ var schemaMiniQuizQuestions = new MongooseSchema21(
12467
+ {
12468
+ answers: { required: true, type: [schemaMiniQuizAnswers] },
12469
+ question: { required: true, type: String }
12470
+ },
12471
+ { _id: false }
12472
+ );
12473
+ var schemaMiniQuizBaseGame = new MongooseSchema21(
12474
+ {
12475
+ gameDate: { required: true, type: Date },
12476
+ questions: { required: true, type: [schemaMiniQuizQuestions] }
12477
+ },
12478
+ { _id: false }
12479
+ );
12480
+ var schemaMiniQuizGameData = new MongooseSchema21(
12481
+ {
12482
+ gameFields: { required: true, type: schemaMiniQuizBaseGame },
12483
+ points: { default: 0, required: true, type: Number },
12484
+ quizInfo: {
12485
+ default: null,
12486
+ required: false,
12487
+ type: [schemaMiniQuizQuestions]
12488
+ },
12489
+ streak: { default: 0, required: true, type: Number }
12490
+ },
12491
+ { _id: false }
12492
+ );
12493
+
12406
12494
  // src/mongoose/game/Game.ts
12407
- var MongooseSchema20 = import_mongoose20.default.Schema;
12495
+ var MongooseSchema22 = import_mongoose22.default.Schema;
12408
12496
  var gameDataSchemas = {
12409
- [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12497
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12498
+ [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12410
12499
  };
12411
12500
  var gameDataDefinition = Object.fromEntries(
12412
12501
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12414,7 +12503,7 @@ var gameDataDefinition = Object.fromEntries(
12414
12503
  { default: null, required: false, type: schema16 }
12415
12504
  ])
12416
12505
  );
12417
- var gameHistorySchema = new MongooseSchema20(
12506
+ var gameHistorySchema = new MongooseSchema22(
12418
12507
  {
12419
12508
  createdAt: { required: true, type: Date },
12420
12509
  gameDate: { required: true, type: schemaGameDate },
@@ -12432,7 +12521,7 @@ var gameHistorySchema = new MongooseSchema20(
12432
12521
  },
12433
12522
  { _id: false }
12434
12523
  );
12435
- var gameTypeSchema = new MongooseSchema20(
12524
+ var gameTypeSchema = new MongooseSchema22(
12436
12525
  {
12437
12526
  active: { default: true, required: true, type: Boolean },
12438
12527
  gameData: gameDataDefinition,
@@ -12445,7 +12534,7 @@ var gameTypeSchema = new MongooseSchema20(
12445
12534
  },
12446
12535
  { timestamps: true }
12447
12536
  );
12448
- var schema14 = new MongooseSchema20(
12537
+ var schema14 = new MongooseSchema22(
12449
12538
  {
12450
12539
  active: { default: false, required: true, type: Boolean },
12451
12540
  deletedAt: { default: null, required: false, type: Date },
@@ -12458,12 +12547,12 @@ var schema14 = new MongooseSchema20(
12458
12547
  },
12459
12548
  { timestamps: true }
12460
12549
  );
12461
- var GameModel = import_mongoose20.default.models.Game || import_mongoose20.default.model("Game", schema14);
12550
+ var GameModel = import_mongoose22.default.models.Game || import_mongoose22.default.model("Game", schema14);
12462
12551
 
12463
12552
  // src/mongoose/School.ts
12464
- var import_mongoose21 = __toESM(require("mongoose"));
12465
- var MongooseSchema21 = import_mongoose21.default.Schema;
12466
- var schema15 = new MongooseSchema21(
12553
+ var import_mongoose23 = __toESM(require("mongoose"));
12554
+ var MongooseSchema23 = import_mongoose23.default.Schema;
12555
+ var schema15 = new MongooseSchema23(
12467
12556
  {
12468
12557
  // New schools are active by default
12469
12558
  active: { default: true, required: true, type: Boolean },
@@ -12488,10 +12577,10 @@ var schema15 = new MongooseSchema21(
12488
12577
  },
12489
12578
  { timestamps: true }
12490
12579
  );
12491
- var SchoolModel = import_mongoose21.default.models.School || import_mongoose21.default.model("School", schema15);
12580
+ var SchoolModel = import_mongoose23.default.models.School || import_mongoose23.default.model("School", schema15);
12492
12581
 
12493
12582
  // src/service/database.ts
12494
- var import_mongoose22 = __toESM(require("mongoose"));
12583
+ var import_mongoose24 = __toESM(require("mongoose"));
12495
12584
  var connectToDatabase = async ({
12496
12585
  appName,
12497
12586
  dbName,
@@ -12504,7 +12593,7 @@ var connectToDatabase = async ({
12504
12593
  // Fallback to MongoDB Atlas connection string
12505
12594
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12506
12595
  );
12507
- await import_mongoose22.default.connect(mongoUri);
12596
+ await import_mongoose24.default.connect(mongoUri);
12508
12597
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12509
12598
  console.log(
12510
12599
  `${connectionType} connected from server/src/service/database.ts`
@@ -12683,18 +12772,18 @@ async function updateAdStatuses() {
12683
12772
  }
12684
12773
 
12685
12774
  // src/service/vendor.ts
12686
- var import_mongoose26 = __toESM(require("mongoose"));
12775
+ var import_mongoose28 = __toESM(require("mongoose"));
12687
12776
 
12688
12777
  // src/service/associate.ts
12689
- var import_mongoose24 = __toESM(require("mongoose"));
12778
+ var import_mongoose26 = __toESM(require("mongoose"));
12690
12779
  async function removeAssociateFromResource({
12691
12780
  resourceId,
12692
12781
  resourceOwnerId,
12693
12782
  resourceType
12694
12783
  }) {
12695
12784
  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();
12785
+ const normalizedOwnerId = typeof resourceOwnerId === "string" ? new import_mongoose26.default.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12786
+ const session = await import_mongoose26.default.startSession();
12698
12787
  try {
12699
12788
  session.startTransaction();
12700
12789
  const usersWithAssociates = await UserModel.find(
@@ -12780,7 +12869,7 @@ async function removeAssociateFromResource({
12780
12869
 
12781
12870
  // src/service/vendor.ts
12782
12871
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12783
- const session = await import_mongoose26.default.startSession();
12872
+ const session = await import_mongoose28.default.startSession();
12784
12873
  try {
12785
12874
  session.startTransaction();
12786
12875
  const user = await UserModel.findById(userId).select("vendor").lean().session(session);
@@ -12843,12 +12932,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12843
12932
  }
12844
12933
 
12845
12934
  // src/service/objectIdToString.ts
12846
- var import_mongoose28 = __toESM(require("mongoose"));
12935
+ var import_mongoose30 = __toESM(require("mongoose"));
12847
12936
  function convertObjectIdsToStrings(obj) {
12848
12937
  if (obj === null || obj === void 0) {
12849
12938
  return obj;
12850
12939
  }
12851
- if (obj instanceof import_mongoose28.default.Types.ObjectId) {
12940
+ if (obj instanceof import_mongoose30.default.Types.ObjectId) {
12852
12941
  return obj.toString();
12853
12942
  }
12854
12943
  if (Array.isArray(obj)) {
@@ -12879,7 +12968,7 @@ async function findEventOrImportedMarketById(resourceId) {
12879
12968
 
12880
12969
  // src/types/index.ts
12881
12970
  var import_express = __toESM(require("express"));
12882
- var import_mongoose30 = __toESM(require("mongoose"));
12971
+ var import_mongoose32 = __toESM(require("mongoose"));
12883
12972
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12884
12973
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12885
12974
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";