@timardex/cluemart-server-shared 1.0.145 → 1.0.147

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
@@ -6848,6 +6848,10 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6848
6848
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
6849
6849
  return EnumSubscriptionStatus22;
6850
6850
  })(EnumSubscriptionStatus || {});
6851
+ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6852
+ EnumGameType2["DAILY_CLUE"] = "dailyClue";
6853
+ return EnumGameType2;
6854
+ })(EnumGameType || {});
6851
6855
  var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
6852
6856
  var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
6853
6857
  var gameScreenIdentifierList = [
@@ -6942,17 +6946,6 @@ var gameScreenIdentifierList = [
6942
6946
  match: "/visitors"
6943
6947
  }
6944
6948
  ];
6945
- var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6946
- EnumGameType2["DAILY_CLUE"] = "dailyClue";
6947
- return EnumGameType2;
6948
- })(EnumGameType || {});
6949
- var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus3) => {
6950
- EnumGameStatus3["GAME_COMPLETED"] = "GAME_COMPLETED";
6951
- EnumGameStatus3["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
6952
- EnumGameStatus3["GAME_LEFT"] = "GAME_LEFT";
6953
- EnumGameStatus3["GAME_STARTED"] = "GAME_STARTED";
6954
- return EnumGameStatus3;
6955
- })(EnumGameStatus || {});
6956
6949
  var dateFormat = "DD-MM-YYYY";
6957
6950
  var timeFormat = "HH:mm";
6958
6951
  dayjs.extend(customParseFormat);
@@ -6981,6 +6974,7 @@ function normalizeUrl(url) {
6981
6974
  }
6982
6975
  return url;
6983
6976
  }
6977
+ var SCHOOL_MIN_STUDENT_COUNT = 300;
6984
6978
  var packagingTypes = [
6985
6979
  "Biodegradable",
6986
6980
  "Compostable",
@@ -8643,8 +8637,8 @@ var GET_EVENTS_BY_REGION = gql`
8643
8637
  ${EVENT_LIST_ITEM}
8644
8638
  `;
8645
8639
  var SEARCH_EVENTS = gql`
8646
- query searchEvents($search: String!, $region: String) {
8647
- eventsSearch(search: $search, region: $region) {
8640
+ query searchEvents($region: String, $search: String,$tags: [String]) {
8641
+ eventsSearch(region: $region, search: $search, tags: $tags) {
8648
8642
  ...EventListItemFields
8649
8643
  }
8650
8644
  }
@@ -9950,8 +9944,8 @@ var GAME_DATE_FIELDS_FRAGMENT = gql`
9950
9944
  endDate
9951
9945
  }
9952
9946
  `;
9953
- var BASE_GAME_FIELDS_FRAGMENT = gql`
9954
- fragment BaseGameFields on BaseGameType {
9947
+ var DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT = gql`
9948
+ fragment DailyClueBaseGameFields on DailyClueBaseGameType {
9955
9949
  gameDate {
9956
9950
  ...GameDateFields
9957
9951
  }
@@ -9963,20 +9957,20 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
9963
9957
  var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
9964
9958
  fragment DailyClueGameDataFields on DailyClueGameDataType {
9965
9959
  gameFields {
9966
- ...BaseGameFields
9960
+ ...DailyClueBaseGameFields
9967
9961
  }
9968
9962
  lastFoundDate
9969
9963
  points
9970
9964
  letterInfo {
9971
9965
  collected
9972
- shuffled
9973
- todaysLetter
9966
+ solutionShuffled
9974
9967
  todaysClue
9968
+ todaysLetter
9975
9969
  todaysPlacement
9976
9970
  }
9977
9971
  streak
9978
9972
  }
9979
- ${BASE_GAME_FIELDS_FRAGMENT}
9973
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
9980
9974
  `;
9981
9975
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
9982
9976
  fragment GameHistoryFields on GameHistoryType {
@@ -10064,6 +10058,14 @@ var GET_GAME_LEADERBOARD = gql`
10064
10058
  ${OWNER_FIELDS_FRAGMENT}
10065
10059
  ${GAME_HISTORY_FIELDS_FRAGMENT}
10066
10060
  `;
10061
+ var BASE_GAME_FIELDS_FRAGMENT = gql`
10062
+ fragment BaseGameFields on BaseGameType {
10063
+ dailyClue {
10064
+ ...DailyClueBaseGameFields
10065
+ }
10066
+ }
10067
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10068
+ `;
10067
10069
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10068
10070
  fragment PostContentDataFields on PostContentData {
10069
10071
  game {
@@ -10116,6 +10118,7 @@ var POST_FIELDS_FRAGMENT = gql`
10116
10118
  postType
10117
10119
  resource {
10118
10120
  resourceId
10121
+ resourceRegion
10119
10122
  resourceType
10120
10123
  }
10121
10124
  tags
@@ -10856,6 +10859,7 @@ var postSchema = create$3().shape({
10856
10859
  postType: create$8().oneOf(Object.values(EnumPostType)).required(),
10857
10860
  resource: create$3({
10858
10861
  resourceId: create$6().required(),
10862
+ resourceRegion: create$6().required(),
10859
10863
  resourceType: create$8().oneOf(Object.values(EnumResourceType)).required()
10860
10864
  }).nullable().optional(),
10861
10865
  tags: create$2().of(create$6().required()).nullable().optional(),
@@ -10953,7 +10957,10 @@ var schoolSchema = create$3().shape({
10953
10957
  name: create$6().trim().required("Name is required"),
10954
10958
  region: create$6().trim().required("Region is required"),
10955
10959
  socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
10956
- studentCount: create$5().label("Student Count").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Student count must be a number").min(350, "Student count must be at least 350").required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
10960
+ studentCount: create$5().label("Student Count").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Student count must be a number").min(
10961
+ SCHOOL_MIN_STUDENT_COUNT,
10962
+ `Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
10963
+ ).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
10957
10964
  });
10958
10965
  var PKG = "@timardex/cluemart-shared";
10959
10966
  var IMAGE_EXTENSION = ".webp";
@@ -11045,6 +11052,13 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
11045
11052
  EnumActivity2["VIEW"] = "VIEW";
11046
11053
  return EnumActivity2;
11047
11054
  })(EnumActivity || {});
