@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.
@@ -6898,6 +6898,10 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6898
6898
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
6899
6899
  return EnumSubscriptionStatus22;
6900
6900
  })(EnumSubscriptionStatus || {});
6901
+ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6902
+ EnumGameType2["DAILY_CLUE"] = "dailyClue";
6903
+ return EnumGameType2;
6904
+ })(EnumGameType || {});
6901
6905
  var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
6902
6906
  var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
6903
6907
  var gameScreenIdentifierList = [
@@ -6992,17 +6996,6 @@ var gameScreenIdentifierList = [
6992
6996
  match: "/visitors"
6993
6997
  }
6994
6998
  ];
6995
- var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6996
- EnumGameType2["DAILY_CLUE"] = "dailyClue";
6997
- return EnumGameType2;
6998
- })(EnumGameType || {});
6999
- var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus3) => {
7000
- EnumGameStatus3["GAME_COMPLETED"] = "GAME_COMPLETED";
7001
- EnumGameStatus3["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
7002
- EnumGameStatus3["GAME_LEFT"] = "GAME_LEFT";
7003
- EnumGameStatus3["GAME_STARTED"] = "GAME_STARTED";
7004
- return EnumGameStatus3;
7005
- })(EnumGameStatus || {});
7006
6999
  var dateFormat = "DD-MM-YYYY";
7007
7000
  var timeFormat = "HH:mm";
7008
7001
  import_dayjs.default.extend(import_customParseFormat.default);
@@ -7031,6 +7024,7 @@ function normalizeUrl(url) {
7031
7024
  }
7032
7025
  return url;
7033
7026
  }
7027
+ var SCHOOL_MIN_STUDENT_COUNT = 300;
7034
7028
  var packagingTypes = [
7035
7029
  "Biodegradable",
7036
7030
  "Compostable",
@@ -8693,8 +8687,8 @@ var GET_EVENTS_BY_REGION = gql`
8693
8687
  ${EVENT_LIST_ITEM}
8694
8688
  `;
8695
8689
  var SEARCH_EVENTS = gql`
8696
- query searchEvents($search: String!, $region: String) {
8697
- eventsSearch(search: $search, region: $region) {
8690
+ query searchEvents($region: String, $search: String,$tags: [String]) {
8691
+ eventsSearch(region: $region, search: $search, tags: $tags) {
8698
8692
  ...EventListItemFields
8699
8693
  }
8700
8694
  }
@@ -10000,8 +9994,8 @@ var GAME_DATE_FIELDS_FRAGMENT = gql`
10000
9994
  endDate
10001
9995
  }
