@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.mjs CHANGED
@@ -9968,6 +9968,41 @@ var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
9968
9968
  }
9969
9969
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
9970
9970
  `;
9971
+ var MINI_QUIZ_QUESTION_FIELDS_FRAGMENT = gql`
9972
+ fragment MiniQuizQuestionFields on MiniQuizQuestionType {
9973
+ answers {
9974
+ answer
9975
+ correct
9976
+ }
9977
+ question
9978
+ }
9979
+ `;
9980
+ var MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT = gql`
9981
+ fragment MiniQuizBaseGameFields on MiniQuizBaseGameType {
9982
+ gameDate {
9983
+ ...GameDateFields
9984
+ }
9985
+ questions {
9986
+ ...MiniQuizQuestionFields
9987
+ }
9988
+ }
9989
+ ${GAME_DATE_FIELDS_FRAGMENT}
9990
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
9991
+ `;
9992
+ var MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT = gql`
9993
+ fragment MiniQuizGameDataFields on MiniQuizGameDataType {
9994
+ gameFields {
9995
+ ...MiniQuizBaseGameFields
9996
+ }
9997
+ quizInfo {
9998
+ ...MiniQuizQuestionFields
9999
+ }
10000
+ points
10001
+ streak
10002
+ }
10003
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10004
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10005
+ `;
9971
10006
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
9972
10007
  fragment GameHistoryFields on GameHistoryType {
9973
10008
  createdAt
@@ -9985,8 +10020,12 @@ var GAME_DATA_FIELDS_FRAGMENT = gql`
9985
10020
  dailyClue {
9986
10021
  ...DailyClueGameDataFields
9987
10022
  }
10023
+ miniQuiz {
10024
+ ...MiniQuizGameDataFields
10025
+ }
9988
10026
  }
9989
10027
  ${DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT}
10028
+ ${MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT}
9990
10029
  `;
9991
10030
  var GAME_FIELDS_FRAGMENT = gql`
9992
10031
  fragment GameFields on GameType {
@@ -10060,8 +10099,12 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10060
10099
  dailyClue {
10061
10100
  ...DailyClueBaseGameFields
10062
10101
  }
10102
+ miniQuiz {
10103
+ ...MiniQuizBaseGameFields
10104
+ }
10063
10105
  }
