@timardex/cluemart-server-shared 1.0.146 → 1.0.148

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.
@@ -6992,17 +6992,6 @@ var gameScreenIdentifierList = [
6992
6992
  match: "/visitors"
6993
6993
  }
6994
6994
  ];
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
6995
  var dateFormat = "DD-MM-YYYY";
7007
6996
  var timeFormat = "HH:mm";
7008
6997
  import_dayjs.default.extend(import_customParseFormat.default);
@@ -7031,6 +7020,7 @@ function normalizeUrl(url) {
7031
7020
  }
7032
7021
  return url;
7033
7022
  }
7023
+ var SCHOOL_MIN_STUDENT_COUNT = 300;
7034
7024
  var packagingTypes = [
7035
7025
  "Biodegradable",
7036
7026
  "Compostable",
@@ -10000,33 +9990,32 @@ var GAME_DATE_FIELDS_FRAGMENT = gql`
10000
9990
  endDate
10001
9991
  }
10002
9992
  `;
10003
- var BASE_GAME_FIELDS_FRAGMENT = gql`
10004
- fragment BaseGameFields on BaseGameType {
9993
+ var DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT = gql`
9994
+ fragment DailyClueBaseGameFields on DailyClueBaseGameType {
10005
9995
  gameDate {
10006
9996
  ...GameDateFields
10007
9997
  }
10008
9998
  gameSolution
10009
- gameType
10010
9999
  }
10011
10000
  ${GAME_DATE_FIELDS_FRAGMENT}
10012
10001
  `;
10013
10002
  var DAILY_CLUE_GAME_DATA_FIELDS_FRAGMENT = gql`
10014
10003
  fragment DailyClueGameDataFields on DailyClueGameDataType {
10015
10004
  gameFields {
10016
- ...BaseGameFields
10005
+ ...DailyClueBaseGameFields
10017
10006
  }
10018
10007
  lastFoundDate
10019
10008
  points
10020
10009
  letterInfo {
10021
10010
  collected
10022
- shuffled
10023
- todaysLetter
10011
+ solutionShuffled
10024
10012
  todaysClue
10013
+ todaysLetter
10025
10014
  todaysPlacement
10026
10015
  }
10027
10016
  streak
10028
10017
  }
10029
- ${BASE_GAME_FIELDS_FRAGMENT}
10018
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10030
10019
  `;
10031
10020
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
10032
10021
  fragment GameHistoryFields on GameHistoryType {
@@ -10114,6 +10103,15 @@ var GET_GAME_LEADERBOARD = gql`
10114
10103
  ${OWNER_FIELDS_FRAGMENT}
10115
10104
  ${GAME_HISTORY_FIELDS_FRAGMENT}
10116
10105
  `;
10106
+ var BASE_GAME_FIELDS_FRAGMENT = gql`
10107
+ fragment BaseGameFields on BaseGameType {
10108
+ gameType
10109
+ dailyClue {
10110
+ ...DailyClueBaseGameFields
10111
+ }
10112
+ }
10113
+ ${DAILY_CLUE_BASE_GAME_FIELDS_FRAGMENT}
10114
+ `;
10117
10115
  var POST_CONTENT_DATA_FIELDS_FRAGMENT = gql`
10118
10116
  fragment PostContentDataFields on PostContentData {
10119
10117
  game {
@@ -11005,7 +11003,10 @@ var schoolSchema = create$3().shape({
11005
11003
  name: create$6().trim().required("Name is required"),
11006
11004
  region: create$6().trim().required("Region is required"),
11007
11005
  socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
11008
- 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"))
11006
+ studentCount: create$5().label("Student Count").nullable().transform((value, originalValue) => originalValue === "" ? null : value).typeError("Student count must be a number").min(
11007
+ SCHOOL_MIN_STUDENT_COUNT,
11008
+ `Student count must be at least ${SCHOOL_MIN_STUDENT_COUNT}`
11009
+ ).required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
11009
11010
  });
11010
11011
  var PKG = "@timardex/cluemart-shared";
11011
11012
  var IMAGE_EXTENSION = ".webp";
@@ -11097,6 +11098,17 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
11097
11098
  EnumActivity2["VIEW"] = "VIEW";
11098
11099
  return EnumActivity2;
11099
11100
  })(EnumActivity || {});
11101
+ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
11102
+ EnumGameStatus2["GAME_COMPLETED"] = "GAME_COMPLETED";
11103
+ EnumGameStatus2["GAME_IN_PROGRESS"] = "GAME_IN_PROGRESS";
11104
+ EnumGameStatus2["GAME_LEFT"] = "GAME_LEFT";
11105
+ EnumGameStatus2["GAME_STARTED"] = "GAME_STARTED";
11106
+ return EnumGameStatus2;
11107
+ })(EnumGameStatus || {});
11108
+ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
11109
+ EnumGameType2["DAILY_CLUE"] = "dailyClue";
11110
+ return EnumGameType2;
11111
+ })(EnumGameType || {});
11100
11112
 
11101
11113
  // src/mongoose/Ad.ts
11102
11114
  var import_mongoose = __toESM(require("mongoose"));