10002
9996
  `;
10003
- var BASE_GAME_FIELDS_FRAGMENT = gql`
10004
- fragment BaseGameFields on BaseGameType {
9997
+ var DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT = gql`
9998
+ fragment DailyClueBaseGameFields on DailyClueBaseGameType {
10005
9999
  gameDate {
10006
10000
  ...GameDateFields
10007
10001
  }
@@ -10013,20 +10007,20 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10013
10007
  var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
10014
10008
  fragment DailyClueGameDataFields on DailyClueGameDataType {
10015
10009
  gameFields {
10016
- ...BaseGameFields
10010
+ ...DailyClueBaseGameFields
10017
10011
  }
10018
10012
  lastFoundDate
10019
10013
  points
10020
10014
  letterInfo {
10021
10015
  collected
10022
- shuffled
10023
- todaysLetter
10016
+ solutionShuffled
10024
10017
  todaysClue
10018
+ todaysLetter
10025
10019
  todaysPlacement
10026
10020
  }
10027
10021
  streak
10028
10022
  }
10029
- ${BASE_GAME_FIELDS_FRAGMENT}
10023
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10030
10024
  `;
10031
10025
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10032
10026
  fragment GameHistoryFields on GameHistoryType {
@@ -10114,6 +10108,14 @@ var GET_GAME_LEADERBOARD = gql`
10114
10108
  ${OWNER_FIELDS_FRAGMENT}
10115
10109
  ${GAME_HISTORY_FIELDS_FRAGMENT}
10116
10110
  `;
10111
+ var BASE_GAME_FIELDS_FRAGMENT = gql`
10112
+ fragment BaseGameFields on BaseGameType {
10113
+ dailyClue {
10114
+ ...DailyClueBaseGameFields
10115
+ }
10116
+ }
10117
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10118
+ `;
10117
10119
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10118
10120
  fragment PostContentDataFields on PostContentData {
10119
10121
  game {
@@ -10166,6 +10168,7 @@ var POST_FIELDS_FRAGMENT = gql`
10166
10168
  postType
10167
10169
  resource {
10168
10170
  resourceId
10171
+ resourceRegion
10169
10172
  resourceType
10170
10173
  }
10171
10174
  tags
@@ -10906,6 +10909,7 @@ var postSchema = create$3().shape({
10906
10909
  postType: create$8().oneOf(Object.values(EnumPostType)).required(),
10907
10910
  resource: create$3({
10908
10911
  resourceId: create$6().required(),
10912
+ resourceRegion: create$6().required(),
10909
10913
  resourceType: create$8().oneOf(Object.values(EnumResourceType)).required()
10910
10914
  }).nullable().optional(),
10911
10915
  tags: create$2().of(create$6().required()).nullable().optional(),
@@ -11003,7 +11007,10 @@ var schoolSchema = create$3().shape({
11003
11007
  name: create$6().trim().required("Name is required"),
11004
11008
  region: create$6().trim().required("Region is required"),
11005
11009
  socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
11006
- 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"))
11010
+ studentCount: create$5().label("Student Count").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Student count must be a number").min(
11011
+ SCHOOL_MIN_STUDENT_COUNT,
11012
+ `Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
11013
+ ).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
11007
11014
  });
11008
11015
  var PKG = "@timardex/cluemart-shared";
11009
11016
  var IMAGE_EXTENSION = ".webp";
@@ -11095,6 +11102,13 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
11095
11102
  EnumActivity2["VIEW"] = "VIEW";
11096
11103
  return EnumActivity2;
11097
11104
  })(EnumActivity || {});
11105
+ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11106
+ EnumGameStatus2["GAME_COMPLETED"] = "GAME_COMPLETED";
11107
+ EnumGameStatus2["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
11108
+ EnumGameStatus2["GAME_LEFT"] = "GAME_LEFT";
11109
+ EnumGameStatus2["GAME_STARTED"] = "GAME_STARTED";
11110
+ return EnumGameStatus2;
11111
+ })(EnumGameStatus || {});
11098
11112
 
11099
11113
  // src/mongoose/Ad.ts
11100
11114
  var import_mongoose = __toESM(require("mongoose"));
