@timardex/cluemart-server-shared 1.1.36 → 1.1.38

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
@@ -52,6 +52,8 @@ __export(index_exports, {
52
52
  PartnerModel: () => PartnerModel,
53
53
  PostModel: () => PostModel,
54
54
  PushTokenModel: () => PushTokenModel,
55
+ REMINDER_WINDOW_MAX_HOURS: () => REMINDER_WINDOW_MAX_HOURS,
56
+ REMINDER_WINDOW_MIN_HOURS: () => REMINDER_WINDOW_MIN_HOURS,
55
57
  RelationModel: () => RelationModel,
56
58
  RelationTypeSchema: () => RelationTypeSchema,
57
59
  ResourceActivityModel: () => ResourceActivityModel,
@@ -2557,6 +2559,14 @@ var GET_EVENT = gql`
2557
2559
  }
2558
2560
  ${EVENT}
2559
2561
  `;
2562
+ var GET_OWNED_EVENT = gql`
2563
+ query getOwnedEvent($_id: ID!) {
2564
+ ownedEvent(_id: $_id) {
2565
+ ...EventFields
2566
+ }
2567
+ }
2568
+ ${EVENT}
2569
+ `;
2560
2570
  var GET_EVENT_BY_PLACE_ID = gql`
2561
2571
  query getEventByPlaceId($googlePlaceId: String!) {
2562
2572
  eventByPlaceId(googlePlaceId: $googlePlaceId) {
@@ -7352,7 +7362,7 @@ var gameScreenIdentifierList2 = [
7352
7362
  }
7353
7363
  ];
7354
7364
 
7355
- // node_modules/@timardex/cluemart-shared/dist/chunk-5RXL62LO.mjs
7365
+ // node_modules/@timardex/cluemart-shared/dist/chunk-RCARDOVS.mjs
7356
7366
  var import_dayjs4 = __toESM(require("dayjs"), 1);
7357
7367
  var statusOptions2 = [
7358
7368
  ...Object.values(EnumInviteStatus2).map((status) => ({
@@ -9066,8 +9076,8 @@ async function findEventOrImportedMarketById(resourceId) {
9066
9076
  }
9067
9077
  const normalizedId = convertObjectIdsToStrings(resourceId);
9068
9078
  const [eventDoc, googleImportedDoc] = await Promise.all([
9069
- EventModel.findById(normalizedId).select("_id name").lean().exec(),
9070
- GoogleImportedMarketModel.findById(normalizedId).select("_id name").lean().exec()
9079
+ EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
9080
+ GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
9071
9081
  ]);
9072
9082
  return eventDoc ?? googleImportedDoc;
9073
9083
  }
@@ -9794,6 +9804,10 @@ async function getPartnerResourceInfo(userId, partnerId) {
9794
9804
  // src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
9795
9805
  var import_dayjs12 = __toESM(require("dayjs"));
9796
9806
 
9807
+ // src/service/license/reminder/reminderWindow.ts
9808
+ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
9809
+ var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
9810
+
9797
9811
  // src/service/license/reminder/utils.ts
9798
9812
  var import_dayjs11 = __toESM(require("dayjs"));
9799
9813
 
@@ -9855,8 +9869,8 @@ async function checkAndCreateNotification(payload) {
9855
9869
  }
9856
9870
  function isLicenseExpiringIn7Days(expiryDate, now) {
9857
9871
  const expiry = (0, import_dayjs11.default)(expiryDate);
9858
- const daysUntilExpiry = expiry.diff(now, "day", true);
9859
- return daysUntilExpiry >= 6.5 && daysUntilExpiry <= 7.5;
9872
+ const hoursUntilExpiry = expiry.diff(now, "hour", true);
9873
+ return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
9860
9874
  }
9861
9875
  function getLicenseName(licenceType) {
9862
9876
  return licenseNiceNames[licenceType] || licenceType;
@@ -10020,8 +10034,8 @@ async function processUserLicenseReminders(user, now) {
10020
10034
  async function remindUsersAboutLicenseExpiration() {
10021
10035
  const now = (0, import_dayjs12.default)();
10022
10036
  console.log(`\u{1F50D} Checking for licenses expiring in 7 days at ${now.format()}`);
10023
- const minExpiryDate = now.add(6.5, "day").toDate();
10024
- const maxExpiryDate = now.add(7.5, "day").toDate();
10037
+ const minExpiryDate = now.add(REMINDER_WINDOW_MIN_HOURS, "hour").toDate();
10038
+ const maxExpiryDate = now.add(REMINDER_WINDOW_MAX_HOURS, "hour").toDate();
10025
10039
  const users = await UserModel.find({
10026
10040
  licences: {
10027
10041
  $elemMatch: {
@@ -10079,6 +10093,8 @@ async function remindUsersAboutLicenseExpiration() {
10079
10093
  PartnerModel,
10080
10094
  PostModel,
10081
10095
  PushTokenModel,
10096
+ REMINDER_WINDOW_MAX_HOURS,
10097
+ REMINDER_WINDOW_MIN_HOURS,
10082
10098
  RelationModel,
10083
10099
  RelationTypeSchema,
10084
10100
  ResourceActivityModel,