10064
10106
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10107
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10065
10108
  `;
10066
10109
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10067
10110
  fragment PostContentDataFields on PostContentData {
@@ -11058,6 +11101,7 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11058
11101
  })(EnumGameStatus || {});
11059
11102
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11060
11103
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
11104
+ EnumGameType2["MINI_QUIZ"] = "miniQuiz";
11061
11105
  return EnumGameType2;
11062
11106
  })(EnumGameType || {});
11063
11107
 
@@ -12303,6 +12347,9 @@ var AppSettingSchema = new MongooseSchema18(
12303
12347
  var AppSettingModel = mongoose18.models.AppSetting || mongoose18.model("AppSetting", AppSettingSchema);
12304
12348
 
12305
12349
  // src/mongoose/game/Game.ts
12350
+ import mongoose22 from "mongoose";
12351
+
12352
+ // src/mongoose/game/DailyClue.ts
12306
12353
  import mongoose20 from "mongoose";
12307
12354
 
12308
12355
  // src/mongoose/game/utils.ts
@@ -12315,7 +12362,10 @@ var schemaGameDate = new MongooseSchema19(
12315
12362
  },
12316
12363
  { _id: false }
12317
12364
  );
12318
- var schemaLetters = new MongooseSchema19(
12365
+
12366
+ // src/mongoose/game/DailyClue.ts
12367
+ var MongooseSchema20 = mongoose20.Schema;
12368
+ var schemaLetters = new MongooseSchema20(
12319
12369
  {
12320
12370
  collected: { required: false, type: [String] },
12321
12371
  solutionShuffled: { required: true, type: [String] }
@@ -12323,14 +12373,14 @@ var schemaLetters = new MongooseSchema19(
12323
12373
  },
12324
12374
  { _id: false }
12325
12375
  );
12326
- var schemaDailyClueBaseGame = new MongooseSchema19(
12376
+ var schemaDailyClueBaseGame = new MongooseSchema20(
12327
12377
  {
12328
12378
  gameDate: { required: true, type: schemaGameDate },
12329
12379
  gameSolution: { required: true, type: String }
12330
12380
  },
12331
12381
  { _id: false }
12332
12382
  );
12333
- var schemaDailyClueGameData = new MongooseSchema19(
12383
+ var schemaDailyClueGameData = new MongooseSchema20(
12334
12384
  {
12335
12385
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12336
12386
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12344,10 +12394,49 @@ var schemaDailyClueGameData = new MongooseSchema19(
12344
12394
  { _id: false }
12345
12395
  );
12346
12396
 
12397
+ // src/mongoose/game/MiniQuiz.ts
12398
+ import mongoose21 from "mongoose";
12399
+ var MongooseSchema21 = mongoose21.Schema;
12400
+ var schemaMiniQuizAnswers = new MongooseSchema21(
12401
+ {
12402
+ answer: { required: true, type: String },
12403
+ correct: { required: true, type: Boolean }
12404
+ },
12405
+ { _id: false }
12406
+ );
12407
+ var schemaMiniQuizQuestions = new MongooseSchema21(
12408
+ {
12409
+ answers: { required: true, type: [schemaMiniQuizAnswers] },
12410
+ question: { required: true, type: String }
12411
+ },
12412
+ { _id: false }
12413
+ );
12414
+ var schemaMiniQuizBaseGame = new MongooseSchema21(
12415
+ {
12416
+ gameDate: { required: true, type: Date },
12417
+ questions: { required: true, type: [schemaMiniQuizQuestions] }
12418
+ },
12419
+ { _id: false }
12420
+ );
12421
+ var schemaMiniQuizGameData = new MongooseSchema21(
12422
+ {
12423
+ gameFields: { required: true, type: schemaMiniQuizBaseGame },
12424
+ points: { default: 0, required: true, type: Number },
12425
+ quizInfo: {
12426
+ default: null,
12427
+ required: false,
12428
+ type: [schemaMiniQuizQuestions]
12429
+ },
12430
+ streak: { default: 0, required: true, type: Number }
12431
+ },
12432
+ { _id: false }
12433
+ );
12434
+
12347
12435
  // src/mongoose/game/Game.ts
12348
- var MongooseSchema20 = mongoose20.Schema;
12436
+ var MongooseSchema22 = mongoose22.Schema;
12349
12437
  var gameDataSchemas = {
12350
- [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12438
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12439
+ [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12351
12440
  };
12352
12441
  var gameDataDefinition = Object.fromEntries(
12353
12442
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12355,7 +12444,7 @@ var gameDataDefinition = Object.fromEntries(
12355
12444
  { default: null, required: false, type: schema16 }
12356
12445
  ])
12357
12446
  );
12358
- var gameHistorySchema = new MongooseSchema20(
12447
+ var gameHistorySchema = new MongooseSchema22(
12359
12448
  {
12360
12449
  createdAt: { required: true, type: Date },
12361
12450
  gameDate: { required: true, type: schemaGameDate },
@@ -12373,7 +12462,7 @@ var gameHistorySchema = new MongooseSchema20(
12373
12462
  },
12374
12463
  { _id: false }
12375
12464
  );
12376
- var gameTypeSchema = new MongooseSchema20(
12465
+ var gameTypeSchema = new MongooseSchema22(
12377
12466
  {
12378
12467
  active: { default: true, required: true, type: Boolean },
12379
12468
  gameData: gameDataDefinition,
@@ -12386,7 +12475,7 @@ var gameTypeSchema = new MongooseSchema20(
12386
12475
  },
12387
12476
  { timestamps: true }
12388
12477
  );
12389
- var schema14 = new MongooseSchema20(
12478
+ var schema14 = new MongooseSchema22(
12390
12479
  {
12391
12480
  active: { default: false, required: true, type: Boolean },
12392
12481
  deletedAt: { default: null, required: false, type: Date },
@@ -12399,12 +12488,12 @@ var schema14 = new MongooseSchema20(
12399
12488
  },
12400
12489
  { timestamps: true }
12401
12490
  );
12402
- var GameModel = mongoose20.models.Game || mongoose20.model("Game", schema14);
12491
+ var GameModel = mongoose22.models.Game || mongoose22.model("Game", schema14);
12403
12492
 
12404
12493
  // src/mongoose/School.ts
12405
- import mongoose21 from "mongoose";
12406
- var MongooseSchema21 = mongoose21.Schema;
12407
- var schema15 = new MongooseSchema21(
12494
+ import mongoose23 from "mongoose";
12495
+ var MongooseSchema23 = mongoose23.Schema;
12496
+ var schema15 = new MongooseSchema23(
12408
12497
  {
12409
12498
  // New schools are active by default
12410
12499
  active: { default: true, required: true, type: Boolean },
@@ -12429,10 +12518,10 @@ var schema15 = new MongooseSchema21(
12429
12518
  },
12430
12519
  { timestamps: true }
12431
12520
  );
12432
- var SchoolModel = mongoose21.models.School || mongoose21.model("School", schema15);
12521
+ var SchoolModel = mongoose23.models.School || mongoose23.model("School", schema15);
12433
12522
 
12434
12523
  // src/service/database.ts
12435
- import mongoose22 from "mongoose";
12524
+ import mongoose24 from "mongoose";
12436
12525
  var connectToDatabase = async ({
12437
12526
  appName,
12438
12527
  dbName,
@@ -12445,7 +12534,7 @@ var connectToDatabase = async ({
12445
12534
  // Fallback to MongoDB Atlas connection string
12446
12535
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12447
12536
  );
12448
- await mongoose22.connect(mongoUri);
12537
+ await mongoose24.connect(mongoUri);
12449
12538
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12450
12539
  console.log(
12451
12540
  `${connectionType} connected from server/src/service/database.ts`
@@ -12624,18 +12713,18 @@ async function updateAdStatuses() {
12624
12713
  }
12625
12714
 
12626
12715
  // src/service/vendor.ts
12627
- import mongoose24 from "mongoose";
12716
+ import mongoose26 from "mongoose";
12628
12717
 
12629
12718
  // src/service/associate.ts
12630
- import mongoose23 from "mongoose";
12719
+ import mongoose25 from "mongoose";
12631
12720
  async function removeAssociateFromResource({
12632
12721
  resourceId,
12633
12722
  resourceOwnerId,
12634
12723
  resourceType
12635
12724
  }) {
12636
12725
  const normalizedResourceId = resourceId.toString();
12637
- const normalizedOwnerId = typeof resourceOwnerId === "string" ? new mongoose23.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12638
- const session = await mongoose23.startSession();
12726
+ const normalizedOwnerId = typeof resourceOwnerId === "string" ? new mongoose25.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12727
+ const session = await mongoose25.startSession();
12639
12728
  try {
12640
12729
  session.startTransaction();
12641
12730
  const usersWithAssociates = await UserModel.find(
@@ -12721,7 +12810,7 @@ async function removeAssociateFromResource({
12721
12810
 
12722
12811
  // src/service/vendor.ts
12723
12812
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12724
- const session = await mongoose24.startSession();
12813
+ const session = await mongoose26.startSession();
12725
12814
  try {
12726
12815
  session.startTransaction();
12727
12816
  const user = await UserModel.findById(userId).select("vendor").lean().session(session);
@@ -12784,12 +12873,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12784
12873
  }
12785
12874
 
12786
12875
  // src/service/objectIdToString.ts
12787
- import mongoose25 from "mongoose";
12876
+ import mongoose27 from "mongoose";
12788
12877
  function convertObjectIdsToStrings(obj) {
12789
12878
  if (obj === null || obj === void 0) {
12790
12879
  return obj;
12791
12880
  }
12792
- if (obj instanceof mongoose25.Types.ObjectId) {
12881
+ if (obj instanceof mongoose27.Types.ObjectId) {
12793
12882
  return obj.toString();
12794
12883
  }
12795
12884
  if (Array.isArray(obj)) {
@@ -12820,7 +12909,7 @@ async function findEventOrImportedMarketById(resourceId) {
12820
12909
 
12821
12910
  // src/types/index.ts
12822
12911
  import express from "express";
12823
- import mongoose26 from "mongoose";
12912
+ import mongoose28 from "mongoose";
12824
12913
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12825
12914
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12826
12915
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -12866,7 +12955,7 @@ export {
12866
12955
  findEventOrImportedMarketById,
12867
12956
  locationGeoSchema,
12868
12957
  locationsSchema,
12869
- mongoose26 as mongoose,
12958
+ mongoose28 as mongoose,
12870
12959
  refundPolicySchema,
12871
12960
  relationDatesSchema,
12872
12961
  resourceRelationsSchema,