@@ -12297,6 +12311,7 @@ var schema13 = new MongooseSchema17(
12297
12311
  required: false,
12298
12312
  type: {
12299
12313
  resourceId: { required: true, type: String },
12314
+ resourceRegion: { required: true, type: String },
12300
12315
  resourceType: {
12301
12316
  enum: Object.values(EnumResourceType),
12302
12317
  required: true,
@@ -12336,6 +12351,9 @@ var AppSettingSchema = new MongooseSchema18(
12336
12351
  var AppSettingModel = import_mongoose18.default.models.AppSetting || import_mongoose18.default.model("AppSetting", AppSettingSchema);
12337
12352
 
12338
12353
  // src/mongoose/game/Game.ts
12354
+ var import_mongoose20 = __toESM(require("mongoose"));
12355
+
12356
+ // src/mongoose/game/utils.ts
12339
12357
  var import_mongoose19 = __toESM(require("mongoose"));
12340
12358
  var MongooseSchema19 = import_mongoose19.default.Schema;
12341
12359
  var schemaGameDate = new MongooseSchema19(
@@ -12345,7 +12363,15 @@ var schemaGameDate = new MongooseSchema19(
12345
12363
  },
12346
12364
  { _id: false }
12347
12365
  );
12348
- var schemaBaseGame = new MongooseSchema19(
12366
+ var schemaLetters = new MongooseSchema19(
12367
+ {
12368
+ collected: { required: false, type: [String] },
12369
+ solutionShuffled: { required: true, type: [String] }
12370
+ // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12371
+ },
12372
+ { _id: false }
12373
+ );
12374
+ var schemaDailyClueBaseGame = new MongooseSchema19(
12349
12375
  {
12350
12376
  gameDate: { required: true, type: schemaGameDate },
12351
12377
  gameSolution: { required: true, type: String },
@@ -12357,17 +12383,9 @@ var schemaBaseGame = new MongooseSchema19(
12357
12383
  },
12358
12384
  { _id: false }
12359
12385
  );
12360
- var schemaLetters = new MongooseSchema19(
12361
- {
12362
- collected: { required: false, type: [String] },
12363
- shuffled: { required: true, type: [String] }
12364
- // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12365
- },
12366
- { _id: false }
12367
- );
12368
- var schemaDailyClue = new MongooseSchema19(
12386
+ var schemaDailyClueGameData = new MongooseSchema19(
12369
12387
  {
12370
- gameFields: { required: true, type: schemaBaseGame },
12388
+ gameFields: { required: true, type: schemaDailyClueBaseGame },
12371
12389
  lastFoundDate: { default: null, required: false, type: Date },
12372
12390
  letterInfo: {
12373
12391
  required: true,
@@ -12378,8 +12396,11 @@ var schemaDailyClue = new MongooseSchema19(
12378
12396
  },
12379
12397
  { _id: false }
12380
12398
  );
12399
+
12400
+ // src/mongoose/game/Game.ts
12401
+ var MongooseSchema20 = import_mongoose20.default.Schema;
12381
12402
  var gameDataSchemas = {
12382
- [EnumGameType.DAILY_CLUE]: schemaDailyClue
12403
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12383
12404
  };
12384
12405
  var gameDataDefinition = Object.fromEntries(
12385
12406
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12387,7 +12408,7 @@ var gameDataDefinition = Object.fromEntries(
12387
12408
  { default: null, required: false, type: schema16 }
12388
12409
  ])
12389
12410
  );
12390
- var gameHistorySchema = new MongooseSchema19(
12411
+ var gameHistorySchema = new MongooseSchema20(
12391
12412
  {
12392
12413
  createdAt: { required: true, type: Date },
12393
12414
  gameDate: { required: true, type: schemaGameDate },
@@ -12405,7 +12426,7 @@ var gameHistorySchema = new MongooseSchema19(
12405
12426
  },
12406
12427
  { _id: false }
12407
12428
  );
12408
- var gameTypeSchema = new MongooseSchema19(
12429
+ var gameTypeSchema = new MongooseSchema20(
12409
12430
  {
12410
12431
  active: { default: true, required: true, type: Boolean },
12411
12432
  gameData: gameDataDefinition,
@@ -12418,7 +12439,7 @@ var gameTypeSchema = new MongooseSchema19(
12418
12439
  },
12419
12440
  { timestamps: true }
12420
12441
  );
12421
- var schema14 = new MongooseSchema19(
12442
+ var schema14 = new MongooseSchema20(
12422
12443
  {
12423
12444
  active: { default: false, required: true, type: Boolean },
12424
12445
  deletedAt: { default: null, required: false, type: Date },
@@ -12431,12 +12452,12 @@ var schema14 = new MongooseSchema19(
12431
12452
  },
12432
12453
  { timestamps: true }
12433
12454
  );
12434
- var GameModel = import_mongoose19.default.models.Game || import_mongoose19.default.model("Game", schema14);
12455
+ var GameModel = import_mongoose20.default.models.Game || import_mongoose20.default.model("Game", schema14);
12435
12456
 
12436
12457
  // src/mongoose/School.ts
12437
- var import_mongoose20 = __toESM(require("mongoose"));
12438
- var MongooseSchema20 = import_mongoose20.default.Schema;
12439
- var schema15 = new MongooseSchema20(
12458
+ var import_mongoose21 = __toESM(require("mongoose"));
12459
+ var MongooseSchema21 = import_mongoose21.default.Schema;
12460
+ var schema15 = new MongooseSchema21(
12440
12461
  {
12441
12462
  // New schools are active by default
12442
12463
  active: { default: true, required: true, type: Boolean },
@@ -12461,7 +12482,7 @@ var schema15 = new MongooseSchema20(
12461
12482
  },
12462
12483
  { timestamps: true }
12463
12484
  );
12464
- var SchoolModel = import_mongoose20.default.models.School || import_mongoose20.default.model("School", schema15);
12485
+ var SchoolModel = import_mongoose21.default.models.School || import_mongoose21.default.model("School", schema15);
12465
12486
  // Annotate the CommonJS export names for ESM import in node:
12466
12487
  0 && (module.exports = {
12467
12488
  APP_SETTINGS_ID,