@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.mjs CHANGED
@@ -9968,6 +9968,37 @@ 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
+ questions {
9983
+ ...MiniQuizQuestionFields
9984
+ }
9985
+ }
9986
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
9987
+ `;
9988
+ var MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT = gql`
9989
+ fragment MiniQuizGameDataFields on MiniQuizGameDataType {
9990
+ gameFields {
9991
+ ...MiniQuizBaseGameFields
9992
+ }
9993
+ quizInfo {
9994
+ ...MiniQuizQuestionFields
9995
+ }
9996
+ points
9997
+ streak
9998
+ }
9999
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10000
+ ${MINI_QUIZ_QUESTION_FIELDS_FRAGMENT}
10001
+ `;
9971
10002
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
9972
10003
  fragment GameHistoryFields on GameHistoryType {
9973
10004
  createdAt
@@ -9985,8 +10016,12 @@ var GAME_DATA_FIELDS_FRAGMENT = gql`
9985
10016
  dailyClue {
9986
10017
  ...DailyClueGameDataFields
9987
10018
  }
10019
+ miniQuiz {
10020
+ ...MiniQuizGameDataFields
10021
+ }
9988
10022
  }
9989
10023
  ${DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT}
10024
+ ${MINI_QUIZ_GAME_DATA_FIELDS_FRAGMENT}
9990
10025
  `;
9991
10026
  var GAME_FIELDS_FRAGMENT = gql`
9992
10027
  fragment GameFields on GameType {
@@ -10060,8 +10095,12 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10060
10095
  dailyClue {
10061
10096
  ...DailyClueBaseGameFields
10062
10097
  }
10098
+ miniQuiz {
10099
+ ...MiniQuizBaseGameFields
10100
+ }
10063
10101
  }
10064
10102
  ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10103