11055
+ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11056
+ EnumGameStatus2["GAME_COMPLETED"] = "GAME_COMPLETED";
11057
+ EnumGameStatus2["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
11058
+ EnumGameStatus2["GAME_LEFT"] = "GAME_LEFT";
11059
+ EnumGameStatus2["GAME_STARTED"] = "GAME_STARTED";
11060
+ return EnumGameStatus2;
11061
+ })(EnumGameStatus || {});
11048
11062
 
11049
11063
  // src/mongoose/Ad.ts
11050
11064
  import mongoose from "mongoose";
@@ -12247,6 +12261,7 @@ var schema13 = new MongooseSchema17(
12247
12261
  required: false,
12248
12262
  type: {
12249
12263
  resourceId: { required: true, type: String },
12264
+ resourceRegion: { required: true, type: String },
12250
12265
  resourceType: {
12251
12266
  enum: Object.values(EnumResourceType),
12252
12267
  required: true,
@@ -12286,6 +12301,9 @@ var AppSettingSchema = new MongooseSchema18(
12286
12301
  var AppSettingModel = mongoose18.models.AppSetting || mongoose18.model("AppSetting", AppSettingSchema);
12287
12302
 
12288
12303
  // src/mongoose/game/Game.ts
12304
+ import mongoose20 from "mongoose";
12305
+
12306
+ // src/mongoose/game/utils.ts
12289
12307
  import mongoose19 from "mongoose";
12290
12308
  var MongooseSchema19 = mongoose19.Schema;
12291
12309
  var schemaGameDate = new MongooseSchema19(
@@ -12295,7 +12313,15 @@ var schemaGameDate = new MongooseSchema19(
12295
12313
  },
12296
12314
  { _id: false }
12297
12315
  );
12298
- var schemaBaseGame = new MongooseSchema19(
12316
+ var schemaLetters = new MongooseSchema19(
12317
+ {
12318
+ collected: { required: false, type: [String] },
12319
+ solutionShuffled: { required: true, type: [String] }
12320
+ // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12321
+ },
12322
+ { _id: false }
12323
+ );
12324
+ var schemaDailyClueBaseGame = new MongooseSchema19(
12299
12325
  {
12300
12326
  gameDate: { required: true, type: schemaGameDate },
12301
12327
  gameSolution: { required: true, type: String },
@@ -12307,17 +12333,9 @@ var schemaBaseGame = new MongooseSchema19(
12307
12333
  },
12308
12334
  { _id: false }
12309
12335
  );
12310
- var schemaLetters = new MongooseSchema19(
12336
+ var schemaDailyClueGameData = new MongooseSchema19(
12311
12337
  {
12312
- collected: { required: false, type: [String] },
12313
- shuffled: { required: true, type: [String] }
12314
- // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12315
- },
12316
- { _id: false }
12317
- );
12318
- var schemaDailyClue = new MongooseSchema19(
12319
- {
12320
- gameFields: { required: true, type: schemaBaseGame },
12338
+ gameFields: { required: true, type: schemaDailyClueBaseGame },
12321
12339
  lastFoundDate: { default: null, required: false, type: Date },
12322
12340
  letterInfo: {
12323
12341
  required: true,
@@ -12328,8 +12346,11 @@ var schemaDailyClue = new MongooseSchema19(
12328
12346
  },
12329
12347
  { _id: false }
12330
12348
  );
12349
+
12350
+ // src/mongoose/game/Game.ts
12351
+ var MongooseSchema20 = mongoose20.Schema;
12331
12352
  var gameDataSchemas = {
12332
- [EnumGameType.DAILY_CLUE]: schemaDailyClue
12353
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12333
12354
  };
12334
12355
  var gameDataDefinition = Object.fromEntries(
12335
12356
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12337,7 +12358,7 @@ var gameDataDefinition = Object.fromEntries(
12337
12358
  { default: null, required: false, type: schema16 }
12338
12359
  ])
12339
12360
  );
12340
- var gameHistorySchema = new MongooseSchema19(
12361
+ var gameHistorySchema = new MongooseSchema20(
12341
12362
  {
12342
12363
  createdAt: { required: true, type: Date },
12343
12364
  gameDate: { required: true, type: schemaGameDate },
@@ -12355,7 +12376,7 @@ var gameHistorySchema = new MongooseSchema19(
12355
12376
  },
12356
12377
  { _id: false }
12357
12378
  );
12358
- var gameTypeSchema = new MongooseSchema19(
12379
+ var gameTypeSchema = new MongooseSchema20(
12359
12380
  {
12360
12381
  active: { default: true, required: true, type: Boolean },
12361
12382
  gameData: gameDataDefinition,
@@ -12368,7 +12389,7 @@ var gameTypeSchema = new MongooseSchema19(
12368
12389
  },
12369
12390
  { timestamps: true }
12370
12391
  );
12371
- var schema14 = new MongooseSchema19(
12392
+ var schema14 = new MongooseSchema20(
12372
12393
  {
12373
12394
  active: { default: false, required: true, type: Boolean },
12374
12395
  deletedAt: { default: null, required: false, type: Date },
@@ -12381,12 +12402,12 @@ var schema14 = new MongooseSchema19(
12381
12402
  },
12382
12403
  { timestamps: true }
12383
12404
  );
12384
- var GameModel = mongoose19.models.Game || mongoose19.model("Game", schema14);
12405
+ var GameModel = mongoose20.models.Game || mongoose20.model("Game", schema14);
12385
12406
 
12386
12407
  // src/mongoose/School.ts
12387
- import mongoose20 from "mongoose";
12388
- var MongooseSchema20 = mongoose20.Schema;
12389
- var schema15 = new MongooseSchema20(
12408
+ import mongoose21 from "mongoose";
12409
+ var MongooseSchema21 = mongoose21.Schema;
12410
+ var schema15 = new MongooseSchema21(
12390
12411
  {
12391
12412
  // New schools are active by default
12392
12413
  active: { default: true, required: true, type: Boolean },
@@ -12411,10 +12432,10 @@ var schema15 = new MongooseSchema20(
12411
12432
  },
12412
12433
  { timestamps: true }
12413
12434
  );
12414
- var SchoolModel = mongoose20.models.School || mongoose20.model("School", schema15);
12435
+ var SchoolModel = mongoose21.models.School || mongoose21.model("School", schema15);
12415
12436
 
12416
12437
  // src/service/database.ts
12417
- import mongoose21 from "mongoose";
12438
+ import mongoose22 from "mongoose";
12418
12439
  var connectToDatabase = async ({
12419
12440
  appName,
12420
12441
  dbName,
@@ -12427,7 +12448,7 @@ var connectToDatabase = async ({
12427
12448
  // Fallback to MongoDB Atlas connection string
12428
12449
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12429
12450
  );
12430
- await mongoose21.connect(mongoUri);
12451
+ await mongoose22.connect(mongoUri);
12431
12452
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12432
12453
  console.log(
12433
12454
  `${connectionType} connected from server/src/service/database.ts`
@@ -12695,12 +12716,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12695
12716
  }
12696
12717
 
12697
12718
  // src/service/objectIdToString.ts
12698
- import mongoose22 from "mongoose";
12719
+ import mongoose23 from "mongoose";
12699
12720
  function convertObjectIdsToStrings(obj) {
12700
12721
  if (obj === null || obj === void 0) {
12701
12722
  return obj;
12702
12723
  }
12703
- if (obj instanceof mongoose22.Types.ObjectId) {
12724
+ if (obj instanceof mongoose23.Types.ObjectId) {
12704
12725
  return obj.toString();
12705
12726
  }
12706
12727
  if (Array.isArray(obj)) {
@@ -12731,7 +12752,7 @@ async function findEventOrImportedMarketById(resourceId) {
12731
12752
 
12732
12753
  // src/types/index.ts
12733
12754
  import express from "express";
12734
- import mongoose23 from "mongoose";
12755
+ import mongoose24 from "mongoose";
12735
12756
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12736
12757
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12737
12758
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -12778,7 +12799,7 @@ export {
12778
12799
  findEventOrImportedMarketById,
12779
12800
  locationGeoSchema,
12780
12801
  locationsSchema,
12781
- mongoose23 as mongoose,
12802
+ mongoose24 as mongoose,
12782
12803
  refundPolicySchema,
12783
12804
  relationDatesSchema,
12784
12805
  resourceRelationsSchema,