@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.
@@ -37,7 +37,7 @@ import {
37
37
  resourceRelationsSchema,
38
38
  termsAgreementSchema,
39
39
  userLicenseSchema
40
- } from "../chunk-ZKCRLNCH.mjs";
40
+ } from "../chunk-4ZDEYFIM.mjs";
41
41
  import "../chunk-3QS3WKRC.mjs";
42
42
  export {
43
43
  APP_SETTINGS_ID,
@@ -6892,6 +6892,10 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6892
6892
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
6893
6893
  return EnumSubscriptionStatus22;
6894
6894
  })(EnumSubscriptionStatus || {});
6895
+ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6896
+ EnumGameType2["DAILY_CLUE"] = "dailyClue";
6897
+ return EnumGameType2;
6898
+ })(EnumGameType || {});
6895
6899
  var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
6896
6900
  var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
6897
6901
  var gameScreenIdentifierList = [
@@ -6986,17 +6990,6 @@ var gameScreenIdentifierList = [
6986
6990
  match: "/visitors"
6987
6991
  }
6988
6992
  ];
6989
- var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6990
- EnumGameType2["DAILY_CLUE"] = "dailyClue";
6991
- return EnumGameType2;
6992
- })(EnumGameType || {});
6993
- var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus3) => {
6994
- EnumGameStatus3["GAME_COMPLETED"] = "GAME_COMPLETED";
6995
- EnumGameStatus3["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
6996
- EnumGameStatus3["GAME_LEFT"] = "GAME_LEFT";
6997
- EnumGameStatus3["GAME_STARTED"] = "GAME_STARTED";
6998
- return EnumGameStatus3;
6999
- })(EnumGameStatus || {});
7000
6993
  var dateFormat = "DD-MM-YYYY";
7001
6994
  var timeFormat = "HH:mm";
7002
6995
  import_dayjs.default.extend(import_customParseFormat.default);
@@ -7025,6 +7018,7 @@ function normalizeUrl(url) {
7025
7018
  }
7026
7019
  return url;
7027
7020
  }
7021
+ var SCHOOL_MIN_STUDENT_COUNT = 300;
7028
7022
  var packagingTypes = [
7029
7023
  "Biodegradable",
7030
7024
  "Compostable",
@@ -8687,8 +8681,8 @@ var GET_EVENTS_BY_REGION = gql`
8687
8681
  ${EVENT_LIST_ITEM}
8688
8682
  `;
8689
8683
  var SEARCH_EVENTS = gql`
8690
- query searchEvents($search: String!, $region: String) {
8691
- eventsSearch(search: $search, region: $region) {
8684
+ query searchEvents($region: String, $search: String,$tags: [String]) {
8685
+ eventsSearch(region: $region, search: $search, tags: $tags) {
8692
8686
  ...EventListItemFields
8693
8687
  }
8694
8688
  }
@@ -9994,8 +9988,8 @@ var GAME_DATE_FIELDS_FRAGMENT = gql`
9994
9988
  endDate
9995
9989
  }
