@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.
@@ -36,7 +36,7 @@ import {
36
36
  resourceRelationsSchema,
37
37
  termsAgreementSchema,
38
38
  userLicenseSchema
39
- } from "../chunk-YNM5IJGO.mjs";
39
+ } from "../chunk-KM44V4EU.mjs";
40
40
  import "../chunk-3QS3WKRC.mjs";
41
41
  export {
42
42
  APP_SETTINGS_ID,
@@ -10012,6 +10012,37 @@ 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
+ questions {
10027
+ ...MiniQuizQuestionFields
10028
+ }
10029
+ }
10030
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10031
+ `;
10032
+ var MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT = gql`
10033
+ fragment MiniQuizGameDataFields on MiniQuizGameDataType {
10034
+ gameFields {
10035
+ ...MiniQuizBaseGameFields
10036
+ }
10037
+ quizInfo {
10038
+ ...MiniQuizQuestionFields
10039
+ }
10040
+ points
10041
+ streak
10042
+ }
10043
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10044
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10045
+ `;
10015
10046
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10016
10047
  fragment GameHistoryFields on GameHistoryType {
10017
10048
  createdAt
@@ -10029,8 +10060,12 @@ var GAME_DATA_FIELDS_FRAGMENT = gql`
10029
10060
  dailyClue {
10030
10061
  ...DailyClueGameDataFields
10031
10062
  }
10063
+ miniQuiz {
10064
+ ...MiniQuizGameDataFields
10065
+ }
10032
10066
  }
10033
10067
  ${DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT}
10068
+ ${MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT}
10034
10069
  `;
10035
10070
  var GAME_FIELDS_FRAGMENT = gql`
10036
10071
  fragment GameFields on GameType {
@@ -10104,8 +10139,12 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10104
10139
  dailyClue {
10105
10140
  ...DailyClueBaseGameFields
10106
10141
  }
10142
+ miniQuiz {
10143
+ ...MiniQuizBaseGameFields
10144
+ }
10107
10145
  }
