@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.cjs CHANGED
@@ -1711,7 +1711,7 @@ __export(index_exports, {
1711
1711
  findEventOrImportedMarketById: () => findEventOrImportedMarketById,
1712
1712
  locationGeoSchema: () => locationGeoSchema,
1713
1713
  locationsSchema: () => locationsSchema,
1714
- mongoose: () => import_mongoose27.default,
1714
+ mongoose: () => import_mongoose28.default,
1715
1715
  refundPolicySchema: () => refundPolicySchema,
1716
1716
  relationDatesSchema: () => relationDatesSchema,
1717
1717
  resourceRelationsSchema: () => resourceRelationsSchema,
@@ -6908,6 +6908,10 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6908
6908
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
6909
6909
  return EnumSubscriptionStatus22;
6910
6910
  })(EnumSubscriptionStatus || {});
6911
+ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6912
+ EnumGameType2["DAILY_CLUE"] = "dailyClue";
6913
+ return EnumGameType2;
6914
+ })(EnumGameType || {});
6911
6915
  var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
6912
6916
  var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
6913
6917
  var gameScreenIdentifierList = [
@@ -7002,17 +7006,6 @@ var gameScreenIdentifierList = [
7002
7006
  match: "/visitors"
7003
7007
  }
7004
7008
  ];
7005
- var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
7006
- EnumGameType2["DAILY_CLUE"] = "dailyClue";
7007
- return EnumGameType2;
7008
- })(EnumGameType || {});
7009
- var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus3) => {
7010
- EnumGameStatus3["GAME_COMPLETED"] = "GAME_COMPLETED";
7011
- EnumGameStatus3["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
7012
- EnumGameStatus3["GAME_LEFT"] = "GAME_LEFT";
7013
- EnumGameStatus3["GAME_STARTED"] = "GAME_STARTED";
7014
- return EnumGameStatus3;
7015
- })(EnumGameStatus || {});
7016
7009
  var dateFormat = "DD-MM-YYYY";
7017
7010
  var timeFormat = "HH:mm";
7018
7011
  import_dayjs.default.extend(import_customParseFormat.default);
@@ -7041,6 +7034,7 @@ function normalizeUrl(url) {
7041
7034
  }
7042
7035
  return url;
7043
7036
  }
7037
+ var SCHOOL_MIN_STUDENT_COUNT = 300;
7044
7038
  var packagingTypes = [
7045
7039
  "Biodegradable",
7046
7040
  "Compostable",
@@ -8703,8 +8697,8 @@ var GET_EVENTS_BY_REGION = gql`
8703
8697
  ${EVENT_LIST_ITEM}
8704
8698
  `;
8705
8699
  var SEARCH_EVENTS = gql`
8706
- query searchEvents($search: String!, $region: String) {
8707
- eventsSearch(search: $search, region: $region) {
8700
+ query searchEvents($region: String, $search: String,$tags: [String]) {
8701
+ eventsSearch(region: $region, search: $search, tags: $tags) {
8708
8702
  ...EventListItemFields
8709
8703
  }
8710
8704
  }
@@ -10010,8 +10004,8 @@ var GAME_DATE_FIELDS_FRAGMENT = gql`
10010
10004
  endDate
10011
10005
  }
