@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.
@@ -36,7 +36,7 @@ import {
36
36
  resourceRelationsSchema,
37
37
  termsAgreementSchema,
38
38
  userLicenseSchema
39
- } from "../chunk-YNM5IJGO.mjs";
39
+ } from "../chunk-QVELNUI7.mjs";
40
40
  import "../chunk-3QS3WKRC.mjs";
41
41
  export {
42
42
  APP_SETTINGS_ID,
@@ -10012,6 +10012,41 @@ var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
10012
10012
  }
10013
10013
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10014
10014
  `;
10015
+ var MINI_QUIZ_QUESTION_FIELDS_FRAGMENT = gql`
10016
+ fragment MiniQuizQuestionFields on MiniQuizQuestionType {
10017
+ answers {
10018
+ answer
10019
+ correct
10020
+ }
10021
+ question
10022
+ }
10023
+ `;
10024
+ var MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT = gql`
10025
+ fragment MiniQuizBaseGameFields on MiniQuizBaseGameType {
10026
+ gameDate {
10027
+ ...GameDateFields
10028
+ }
10029
+ questions {
10030
+ ...MiniQuizQuestionFields
10031
+ }
10032
+ }
10033
+ ${GAME_DATE_FIELDS_FRAGMENT}
10034
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10035
+ `;
10036
+ var MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT = gql`
10037
+ fragment MiniQuizGameDataFields on MiniQuizGameDataType {
10038
+ gameFields {
10039
+ ...MiniQuizBaseGameFields
10040
+ }
10041
+ quizInfo {
10042
+ ...MiniQuizQuestionFields
10043
+ }
10044
+ points
10045
+ streak
10046
+ }
10047
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10048
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10049
+ `;
10015
10050
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10016
10051
  fragment GameHistoryFields on GameHistoryType {
10017
10052
  createdAt
@@ -10029,8 +10064,12 @@ var GAME_DATA_FIELDS_FRAGMENT = gql`
10029
10064
  dailyClue {
10030
10065
  ...DailyClueGameDataFields
10031
10066
  }
10067
+ miniQuiz {
10068
+ ...MiniQuizGameDataFields
10069
+ }
10032
10070
  }
10033
10071
  ${DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT}
10072
+ ${MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT}
10034
10073
  `;
10035
10074
  var GAME_FIELDS_FRAGMENT = gql`
10036
10075
  fragment GameFields on GameType {
@@ -10104,8 +10143,12 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10104
10143
  dailyClue {
10105
10144
  ...DailyClueBaseGameFields
10106
10145
  }
10146
+ miniQuiz {
10147
+ ...MiniQuizBaseGameFields
10148
+ }
10107
10149
  }
