@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/{chunk-DBGVZNUX.mjs → chunk-DJHOLZ3J.mjs} +9 -1
- package/dist/chunk-DJHOLZ3J.mjs.map +1 -0
- package/dist/index.cjs +23 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.mjs +21 -7
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +8 -0
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +23 -7
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +16 -3
- package/dist/service/index.d.ts +16 -3
- package/dist/service/index.mjs +14 -8
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-DBGVZNUX.mjs.map +0 -1
package/dist/mongoose/index.mjs
CHANGED
package/dist/service/index.cjs
CHANGED
|
@@ -33,6 +33,8 @@ __export(service_exports, {
|
|
|
33
33
|
ACTIVE_NOT_DELETED_FILTER: () => ACTIVE_NOT_DELETED_FILTER,
|
|
34
34
|
LicenceCategory: () => LicenceCategory,
|
|
35
35
|
LicenceExpiryDate: () => LicenceExpiryDate,
|
|
36
|
+
REMINDER_WINDOW_MAX_HOURS: () => REMINDER_WINDOW_MAX_HOURS,
|
|
37
|
+
REMINDER_WINDOW_MIN_HOURS: () => REMINDER_WINDOW_MIN_HOURS,
|
|
36
38
|
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
37
39
|
activeAffiliateCodeExists: () => activeAffiliateCodeExists,
|
|
38
40
|
awardAffiliateVendorSubscriptionRewards: () => awardAffiliateVendorSubscriptionRewards,
|
|
@@ -2512,6 +2514,14 @@ var GET_EVENT = gql`
|
|
|
2512
2514
|
}
|
|
2513
2515
|
${EVENT}
|
|
2514
2516
|
`;
|
|
2517
|
+
var GET_OWNED_EVENT = gql`
|
|
2518
|
+
query getOwnedEvent($_id: ID!) {
|
|
2519
|
+
ownedEvent(_id: $_id) {
|
|
2520
|
+
...EventFields
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
${EVENT}
|
|
2524
|
+
`;
|
|
2515
2525
|
var GET_EVENT_BY_PLACE_ID = gql`
|
|
2516
2526
|
query getEventByPlaceId($googlePlaceId: String!) {
|
|
2517
2527
|
eventByPlaceId(googlePlaceId: $googlePlaceId) {
|
|
@@ -7307,7 +7317,7 @@ var gameScreenIdentifierList2 = [
|
|
|
7307
7317
|
}
|
|
7308
7318
|
];
|
|
7309
7319
|
|
|
7310
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
7320
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-RCARDOVS.mjs
|
|
7311
7321
|
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
7312
7322
|
var statusOptions2 = [
|
|
7313
7323
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -9014,8 +9024,8 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
9014
9024
|
}
|
|
9015
9025
|
const normalizedId = convertObjectIdsToStrings(resourceId);
|
|
9016
9026
|
const [eventDoc, googleImportedDoc] = await Promise.all([
|
|
9017
|
-
EventModel.findById(normalizedId).select("_id name").lean().exec(),
|
|
9018
|
-
GoogleImportedMarketModel.findById(normalizedId).select("_id name").lean().exec()
|
|
9027
|
+
EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
|
|
9028
|
+
GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
|
|
9019
9029
|
]);
|
|
9020
9030
|
return eventDoc ?? googleImportedDoc;
|
|
9021
9031
|
}
|
|
@@ -9742,6 +9752,10 @@ async function getPartnerResourceInfo(userId, partnerId) {
|
|
|
9742
9752
|
// src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
|
|
9743
9753
|
var import_dayjs12 = __toESM(require("dayjs"));
|
|
9744
9754
|
|
|
9755
|
+
// src/service/license/reminder/reminderWindow.ts
|
|
9756
|
+
var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
9757
|
+
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
9758
|
+
|
|
9745
9759
|
// src/service/license/reminder/utils.ts
|
|
9746
9760
|
var import_dayjs11 = __toESM(require("dayjs"));
|
|
9747
9761
|
|
|
@@ -9803,8 +9817,8 @@ async function checkAndCreateNotification(payload) {
|
|
|
9803
9817
|
}
|
|
9804
9818
|
function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
9805
9819
|
const expiry = (0, import_dayjs11.default)(expiryDate);
|
|
9806
|
-
const
|
|
9807
|
-
return
|
|
9820
|
+
const hoursUntilExpiry = expiry.diff(now, "hour", true);
|
|
9821
|
+
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
9808
9822
|
}
|
|
9809
9823
|
function getLicenseName(licenceType) {
|
|
9810
9824
|
return licenseNiceNames[licenceType] || licenceType;
|
|
@@ -9968,8 +9982,8 @@ async function processUserLicenseReminders(user, now) {
|
|
|
9968
9982
|
async function remindUsersAboutLicenseExpiration() {
|
|
9969
9983
|
const now = (0, import_dayjs12.default)();
|
|
9970
9984
|
console.log(`\u{1F50D} Checking for licenses expiring in 7 days at ${now.format()}`);
|
|
9971
|
-
const minExpiryDate = now.add(
|
|
9972
|
-
const maxExpiryDate = now.add(
|
|
9985
|
+
const minExpiryDate = now.add(REMINDER_WINDOW_MIN_HOURS, "hour").toDate();
|
|
9986
|
+
const maxExpiryDate = now.add(REMINDER_WINDOW_MAX_HOURS, "hour").toDate();
|
|
9973
9987
|
const users = await UserModel.find({
|
|
9974
9988
|
licences: {
|
|
9975
9989
|
$elemMatch: {
|
|
@@ -10008,6 +10022,8 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
10008
10022
|
ACTIVE_NOT_DELETED_FILTER,
|
|
10009
10023
|
LicenceCategory,
|
|
10010
10024
|
LicenceExpiryDate,
|
|
10025
|
+
REMINDER_WINDOW_MAX_HOURS,
|
|
10026
|
+
REMINDER_WINDOW_MIN_HOURS,
|
|
10011
10027
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
10012
10028
|
activeAffiliateCodeExists,
|
|
10013
10029
|
awardAffiliateVendorSubscriptionRewards,
|