10012
10006
  `;
10013
- var BASE_GAME_FIELDS_FRAGMENT = gql`
10014
- fragment BaseGameFields on BaseGameType {
10007
+ var DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT = gql`
10008
+ fragment DailyClueBaseGameFields on DailyClueBaseGameType {
10015
10009
  gameDate {
10016
10010
  ...GameDateFields
10017
10011
  }
@@ -10023,20 +10017,20 @@ var BASE_GAME_FIELDS_FRAGMENT = gql`
10023
10017
  var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
10024
10018
  fragment DailyClueGameDataFields on DailyClueGameDataType {
10025
10019
  gameFields {
10026
- ...BaseGameFields
10020
+ ...DailyClueBaseGameFields
10027
10021
  }
10028
10022
  lastFoundDate
10029
10023
  points
10030
10024
  letterInfo {
10031
10025
  collected
10032
- shuffled
10033
- todaysLetter
10026
+ solutionShuffled
10034
10027
  todaysClue
10028
+ todaysLetter
10035
10029
  todaysPlacement
10036
10030
  }
10037
10031
  streak
10038
10032
  }
10039
- ${BASE_GAME_FIELDS_FRAGMENT}
10033
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10040
10034
  `;
10041
10035
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10042
10036
  fragment GameHistoryFields on GameHistoryType {
@@ -10124,6 +10118,14 @@ var GET_GAME_LEADERBOARD = gql`
10124
10118
  ${OWNER_FIELDS_FRAGMENT}
10125
10119
  ${GAME_HISTORY_FIELDS_FRAGMENT}
10126
10120
  `;
10121
+ var BASE_GAME_FIELDS_FRAGMENT = gql`
10122
+ fragment BaseGameFields on BaseGameType {
10123
+ dailyClue {
10124
+ ...DailyClueBaseGameFields
10125
+ }
10126
+ }
10127
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10128
+ `;
10127
10129
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10128
10130
  fragment PostContentDataFields on PostContentData {
10129
10131
  game {
@@ -10176,6 +10178,7 @@ var POST_FIELDS_FRAGMENT = gql`
10176
10178
  postType
10177
10179
  resource {
10178
10180
  resourceId
10181
+ resourceRegion
10179
10182
  resourceType
10180
10183
  }
10181
10184
  tags
@@ -10916,6 +10919,7 @@ var postSchema = create$3().shape({
10916
10919
  postType: create$8().oneOf(Object.values(EnumPostType)).required(),
10917
10920
  resource: create$3({
10918
10921
  resourceId: create$6().required(),
10922
+ resourceRegion: create$6().required(),
10919
10923
  resourceType: create$8().oneOf(Object.values(EnumResourceType)).required()
10920
10924
  }).nullable().optional(),
10921
10925
  tags: create$2().of(create$6().required()).nullable().optional(),
@@ -11013,7 +11017,10 @@ var schoolSchema = create$3().shape({
11013
11017
  name: create$6().trim().required("Name is required"),
11014
11018
  region: create$6().trim().required("Region is required"),
11015
11019
  socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
11016
- 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"))
11020
+ studentCount: create$5().label("Student Count").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Student count must be a number").min(
11021
+ SCHOOL_MIN_STUDENT_COUNT,
11022
+ `Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
11023
+ ).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
11017
11024
  });
11018
11025
  var PKG = "@timardex/cluemart-shared";
11019
11026
  var IMAGE_EXTENSION = ".webp";
@@ -11105,6 +11112,13 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
11105
11112
  EnumActivity2["VIEW"] = "VIEW";
11106
11113
  return EnumActivity2;
11107
11114
  })(EnumActivity || {});
11115
+ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11116
+ EnumGameStatus2["GAME_COMPLETED"] = "GAME_COMPLETED";
11117
+ EnumGameStatus2["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
11118
+ EnumGameStatus2["GAME_LEFT"] = "GAME_LEFT";
11119
+ EnumGameStatus2["GAME_STARTED"] = "GAME_STARTED";
11120
+ return EnumGameStatus2;
11121
+ })(EnumGameStatus || {});
11108
11122
 
11109
11123
  // src/mongoose/Ad.ts
11110
11124
  var import_mongoose = __toESM(require("mongoose"));
@@ -12307,6 +12321,7 @@ var schema13 = new MongooseSchema17(
12307
12321
  required: false,
12308
12322
  type: {
12309
12323
  resourceId: { required: true, type: String },
12324
+ resourceRegion: { required: true, type: String },
12310
12325
  resourceType: {
12311
12326
  enum: Object.values(EnumResourceType),
12312
12327
  required: true,
@@ -12346,6 +12361,9 @@ var AppSettingSchema = new MongooseSchema18(
12346
12361
  var AppSettingModel = import_mongoose18.default.models.AppSetting || import_mongoose18.default.model("AppSetting", AppSettingSchema);
12347
12362
 
12348
12363
  // src/mongoose/game/Game.ts
12364
+ var import_mongoose20 = __toESM(require("mongoose"));
12365
+
12366
+ // src/mongoose/game/utils.ts
12349
12367
  var import_mongoose19 = __toESM(require("mongoose"));
12350
12368
  var MongooseSchema19 = import_mongoose19.default.Schema;
12351
12369
  var schemaGameDate = new MongooseSchema19(
@@ -12355,7 +12373,15 @@ var schemaGameDate = new MongooseSchema19(
12355
12373
  },
12356
12374
  { _id: false }
12357
12375
  );
12358
- var schemaBaseGame = new MongooseSchema19(
12376
+ var schemaLetters = new MongooseSchema19(
12377
+ {
12378
+ collected: { required: false, type: [String] },
12379
+ solutionShuffled: { required: true, type: [String] }
12380
+ // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12381
+ },
12382
+ { _id: false }
12383
+ );
12384
+ var schemaDailyClueBaseGame = new MongooseSchema19(
12359
12385
  {
12360
12386
  gameDate: { required: true, type: schemaGameDate },
12361
12387
  gameSolution: { required: true, type: String },
@@ -12367,17 +12393,9 @@ var schemaBaseGame = new MongooseSchema19(
12367
12393
  },
12368
12394
  { _id: false }
12369
12395
  );
12370
- var schemaLetters = new MongooseSchema19(
12396
+ var schemaDailyClueGameData = new MongooseSchema19(
12371
12397
  {
12372
- collected: { required: false, type: [String] },
12373
- shuffled: { required: true, type: [String] }
12374
- // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12375
- },
12376
- { _id: false }
12377
- );
12378
- var schemaDailyClue = new MongooseSchema19(
12379
- {
12380
- gameFields: { required: true, type: schemaBaseGame },
12398
+ gameFields: { required: true, type: schemaDailyClueBaseGame },
12381
12399
  lastFoundDate: { default: null, required: false, type: Date },
12382
12400
  letterInfo: {
12383
12401
  required: true,
@@ -12388,8 +12406,11 @@ var schemaDailyClue = new MongooseSchema19(
12388
12406
  },
12389
12407
  { _id: false }
12390
12408
  );
12409
+
12410
+ // src/mongoose/game/Game.ts
12411
+ var MongooseSchema20 = import_mongoose20.default.Schema;
12391
12412
  var gameDataSchemas = {
12392
- [EnumGameType.DAILY_CLUE]: schemaDailyClue
12413
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12393
12414
  };
12394
12415
  var gameDataDefinition = Object.fromEntries(
12395
12416
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12397,7 +12418,7 @@ var gameDataDefinition = Object.fromEntries(
12397
12418
  { default: null, required: false, type: schema16 }
12398
12419
  ])
12399
12420
  );
12400
- var gameHistorySchema = new MongooseSchema19(
12421
+ var gameHistorySchema = new MongooseSchema20(
12401
12422
  {
12402
12423
  createdAt: { required: true, type: Date },
12403
12424
  gameDate: { required: true, type: schemaGameDate },
@@ -12415,7 +12436,7 @@ var gameHistorySchema = new MongooseSchema19(
12415
12436
  },
12416
12437
  { _id: false }
12417
12438
  );
12418
- var gameTypeSchema = new MongooseSchema19(
12439
+ var gameTypeSchema = new MongooseSchema20(
12419
12440
  {
12420
12441
  active: { default: true, required: true, type: Boolean },
12421
12442
  gameData: gameDataDefinition,
@@ -12428,7 +12449,7 @@ var gameTypeSchema = new MongooseSchema19(
12428
12449
  },
12429
12450
  { timestamps: true }
12430
12451
  );
12431
- var schema14 = new MongooseSchema19(
12452
+ var schema14 = new MongooseSchema20(
12432
12453
  {
12433
12454
  active: { default: false, required: true, type: Boolean },
12434
12455
  deletedAt: { default: null, required: false, type: Date },
@@ -12441,12 +12462,12 @@ var schema14 = new MongooseSchema19(
12441
12462
  },
12442
12463
  { timestamps: true }
12443
12464
  );
12444
- var GameModel = import_mongoose19.default.models.Game || import_mongoose19.default.model("Game", schema14);
12465
+ var GameModel = import_mongoose20.default.models.Game || import_mongoose20.default.model("Game", schema14);
12445
12466
 
12446
12467
  // src/mongoose/School.ts
12447
- var import_mongoose20 = __toESM(require("mongoose"));
12448
- var MongooseSchema20 = import_mongoose20.default.Schema;
12449
- var schema15 = new MongooseSchema20(
12468
+ var import_mongoose21 = __toESM(require("mongoose"));
12469
+ var MongooseSchema21 = import_mongoose21.default.Schema;
12470
+ var schema15 = new MongooseSchema21(
12450
12471
  {
12451
12472
  // New schools are active by default
12452
12473
  active: { default: true, required: true, type: Boolean },
@@ -12471,10 +12492,10 @@ var schema15 = new MongooseSchema20(
12471
12492
  },
12472
12493
  { timestamps: true }
12473
12494
  );
12474
- var SchoolModel = import_mongoose20.default.models.School || import_mongoose20.default.model("School", schema15);
12495
+ var SchoolModel = import_mongoose21.default.models.School || import_mongoose21.default.model("School", schema15);
12475
12496
 
12476
12497
  // src/service/database.ts
12477
- var import_mongoose21 = __toESM(require("mongoose"));
12498
+ var import_mongoose22 = __toESM(require("mongoose"));
12478
12499
  var connectToDatabase = async ({
12479
12500
  appName,
12480
12501
  dbName,
@@ -12487,7 +12508,7 @@ var connectToDatabase = async ({
12487
12508
  // Fallback to MongoDB Atlas connection string
12488
12509
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12489
12510
  );
12490
- await import_mongoose21.default.connect(mongoUri);
12511
+ await import_mongoose22.default.connect(mongoUri);
12491
12512
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12492
12513
  console.log(
12493
12514
  `${connectionType} connected from server/src/service/database.ts`
@@ -12755,12 +12776,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12755
12776
  }
12756
12777
 
12757
12778
  // src/service/objectIdToString.ts
12758
- var import_mongoose25 = __toESM(require("mongoose"));
12779
+ var import_mongoose26 = __toESM(require("mongoose"));
12759
12780
  function convertObjectIdsToStrings(obj) {
12760
12781
  if (obj === null || obj === void 0) {
12761
12782
  return obj;
12762
12783
  }
12763
- if (obj instanceof import_mongoose25.default.Types.ObjectId) {
12784
+ if (obj instanceof import_mongoose26.default.Types.ObjectId) {
12764
12785
  return obj.toString();
12765
12786
  }
12766
12787
  if (Array.isArray(obj)) {
@@ -12791,7 +12812,7 @@ async function findEventOrImportedMarketById(resourceId) {
12791
12812
 
12792
12813
  // src/types/index.ts
12793
12814
  var import_express = __toESM(require("express"));
12794
- var import_mongoose27 = __toESM(require("mongoose"));
12815
+ var import_mongoose28 = __toESM(require("mongoose"));
12795
12816
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12796
12817
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12797
12818
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";