+ ${MINI_QUIZ_BASE_GAME_FIELDS_FRAGMENT}
10065
10104
  `;
10066
10105
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10067
10106
  fragment PostContentDataFields on PostContentData {
@@ -11058,6 +11097,7 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11058
11097
  })(EnumGameStatus || {});
11059
11098
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11060
11099
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
11100
+ EnumGameType2["MINI_QUIZ"] = "miniQuiz";
11061
11101
  return EnumGameType2;
11062
11102
  })(EnumGameType || {});
11063
11103
 
@@ -12303,6 +12343,9 @@ var AppSettingSchema = new MongooseSchema18(
12303
12343
  var AppSettingModel = mongoose18.models.AppSetting || mongoose18.model("AppSetting", AppSettingSchema);
12304
12344
 
12305
12345
  // src/mongoose/game/Game.ts
12346
+ import mongoose22 from "mongoose";
12347
+
12348
+ // src/mongoose/game/DailyClue.ts
12306
12349
  import mongoose20 from "mongoose";
12307
12350
 
12308
12351
  // src/mongoose/game/utils.ts
@@ -12315,7 +12358,10 @@ var schemaGameDate = new MongooseSchema19(
12315
12358
  },
12316
12359
  { _id: false }
12317
12360
  );
12318
- var schemaLetters = new MongooseSchema19(
12361
+
12362
+ // src/mongoose/game/DailyClue.ts
12363
+ var MongooseSchema20 = mongoose20.Schema;
12364
+ var schemaLetters = new MongooseSchema20(
12319
12365
  {
12320
12366
  collected: { required: false, type: [String] },
12321
12367
  solutionShuffled: { required: true, type: [String] }
@@ -12323,14 +12369,14 @@ var schemaLetters = new MongooseSchema19(
12323
12369
  },
12324
12370
  { _id: false }
12325
12371
  );
12326
- var schemaDailyClueBaseGame = new MongooseSchema19(
12372
+ var schemaDailyClueBaseGame = new MongooseSchema20(
12327
12373
  {
12328
12374
  gameDate: { required: true, type: schemaGameDate },
12329
12375
  gameSolution: { required: true, type: String }
12330
12376
  },
12331
12377
  { _id: false }
12332
12378
  );
12333
- var schemaDailyClueGameData = new MongooseSchema19(
12379
+ var schemaDailyClueGameData = new MongooseSchema20(
12334
12380
  {
12335
12381
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12336
12382
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12344,10 +12390,48 @@ var schemaDailyClueGameData = new MongooseSchema19(
12344
12390
  { _id: false }
12345
12391
  );
12346
12392
 
12393
+ // src/mongoose/game/MiniQuiz.ts
12394
+ import mongoose21 from "mongoose";
12395
+ var MongooseSchema21 = mongoose21.Schema;
12396
+ var schemaMiniQuizAnswers = new MongooseSchema21(
12397
+ {
12398
+ answer: { required: true, type: String },
12399
+ correct: { required: true, type: Boolean }
12400
+ },
12401
+ { _id: false }
12402
+ );
12403
+ var schemaMiniQuizQuestions = new MongooseSchema21(
12404
+ {
12405
+ answers: { required: true, type: [schemaMiniQuizAnswers] },
12406
+ question: { required: true, type: String }
12407
+ },
12408
+ { _id: false }
12409
+ );
12410
+ var schemaMiniQuizBaseGame = new MongooseSchema21(
12411
+ {
12412
+ questions: { required: true, type: [schemaMiniQuizQuestions] }
12413
+ },
12414
+ { _id: false }
12415
+ );
12416
+ var schemaMiniQuizGameData = new MongooseSchema21(
12417
+ {
12418
+ gameFields: { required: true, type: schemaMiniQuizBaseGame },
12419
+ points: { default: 0, required: true, type: Number },
12420
+ quizInfo: {
12421
+ default: null,
12422
+ required: false,
12423
+ type: [schemaMiniQuizQuestions]
12424
+ },
12425
+ streak: { default: 0, required: true, type: Number }
12426
+ },
12427
+ { _id: false }
12428
+ );
12429
+
12347
12430
  // src/mongoose/game/Game.ts
12348
- var MongooseSchema20 = mongoose20.Schema;
12431
+ var MongooseSchema22 = mongoose22.Schema;
12349
12432
  var gameDataSchemas = {
12350
- [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12433
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12434
+ [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12351
12435
  };
12352
12436
  var gameDataDefinition = Object.fromEntries(
12353
12437
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12355,7 +12439,7 @@ var gameDataDefinition = Object.fromEntries(
12355
12439
  { default: null, required: false, type: schema16 }
12356
12440
  ])
12357
12441
  );
12358
- var gameHistorySchema = new MongooseSchema20(
12442
+ var gameHistorySchema = new MongooseSchema22(
12359
12443
  {
12360
12444
  createdAt: { required: true, type: Date },
12361
12445
  gameDate: { required: true, type: schemaGameDate },
@@ -12373,7 +12457,7 @@ var gameHistorySchema = new MongooseSchema20(
12373
12457
  },
12374
12458
  { _id: false }
12375
12459
  );
12376
- var gameTypeSchema = new MongooseSchema20(
12460
+ var gameTypeSchema = new MongooseSchema22(
12377
12461
  {
12378
12462
  active: { default: true, required: true, type: Boolean },
12379
12463
  gameData: gameDataDefinition,
@@ -12386,7 +12470,7 @@ var gameTypeSchema = new MongooseSchema20(
12386
12470
  },
12387
12471
  { timestamps: true }
12388
12472
  );
12389
- var schema14 = new MongooseSchema20(
12473
+ var schema14 = new MongooseSchema22(
12390
12474
  {
12391
12475
  active: { default: false, required: true, type: Boolean },
12392
12476
  deletedAt: { default: null, required: false, type: Date },
@@ -12399,12 +12483,12 @@ var schema14 = new MongooseSchema20(
12399
12483
  },
12400
12484
  { timestamps: true }
12401
12485
  );
12402
- var GameModel = mongoose20.models.Game || mongoose20.model("Game", schema14);
12486
+ var GameModel = mongoose22.models.Game || mongoose22.model("Game", schema14);
12403
12487
 
12404
12488
  // src/mongoose/School.ts
12405
- import mongoose21 from "mongoose";
12406
- var MongooseSchema21 = mongoose21.Schema;
12407
- var schema15 = new MongooseSchema21(
12489
+ import mongoose23 from "mongoose";
12490
+ var MongooseSchema23 = mongoose23.Schema;
12491
+ var schema15 = new MongooseSchema23(
12408
12492
  {
12409
12493
  // New schools are active by default
12410
12494
  active: { default: true, required: true, type: Boolean },
@@ -12429,10 +12513,10 @@ var schema15 = new MongooseSchema21(
12429
12513
  },
12430
12514
  { timestamps: true }
12431
12515
  );
12432
- var SchoolModel = mongoose21.models.School || mongoose21.model("School", schema15);
12516
+ var SchoolModel = mongoose23.models.School || mongoose23.model("School", schema15);
12433
12517
 
12434
12518
  // src/service/database.ts
12435
- import mongoose22 from "mongoose";
12519
+ import mongoose24 from "mongoose";
12436
12520
  var connectToDatabase = async ({
12437
12521
  appName,
12438
12522
  dbName,
@@ -12445,7 +12529,7 @@ var connectToDatabase = async ({
12445
12529
  // Fallback to MongoDB Atlas connection string
12446
12530
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12447
12531
  );
12448
- await mongoose22.connect(mongoUri);
12532
+ await mongoose24.connect(mongoUri);
12449
12533
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12450
12534
  console.log(
12451
12535
  `${connectionType} connected from server/src/service/database.ts`
@@ -12624,18 +12708,18 @@ async function updateAdStatuses() {
12624
12708
  }
12625
12709
 
12626
12710
  // src/service/vendor.ts
12627
- import mongoose24 from "mongoose";
12711
+ import mongoose26 from "mongoose";
12628
12712
 
12629
12713
  // src/service/associate.ts
12630
- import mongoose23 from "mongoose";
12714
+ import mongoose25 from "mongoose";
12631
12715
  async function removeAssociateFromResource({
12632
12716
  resourceId,
12633
12717
  resourceOwnerId,
12634
12718
  resourceType
12635
12719
  }) {
12636
12720
  const normalizedResourceId = resourceId.toString();
12637
- const normalizedOwnerId = typeof resourceOwnerId === "string" ? new mongoose23.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12638
- const session = await mongoose23.startSession();
12721
+ const normalizedOwnerId = typeof resourceOwnerId === "string" ? new mongoose25.Types.ObjectId(resourceOwnerId) : resourceOwnerId;
12722
+ const session = await mongoose25.startSession();
12639
12723
  try {
12640
12724
  session.startTransaction();
12641
12725
  const usersWithAssociates = await UserModel.find(
@@ -12721,7 +12805,7 @@ async function removeAssociateFromResource({
12721
12805
 
12722
12806
  // src/service/vendor.ts
12723
12807
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12724
- const session = await mongoose24.startSession();
12808
+ const session = await mongoose26.startSession();
12725
12809
  try {
12726
12810
  session.startTransaction();
12727
12811
  const user = await UserModel.findById(userId).select("vendor").lean().session(session);
@@ -12784,12 +12868,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12784
12868
  }
12785
12869
 
12786
12870
  // src/service/objectIdToString.ts
12787
- import mongoose25 from "mongoose";
12871
+ import mongoose27 from "mongoose";
12788
12872
  function convertObjectIdsToStrings(obj) {
12789
12873
  if (obj === null || obj === void 0) {
12790
12874
  return obj;
12791
12875
  }
12792
- if (obj instanceof mongoose25.Types.ObjectId) {
12876
+ if (obj instanceof mongoose27.Types.ObjectId) {
12793
12877
  return obj.toString();
12794
12878
  }
12795
12879
  if (Array.isArray(obj)) {
@@ -12820,7 +12904,7 @@ async function findEventOrImportedMarketById(resourceId) {
12820
12904
 
12821
12905
  // src/types/index.ts
12822
12906
  import express from "express";
12823
- import mongoose26 from "mongoose";
12907
+ import mongoose28 from "mongoose";
12824
12908
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12825
12909
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12826
12910
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -12866,7 +12950,7 @@ export {
12866
12950
  findEventOrImportedMarketById,
12867
12951
  locationGeoSchema,
12868
12952
  locationsSchema,
12869
- mongoose26 as mongoose,
12953
+ mongoose28 as mongoose,
12870
12954
  refundPolicySchema,
12871
12955
  relationDatesSchema,
12872
12956
  resourceRelationsSchema,