9996
9990
  `;
9997
- var BASE_GAME_FIELDS_FRAGMENT = gql`
9998
- fragment BaseGameFields on BaseGameType {
9991
+ var DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT = gql`
9992
+ fragment DailyClueBaseGameFields on DailyClueBaseGameType {
9999
9993
  gameDate {
10000
9994
  ...GameDateFields
10001
9995
  }
@@ -10007,20 +10001,20 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10007
10001
  var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
10008
10002
  fragment DailyClueGameDataFields on DailyClueGameDataType {
10009
10003
  gameFields {
10010
- ...BaseGameFields
10004
+ ...DailyClueBaseGameFields
10011
10005
  }
10012
10006
  lastFoundDate
10013
10007
  points
10014
10008
  letterInfo {
10015
10009
  collected
10016
- shuffled
10017
- todaysLetter
10010
+ solutionShuffled
10018
10011
  todaysClue
10012
+ todaysLetter
10019
10013
  todaysPlacement
10020
10014
  }
10021
10015
  streak
10022
10016
  }
10023
- ${BASE_GAME_FIELDS_FRAGMENT}
10017
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10024
10018
  `;
10025
10019
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10026
10020
  fragment GameHistoryFields on GameHistoryType {
@@ -10108,6 +10102,14 @@ var GET_GAME_LEADERBOARD = gql`
10108
10102
  ${OWNER_FIELDS_FRAGMENT}
10109
10103
  ${GAME_HISTORY_FIELDS_FRAGMENT}
10110
10104
  `;
10105
+ var BASE_GAME_FIELDS_FRAGMENT = gql`
10106
+ fragment BaseGameFields on BaseGameType {
10107
+ dailyClue {
10108
+ ...DailyClueBaseGameFields
10109
+ }
10110
+ }
10111
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10112
+ `;
10111
10113
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10112
10114
  fragment PostContentDataFields on PostContentData {
10113
10115
  game {
@@ -10160,6 +10162,7 @@ var POST_FIELDS_FRAGMENT = gql`
10160
10162
  postType
10161
10163
  resource {
10162
10164
  resourceId
10165
+ resourceRegion
10163
10166
  resourceType
10164
10167
  }
10165
10168
  tags
@@ -10900,6 +10903,7 @@ var postSchema = create$3().shape({
10900
10903
  postType: create$8().oneOf(Object.values(EnumPostType)).required(),
10901
10904
  resource: create$3({
10902
10905
  resourceId: create$6().required(),
10906
+ resourceRegion: create$6().required(),
10903
10907
  resourceType: create$8().oneOf(Object.values(EnumResourceType)).required()
10904
10908
  }).nullable().optional(),
10905
10909
  tags: create$2().of(create$6().required()).nullable().optional(),
@@ -10997,7 +11001,10 @@ var schoolSchema = create$3().shape({
10997
11001
  name: create$6().trim().required("Name is required"),
10998
11002
  region: create$6().trim().required("Region is required"),
10999
11003
  socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
11000
- 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"))
11004
+ studentCount: create$5().label("Student Count").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Student count must be a number").min(
11005
+ SCHOOL_MIN_STUDENT_COUNT,
11006
+ `Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
11007
+ ).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
11001
11008
  });
11002
11009
  var PKG = "@timardex/cluemart-shared";
11003
11010
  var IMAGE_EXTENSION = ".webp";
@@ -11089,6 +11096,13 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
11089
11096
  EnumActivity2["VIEW"] = "VIEW";
11090
11097
  return EnumActivity2;
11091
11098
  })(EnumActivity || {});
11099
+ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11100
+ EnumGameStatus2["GAME_COMPLETED"] = "GAME_COMPLETED";
11101
+ EnumGameStatus2["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
11102
+ EnumGameStatus2["GAME_LEFT"] = "GAME_LEFT";
11103
+ EnumGameStatus2["GAME_STARTED"] = "GAME_STARTED";
11104
+ return EnumGameStatus2;
11105
+ })(EnumGameStatus || {});
11092
11106
 
11093
11107
  // src/mongoose/Notification.ts
11094
11108
  var import_mongoose2 = __toESM(require("mongoose"));