10108
10146
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10147
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10109
10148
  `;
10110
10149
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10111
10150
  fragment PostContentDataFields on PostContentData {
@@ -11102,6 +11141,7 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11102
11141
  })(EnumGameStatus || {});
11103
11142
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11104
11143
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
11144
+ EnumGameType2["MINI_QUIZ"] = "miniQuiz";
11105
11145
  return EnumGameType2;
11106
11146
  })(EnumGameType || {});
11107
11147
 
@@ -12481,6 +12521,9 @@ var AppSettingSchema = new MongooseSchema18(
12481
12521
  var AppSettingModel = import_mongoose19.default.models.AppSetting || import_mongoose19.default.model("AppSetting", AppSettingSchema);
12482
12522
 
12483
12523
  // src/mongoose/game/Game.ts
12524
+ var import_mongoose23 = __toESM(require("mongoose"));
12525
+
12526
+ // src/mongoose/game/DailyClue.ts
12484
12527
  var import_mongoose21 = __toESM(require("mongoose"));
12485
12528
 
12486
12529
  // src/mongoose/game/utils.ts
@@ -12493,7 +12536,10 @@ var schemaGameDate = new MongooseSchema19(
12493
12536
  },
12494
12537
  { _id: false }
12495
12538
  );
12496
- var schemaLetters = new MongooseSchema19(
12539
+
12540
+ // src/mongoose/game/DailyClue.ts
12541
+ var MongooseSchema20 = import_mongoose21.default.Schema;
12542
+ var schemaLetters = new MongooseSchema20(
12497
12543
  {
12498
12544
  collected: { required: false, type: [String] },
12499
12545
  solutionShuffled: { required: true, type: [String] }
@@ -12501,14 +12547,14 @@ var schemaLetters = new MongooseSchema19(
12501
12547
  },
12502
12548
  { _id: false }
12503
12549
  );
12504
- var schemaDailyClueBaseGame = new MongooseSchema19(
12550
+ var schemaDailyClueBaseGame = new MongooseSchema20(
12505
12551
  {
12506
12552
  gameDate: { required: true, type: schemaGameDate },
12507
12553
  gameSolution: { required: true, type: String }
12508
12554
  },
12509
12555
  { _id: false }
12510
12556
  );
12511
- var schemaDailyClueGameData = new MongooseSchema19(
12557
+ var schemaDailyClueGameData = new MongooseSchema20(
12512
12558
  {
12513
12559
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12514
12560
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12522,10 +12568,48 @@ var schemaDailyClueGameData = new MongooseSchema19(
12522
12568
  { _id: false }
12523
12569
  );
12524
12570
 
12571
+ // src/mongoose/game/MiniQuiz.ts
12572
+ var import_mongoose22 = __toESM(require("mongoose"));
12573
+ var MongooseSchema21 = import_mongoose22.default.Schema;
12574
+ var schemaMiniQuizAnswers = new MongooseSchema21(
12575
+ {
12576
+ answer: { required: true, type: String },
12577
+ correct: { required: true, type: Boolean }
12578
+ },
12579
+ { _id: false }
12580
+ );
12581
+ var schemaMiniQuizQuestions = new MongooseSchema21(
12582
+ {
12583
+ answers: { required: true, type: [schemaMiniQuizAnswers] },
12584
+ question: { required: true, type: String }
12585
+ },
12586
+ { _id: false }
12587
+ );
12588
+ var schemaMiniQuizBaseGame = new MongooseSchema21(
12589
+ {
12590
+ questions: { required: true, type: [schemaMiniQuizQuestions] }
12591
+ },
12592
+ { _id: false }
12593
+ );
12594
+ var schemaMiniQuizGameData = new MongooseSchema21(
12595
+ {
12596
+ gameFields: { required: true, type: schemaMiniQuizBaseGame },
12597
+ points: { default: 0, required: true, type: Number },
12598
+ quizInfo: {
12599
+ default: null,
12600
+ required: false,
12601
+ type: [schemaMiniQuizQuestions]
12602
+ },
12603
+ streak: { default: 0, required: true, type: Number }
12604
+ },
12605
+ { _id: false }
12606
+ );
12607
+
12525
12608
  // src/mongoose/game/Game.ts
12526
- var MongooseSchema20 = import_mongoose21.default.Schema;
12609
+ var MongooseSchema22 = import_mongoose23.default.Schema;
12527
12610
  var gameDataSchemas = {
12528
- [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12611
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12612
+ [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12529
12613
  };
12530
12614
  var gameDataDefinition = Object.fromEntries(
12531
12615
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12533,7 +12617,7 @@ var gameDataDefinition = Object.fromEntries(
12533
12617
  { default: null, required: false, type: schema16 }
12534
12618
  ])
12535
12619
  );
12536
- var gameHistorySchema = new MongooseSchema20(
12620
+ var gameHistorySchema = new MongooseSchema22(
12537
12621
  {
12538
12622
  createdAt: { required: true, type: Date },
12539
12623
  gameDate: { required: true, type: schemaGameDate },
@@ -12551,7 +12635,7 @@ var gameHistorySchema = new MongooseSchema20(
12551
12635
  },
12552
12636
  { _id: false }
12553
12637
  );
12554
- var gameTypeSchema = new MongooseSchema20(
12638
+ var gameTypeSchema = new MongooseSchema22(
12555
12639
  {
12556
12640
  active: { default: true, required: true, type: Boolean },
12557
12641
  gameData: gameDataDefinition,
@@ -12564,7 +12648,7 @@ var gameTypeSchema = new MongooseSchema20(
12564
12648
  },
12565
12649
  { timestamps: true }
12566
12650
  );
12567
- var schema14 = new MongooseSchema20(
12651
+ var schema14 = new MongooseSchema22(
12568
12652
  {
12569
12653
  active: { default: false, required: true, type: Boolean },
12570
12654
  deletedAt: { default: null, required: false, type: Date },
@@ -12577,12 +12661,12 @@ var schema14 = new MongooseSchema20(
12577
12661
  },
12578
12662
  { timestamps: true }
12579
12663
  );
12580
- var GameModel = import_mongoose21.default.models.Game || import_mongoose21.default.model("Game", schema14);
12664
+ var GameModel = import_mongoose23.default.models.Game || import_mongoose23.default.model("Game", schema14);
12581
12665
 
12582
12666
  // src/mongoose/School.ts
12583
- var import_mongoose22 = __toESM(require("mongoose"));
12584
- var MongooseSchema21 = import_mongoose22.default.Schema;
12585
- var schema15 = new MongooseSchema21(
12667
+ var import_mongoose24 = __toESM(require("mongoose"));
12668
+ var MongooseSchema23 = import_mongoose24.default.Schema;
12669
+ var schema15 = new MongooseSchema23(
12586
12670
  {
12587
12671
  // New schools are active by default
12588
12672
  active: { default: true, required: true, type: Boolean },
@@ -12607,7 +12691,7 @@ var schema15 = new MongooseSchema21(
12607
12691
  },
12608
12692
  { timestamps: true }
12609
12693
  );
12610
- var SchoolModel = import_mongoose22.default.models.School || import_mongoose22.default.model("School", schema15);
12694
+ var SchoolModel = import_mongoose24.default.models.School || import_mongoose24.default.model("School", schema15);
12611
12695
 
12612
12696
  // src/service/updateAdStatus.ts
12613
12697
  async function updateAdStatuses() {
@@ -12645,18 +12729,18 @@ async function updateAdStatuses() {
12645
12729
  }
12646
12730
 
12647
12731
  // src/service/vendor.ts
12648
- var import_mongoose26 = __toESM(require("mongoose"));
12732
+ var import_mongoose28 = __toESM(require("mongoose"));
12649
12733
 
12650
12734
  // src/service/associate.ts
12651
- var import_mongoose24 = __toESM(require("mongoose"));
12735
+ var import_mongoose26 = __toESM(require("mongoose"));
12652
12736
  async function removeAssociateFromResource({
12653
12737
  resourceId,
12654
12738
  resourceOwnerId,
12655
12739
  resourceType
12656
12740
  }) {
12657
12741
  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();
12742
+ const normalizedOwnerId = typeof resourceOwnerId === "string" ? new import_mongoose26.default.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12743
+ const session = await import_mongoose26.default.startSession();
12660
12744
  try {
12661
12745
  session.startTransaction();
12662
12746
  const usersWithAssociates = await UserModel.find(
@@ -12742,7 +12826,7 @@ async function removeAssociateFromResource({
12742
12826
 
12743
12827
  // src/service/vendor.ts
12744
12828
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12745
- const session = await import_mongoose26.default.startSession();
12829
+ const session = await import_mongoose28.default.startSession();
12746
12830
  try {
12747
12831
  session.startTransaction();
12748
12832
  const user = await UserModel.findById(userId).select("vendor").lean().session(session);
@@ -12805,12 +12889,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12805
12889
  }
12806
12890
 
12807
12891
  // src/service/objectIdToString.ts
12808
- var import_mongoose28 = __toESM(require("mongoose"));
12892
+ var import_mongoose30 = __toESM(require("mongoose"));
12809
12893
  function convertObjectIdsToStrings(obj) {
12810
12894
  if (obj === null || obj === void 0) {
12811
12895
  return obj;
12812
12896
  }
12813
- if (obj instanceof import_mongoose28.default.Types.ObjectId) {
12897
+ if (obj instanceof import_mongoose30.default.Types.ObjectId) {
12814
12898
  return obj.toString();
12815
12899
  }
12816
12900
  if (Array.isArray(obj)) {