10108
10150
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10151
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10109
10152
  `;
10110
10153
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10111
10154
  fragment PostContentDataFields on PostContentData {
@@ -11102,6 +11145,7 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11102
11145
  })(EnumGameStatus || {});
11103
11146
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11104
11147
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
11148
+ EnumGameType2["MINI_QUIZ"] = "miniQuiz";
11105
11149
  return EnumGameType2;
11106
11150
  })(EnumGameType || {});
11107
11151
 
@@ -12481,6 +12525,9 @@ var AppSettingSchema = new MongooseSchema18(
12481
12525
  var AppSettingModel = import_mongoose19.default.models.AppSetting || import_mongoose19.default.model("AppSetting", AppSettingSchema);
12482
12526
 
12483
12527
  // src/mongoose/game/Game.ts
12528
+ var import_mongoose23 = __toESM(require("mongoose"));
12529
+
12530
+ // src/mongoose/game/DailyClue.ts
12484
12531
  var import_mongoose21 = __toESM(require("mongoose"));
12485
12532
 
12486
12533
  // src/mongoose/game/utils.ts
@@ -12493,7 +12540,10 @@ var schemaGameDate = new MongooseSchema19(
12493
12540
  },
12494
12541
  { _id: false }
12495
12542
  );
12496
- var schemaLetters = new MongooseSchema19(
12543
+
12544
+ // src/mongoose/game/DailyClue.ts
12545
+ var MongooseSchema20 = import_mongoose21.default.Schema;
12546
+ var schemaLetters = new MongooseSchema20(
12497
12547
  {
12498
12548
  collected: { required: false, type: [String] },
12499
12549
  solutionShuffled: { required: true, type: [String] }
@@ -12501,14 +12551,14 @@ var schemaLetters = new MongooseSchema19(
12501
12551
  },
12502
12552
  { _id: false }
12503
12553
  );
12504
- var schemaDailyClueBaseGame = new MongooseSchema19(
12554
+ var schemaDailyClueBaseGame = new MongooseSchema20(
12505
12555
  {
12506
12556
  gameDate: { required: true, type: schemaGameDate },
12507
12557
  gameSolution: { required: true, type: String }
12508
12558
  },
12509
12559
  { _id: false }
12510
12560
  );
12511
- var schemaDailyClueGameData = new MongooseSchema19(
12561
+ var schemaDailyClueGameData = new MongooseSchema20(
12512
12562
  {
12513
12563
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12514
12564
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12522,10 +12572,49 @@ var schemaDailyClueGameData = new MongooseSchema19(
12522
12572
  { _id: false }
12523
12573
  );
12524
12574
 
12575
+ // src/mongoose/game/MiniQuiz.ts
12576
+ var import_mongoose22 = __toESM(require("mongoose"));
12577
+ var MongooseSchema21 = import_mongoose22.default.Schema;
12578
+ var schemaMiniQuizAnswers = new MongooseSchema21(
12579
+ {
12580
+ answer: { required: true, type: String },
12581
+ correct: { required: true, type: Boolean }
12582
+ },
12583
+ { _id: false }
12584
+ );
12585
+ var schemaMiniQuizQuestions = new MongooseSchema21(
12586
+ {
12587
+ answers: { required: true, type: [schemaMiniQuizAnswers] },
12588
+ question: { required: true, type: String }
12589
+ },
12590
+ { _id: false }
12591
+ );
12592
+ var schemaMiniQuizBaseGame = new MongooseSchema21(
12593
+ {
12594
+ gameDate: { required: true, type: Date },
12595
+ questions: { required: true, type: [schemaMiniQuizQuestions] }
12596
+ },
12597
+ { _id: false }
12598
+ );
12599
+ var schemaMiniQuizGameData = new MongooseSchema21(
12600
+ {
12601
+ gameFields: { required: true, type: schemaMiniQuizBaseGame },
12602
+ points: { default: 0, required: true, type: Number },
12603
+ quizInfo: {
12604
+ default: null,
12605
+ required: false,
12606
+ type: [schemaMiniQuizQuestions]
12607
+ },
12608
+ streak: { default: 0, required: true, type: Number }
12609
+ },
12610
+ { _id: false }
12611
+ );
12612
+
12525
12613
  // src/mongoose/game/Game.ts
12526
- var MongooseSchema20 = import_mongoose21.default.Schema;
12614
+ var MongooseSchema22 = import_mongoose23.default.Schema;
12527
12615
  var gameDataSchemas = {
12528
- [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12616
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12617
+ [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12529
12618
  };
12530
12619
  var gameDataDefinition = Object.fromEntries(
12531
12620
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12533,7 +12622,7 @@ var gameDataDefinition = Object.fromEntries(
12533
12622
  { default: null, required: false, type: schema16 }
12534
12623
  ])
12535
12624
  );
12536
- var gameHistorySchema = new MongooseSchema20(
12625
+ var gameHistorySchema = new MongooseSchema22(
12537
12626
  {
12538
12627
  createdAt: { required: true, type: Date },
12539
12628
  gameDate: { required: true, type: schemaGameDate },
@@ -12551,7 +12640,7 @@ var gameHistorySchema = new MongooseSchema20(
12551
12640
  },
12552
12641
  { _id: false }
12553
12642
  );
12554
- var gameTypeSchema = new MongooseSchema20(
12643
+ var gameTypeSchema = new MongooseSchema22(
12555
12644
  {
12556
12645
  active: { default: true, required: true, type: Boolean },
12557
12646
  gameData: gameDataDefinition,
@@ -12564,7 +12653,7 @@ var gameTypeSchema = new MongooseSchema20(
12564
12653
  },
12565
12654
  { timestamps: true }
12566
12655
  );
12567
- var schema14 = new MongooseSchema20(
12656
+ var schema14 = new MongooseSchema22(
12568
12657
  {
12569
12658
  active: { default: false, required: true, type: Boolean },
12570
12659
  deletedAt: { default: null, required: false, type: Date },
@@ -12577,12 +12666,12 @@ var schema14 = new MongooseSchema20(
12577
12666
  },
12578
12667
  { timestamps: true }
12579
12668
  );
12580
- var GameModel = import_mongoose21.default.models.Game || import_mongoose21.default.model("Game", schema14);
12669
+ var GameModel = import_mongoose23.default.models.Game || import_mongoose23.default.model("Game", schema14);
12581
12670
 
12582
12671
  // src/mongoose/School.ts
12583
- var import_mongoose22 = __toESM(require("mongoose"));
12584
- var MongooseSchema21 = import_mongoose22.default.Schema;
12585
- var schema15 = new MongooseSchema21(
12672
+ var import_mongoose24 = __toESM(require("mongoose"));
12673
+ var MongooseSchema23 = import_mongoose24.default.Schema;
12674
+ var schema15 = new MongooseSchema23(
12586
12675
  {
12587
12676
  // New schools are active by default
12588
12677
  active: { default: true, required: true, type: Boolean },
@@ -12607,7 +12696,7 @@ var schema15 = new MongooseSchema21(
12607
12696
  },
12608
12697
  { timestamps: true }
12609
12698
  );
12610
- var SchoolModel = import_mongoose22.default.models.School || import_mongoose22.default.model("School", schema15);
12699
+ var SchoolModel = import_mongoose24.default.models.School || import_mongoose24.default.model("School", schema15);
12611
12700
 
12612
12701
  // src/service/updateAdStatus.ts
12613
12702
  async function updateAdStatuses() {
@@ -12645,18 +12734,18 @@ async function updateAdStatuses() {
12645
12734
  }
12646
12735
 
12647
12736
  // src/service/vendor.ts
12648
- var import_mongoose26 = __toESM(require("mongoose"));
12737
+ var import_mongoose28 = __toESM(require("mongoose"));
12649
12738
 
12650
12739
  // src/service/associate.ts
12651
- var import_mongoose24 = __toESM(require("mongoose"));
12740
+ var import_mongoose26 = __toESM(require("mongoose"));
12652
12741
  async function removeAssociateFromResource({
12653
12742
  resourceId,
12654
12743
  resourceOwnerId,
12655
12744
  resourceType
12656
12745
  }) {
12657
12746
  const normalizedResourceId = resourceId.toString();
12658
- const normalizedOwnerId = typeof resourceOwnerId === "string" ? new import_mongoose24.default.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12659
- const session = await import_mongoose24.default.startSession();
12747
+ const normalizedOwnerId = typeof resourceOwnerId === "string" ? new import_mongoose26.default.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12748
+ const session = await import_mongoose26.default.startSession();
12660
12749
  try {
12661
12750
  session.startTransaction();
12662
12751
  const usersWithAssociates = await UserModel.find(
@@ -12742,7 +12831,7 @@ async function removeAssociateFromResource({
12742
12831
 
12743
12832
  // src/service/vendor.ts
12744
12833
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12745
- const session = await import_mongoose26.default.startSession();
12834
+ const session = await import_mongoose28.default.startSession();
12746
12835
  try {
12747
12836
  session.startTransaction();
12748
12837
  const user = await UserModel.findById(userId).select("vendor").lean().session(session);
@@ -12805,12 +12894,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12805
12894
  }
12806
12895
 
12807
12896
  // src/service/objectIdToString.ts
12808
- var import_mongoose28 = __toESM(require("mongoose"));
12897
+ var import_mongoose30 = __toESM(require("mongoose"));
12809
12898
  function convertObjectIdsToStrings(obj) {
12810
12899
  if (obj === null || obj === void 0) {
12811
12900
  return obj;
12812
12901
  }
12813
- if (obj instanceof import_mongoose28.default.Types.ObjectId) {
12902
+ if (obj instanceof import_mongoose30.default.Types.ObjectId) {
12814
12903
  return obj.toString();
12815
12904
  }
12816
12905
  if (Array.isArray(obj)) {