@@ -12425,6 +12439,7 @@ var schema13 = new MongooseSchema17(
12425
12439
  required: false,
12426
12440
  type: {
12427
12441
  resourceId: { required: true, type: String },
12442
+ resourceRegion: { required: true, type: String },
12428
12443
  resourceType: {
12429
12444
  enum: Object.values(EnumResourceType),
12430
12445
  required: true,
@@ -12464,6 +12479,9 @@ var AppSettingSchema = new MongooseSchema18(
12464
12479
  var AppSettingModel = import_mongoose19.default.models.AppSetting || import_mongoose19.default.model("AppSetting", AppSettingSchema);
12465
12480
 
12466
12481
  // src/mongoose/game/Game.ts
12482
+ var import_mongoose21 = __toESM(require("mongoose"));
12483
+
12484
+ // src/mongoose/game/utils.ts
12467
12485
  var import_mongoose20 = __toESM(require("mongoose"));
12468
12486
  var MongooseSchema19 = import_mongoose20.default.Schema;
12469
12487
  var schemaGameDate = new MongooseSchema19(
@@ -12473,7 +12491,15 @@ var schemaGameDate = new MongooseSchema19(
12473
12491
  },
12474
12492
  { _id: false }
12475
12493
  );
12476
- var schemaBaseGame = new MongooseSchema19(
12494
+ var schemaLetters = new MongooseSchema19(
12495
+ {
12496
+ collected: { required: false, type: [String] },
12497
+ solutionShuffled: { required: true, type: [String] }
12498
+ // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12499
+ },
12500
+ { _id: false }
12501
+ );
12502
+ var schemaDailyClueBaseGame = new MongooseSchema19(
12477
12503
  {
12478
12504
  gameDate: { required: true, type: schemaGameDate },
12479
12505
  gameSolution: { required: true, type: String },
@@ -12485,17 +12511,9 @@ var schemaBaseGame = new MongooseSchema19(
12485
12511
  },
12486
12512
  { _id: false }
12487
12513
  );
12488
- var schemaLetters = new MongooseSchema19(
12489
- {
12490
- collected: { required: false, type: [String] },
12491
- shuffled: { required: true, type: [String] }
12492
- // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12493
- },
12494
- { _id: false }
12495
- );
12496
- var schemaDailyClue = new MongooseSchema19(
12514
+ var schemaDailyClueGameData = new MongooseSchema19(
12497
12515
  {
12498
- gameFields: { required: true, type: schemaBaseGame },
12516
+ gameFields: { required: true, type: schemaDailyClueBaseGame },
12499
12517
  lastFoundDate: { default: null, required: false, type: Date },
12500
12518
  letterInfo: {
12501
12519
  required: true,
@@ -12506,8 +12524,11 @@ var schemaDailyClue = new MongooseSchema19(
12506
12524
  },
12507
12525
  { _id: false }
12508
12526
  );
12527
+
12528
+ // src/mongoose/game/Game.ts
12529
+ var MongooseSchema20 = import_mongoose21.default.Schema;
12509
12530
  var gameDataSchemas = {
12510
- [EnumGameType.DAILY_CLUE]: schemaDailyClue
12531
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12511
12532
  };
12512
12533
  var gameDataDefinition = Object.fromEntries(
12513
12534
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12515,7 +12536,7 @@ var gameDataDefinition = Object.fromEntries(
12515
12536
  { default: null, required: false, type: schema16 }
12516
12537
  ])
12517
12538
  );
12518
- var gameHistorySchema = new MongooseSchema19(
12539
+ var gameHistorySchema = new MongooseSchema20(
12519
12540
  {
12520
12541
  createdAt: { required: true, type: Date },
12521
12542
  gameDate: { required: true, type: schemaGameDate },
@@ -12533,7 +12554,7 @@ var gameHistorySchema = new MongooseSchema19(
12533
12554
  },
12534
12555
  { _id: false }
12535
12556
  );
12536
- var gameTypeSchema = new MongooseSchema19(
12557
+ var gameTypeSchema = new MongooseSchema20(
12537
12558
  {
12538
12559
  active: { default: true, required: true, type: Boolean },
12539
12560
  gameData: gameDataDefinition,
@@ -12546,7 +12567,7 @@ var gameTypeSchema = new MongooseSchema19(
12546
12567
  },
12547
12568
  { timestamps: true }
12548
12569
  );
12549
- var schema14 = new MongooseSchema19(
12570
+ var schema14 = new MongooseSchema20(
12550
12571
  {
12551
12572
  active: { default: false, required: true, type: Boolean },
12552
12573
  deletedAt: { default: null, required: false, type: Date },
@@ -12559,12 +12580,12 @@ var schema14 = new MongooseSchema19(
12559
12580
  },
12560
12581
  { timestamps: true }
12561
12582
  );
12562
- var GameModel = import_mongoose20.default.models.Game || import_mongoose20.default.model("Game", schema14);
12583
+ var GameModel = import_mongoose21.default.models.Game || import_mongoose21.default.model("Game", schema14);
12563
12584
 
12564
12585
  // src/mongoose/School.ts
12565
- var import_mongoose21 = __toESM(require("mongoose"));
12566
- var MongooseSchema20 = import_mongoose21.default.Schema;
12567
- var schema15 = new MongooseSchema20(
12586
+ var import_mongoose22 = __toESM(require("mongoose"));
12587
+ var MongooseSchema21 = import_mongoose22.default.Schema;
12588
+ var schema15 = new MongooseSchema21(
12568
12589
  {
12569
12590
  // New schools are active by default
12570
12591
  active: { default: true, required: true, type: Boolean },
@@ -12589,7 +12610,7 @@ var schema15 = new MongooseSchema20(
12589
12610
  },
12590
12611
  { timestamps: true }
12591
12612
  );
12592
- var SchoolModel = import_mongoose21.default.models.School || import_mongoose21.default.model("School", schema15);
12613
+ var SchoolModel = import_mongoose22.default.models.School || import_mongoose22.default.model("School", schema15);
12593
12614
 
12594
12615
  // src/service/updateAdStatus.ts
12595
12616
  async function updateAdStatuses() {
@@ -12716,12 +12737,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12716
12737
  }
12717
12738
 
12718
12739
  // src/service/objectIdToString.ts
12719
- var import_mongoose25 = __toESM(require("mongoose"));
12740
+ var import_mongoose26 = __toESM(require("mongoose"));
12720
12741
  function convertObjectIdsToStrings(obj) {
12721
12742
  if (obj === null || obj === void 0) {
12722
12743
  return obj;
12723
12744
  }
12724
- if (obj instanceof import_mongoose25.default.Types.ObjectId) {
12745
+ if (obj instanceof import_mongoose26.default.Types.ObjectId) {
12725
12746
  return obj.toString();
12726
12747
  }
12727
12748
  if (Array.isArray(obj)) {