@@ -12339,6 +12351,9 @@ var AppSettingSchema = new MongooseSchema18(
12339
12351
  var AppSettingModel = import_mongoose18.default.models.AppSetting || import_mongoose18.default.model("AppSetting", AppSettingSchema);
12340
12352
 
12341
12353
  // src/mongoose/game/Game.ts
12354
+ var import_mongoose20 = __toESM(require("mongoose"));
12355
+
12356
+ // src/mongoose/game/utils.ts
12342
12357
  var import_mongoose19 = __toESM(require("mongoose"));
12343
12358
  var MongooseSchema19 = import_mongoose19.default.Schema;
12344
12359
  var schemaGameDate = new MongooseSchema19(
@@ -12348,29 +12363,24 @@ var schemaGameDate = new MongooseSchema19(
12348
12363
  },
12349
12364
  { _id: false }
12350
12365
  );
12351
- var schemaBaseGame = new MongooseSchema19(
12366
+ var schemaLetters = new MongooseSchema19(
12352
12367
  {
12353
- gameDate: { required: true, type: schemaGameDate },
12354
- gameSolution: { required: true, type: String },
12355
- gameType: {
12356
- enum: Object.values(EnumGameType),
12357
- required: false,
12358
- type: String
12359
- }
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
12360
12371
  },
12361
12372
  { _id: false }
12362
12373
  );
12363
- var schemaLetters = new MongooseSchema19(
12374
+ var schemaDailyClueBaseGame = new MongooseSchema19(
12364
12375
  {
12365
- collected: { required: false, type: [String] },
12366
- shuffled: { required: true, type: [String] }
12367
- // todaysLetter and todaysPlacement is generated in the backend, so they are not required
12376
+ gameDate: { required: true, type: schemaGameDate },
12377
+ gameSolution: { required: true, type: String }
12368
12378
  },
12369
12379
  { _id: false }
12370
12380
  );
12371
- var schemaDailyClue = new MongooseSchema19(
12381
+ var schemaDailyClueGameData = new MongooseSchema19(
12372
12382
  {
12373
- gameFields: { required: true, type: schemaBaseGame },
12383
+ gameFields: { required: true, type: schemaDailyClueBaseGame },
12374
12384
  lastFoundDate: { default: null, required: false, type: Date },
12375
12385
  letterInfo: {
12376
12386
  required: true,
@@ -12381,8 +12391,11 @@ var schemaDailyClue = new MongooseSchema19(
12381
12391
  },
12382
12392
  { _id: false }
12383
12393
  );
12394
+
12395
+ // src/mongoose/game/Game.ts
12396
+ var MongooseSchema20 = import_mongoose20.default.Schema;
12384
12397
  var gameDataSchemas = {
12385
- [EnumGameType.DAILY_CLUE]: schemaDailyClue
12398
+ [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData
12386
12399
  };
12387
12400
  var gameDataDefinition = Object.fromEntries(
12388
12401
  Object.entries(gameDataSchemas).map(([key, schema16]) => [
@@ -12390,7 +12403,7 @@ var gameDataDefinition = Object.fromEntries(
12390
12403
  { default: null, required: false, type: schema16 }
12391
12404
  ])
12392
12405
  );
12393
- var gameHistorySchema = new MongooseSchema19(
12406
+ var gameHistorySchema = new MongooseSchema20(
12394
12407
  {
12395
12408
  createdAt: { required: true, type: Date },
12396
12409
  gameDate: { required: true, type: schemaGameDate },
@@ -12408,7 +12421,7 @@ var gameHistorySchema = new MongooseSchema19(
12408
12421
  },
12409
12422
  { _id: false }
12410
12423
  );
12411
- var gameTypeSchema = new MongooseSchema19(
12424
+ var gameTypeSchema = new MongooseSchema20(
12412
12425
  {
12413
12426
  active: { default: true, required: true, type: Boolean },
12414
12427
  gameData: gameDataDefinition,
@@ -12421,7 +12434,7 @@ var gameTypeSchema = new MongooseSchema19(
12421
12434
  },
12422
12435
  { timestamps: true }
12423
12436
  );
12424
- var schema14 = new MongooseSchema19(
12437
+ var schema14 = new MongooseSchema20(
12425
12438
  {
12426
12439
  active: { default: false, required: true, type: Boolean },
12427
12440
  deletedAt: { default: null, required: false, type: Date },
@@ -12434,12 +12447,12 @@ var schema14 = new MongooseSchema19(
12434
12447
  },
12435
12448
  { timestamps: true }
12436
12449
  );
12437
- var GameModel = import_mongoose19.default.models.Game || import_mongoose19.default.model("Game", schema14);
12450
+ var GameModel = import_mongoose20.default.models.Game || import_mongoose20.default.model("Game", schema14);
12438
12451
 
12439
12452
  // src/mongoose/School.ts
12440
- var import_mongoose20 = __toESM(require("mongoose"));
12441
- var MongooseSchema20 = import_mongoose20.default.Schema;
12442
- var schema15 = new MongooseSchema20(
12453
+ var import_mongoose21 = __toESM(require("mongoose"));
12454
+ var MongooseSchema21 = import_mongoose21.default.Schema;
12455
+ var schema15 = new MongooseSchema21(
12443
12456
  {
12444
12457
  // New schools are active by default
12445
12458
  active: { default: true, required: true, type: Boolean },
@@ -12464,7 +12477,7 @@ var schema15 = new MongooseSchema20(
12464
12477
  },
12465
12478
  { timestamps: true }
12466
12479
  );
12467
- var SchoolModel = import_mongoose20.default.models.School || import_mongoose20.default.model("School", schema15);
12480
+ var SchoolModel = import_mongoose21.default.models.School || import_mongoose21.default.model("School", schema15);
12468
12481
  // Annotate the CommonJS export names for ESM import in node:
12469
12482
  0 && (module.exports = {
12470
12483
  APP_SETTINGS_ID,