@timardex/cluemart-server-shared 1.1.36 → 1.1.37
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 +12 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/dist/service/index.cjs +12 -4
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +14 -1
- package/dist/service/index.d.ts +14 -1
- package/dist/service/index.mjs +10 -4
- package/dist/service/index.mjs.map +1 -1
- package/package.json +1 -1
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,
|
|
@@ -9794,6 +9796,10 @@ async function getPartnerResourceInfo(userId, partnerId) {
|
|
|
9794
9796
|
// src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
|
|
9795
9797
|
var import_dayjs12 = __toESM(require("dayjs"));
|
|
9796
9798
|
|
|
9799
|
+
// src/service/license/reminder/reminderWindow.ts
|
|
9800
|
+
var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
9801
|
+
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
9802
|
+
|
|
9797
9803
|
// src/service/license/reminder/utils.ts
|
|
9798
9804
|
var import_dayjs11 = __toESM(require("dayjs"));
|
|
9799
9805
|
|
|
@@ -9855,8 +9861,8 @@ async function checkAndCreateNotification(payload) {
|
|
|
9855
9861
|
}
|
|
9856
9862
|
function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
9857
9863
|
const expiry = (0, import_dayjs11.default)(expiryDate);
|
|
9858
|
-
const
|
|
9859
|
-
return
|
|
9864
|
+
const hoursUntilExpiry = expiry.diff(now, "hour", true);
|
|
9865
|
+
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
9860
9866
|
}
|
|
9861
9867
|
function getLicenseName(licenceType) {
|
|
9862
9868
|
return licenseNiceNames[licenceType] || licenceType;
|
|
@@ -10020,8 +10026,8 @@ async function processUserLicenseReminders(user, now) {
|
|
|
10020
10026
|
async function remindUsersAboutLicenseExpiration() {
|
|
10021
10027
|
const now = (0, import_dayjs12.default)();
|
|
10022
10028
|
console.log(`\u{1F50D} Checking for licenses expiring in 7 days at ${now.format()}`);
|
|
10023
|
-
const minExpiryDate = now.add(
|
|
10024
|
-
const maxExpiryDate = now.add(
|
|
10029
|
+
const minExpiryDate = now.add(REMINDER_WINDOW_MIN_HOURS, "hour").toDate();
|
|
10030
|
+
const maxExpiryDate = now.add(REMINDER_WINDOW_MAX_HOURS, "hour").toDate();
|
|
10025
10031
|
const users = await UserModel.find({
|
|
10026
10032
|
licences: {
|
|
10027
10033
|
$elemMatch: {
|
|
@@ -10079,6 +10085,8 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
10079
10085
|
PartnerModel,
|
|
10080
10086
|
PostModel,
|
|
10081
10087
|
PushTokenModel,
|
|
10088
|
+
REMINDER_WINDOW_MAX_HOURS,
|
|
10089
|
+
REMINDER_WINDOW_MIN_HOURS,
|
|
10082
10090
|
RelationModel,
|
|
10083
10091
|
RelationTypeSchema,
|
|
10084
10092
|
ResourceActivityModel,
|