@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/index.d.mts
CHANGED
|
@@ -944,14 +944,14 @@ declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T,
|
|
|
944
944
|
*/
|
|
945
945
|
declare function updateAllEventDateTimeStatuses(): Promise<void>;
|
|
946
946
|
|
|
947
|
-
type EventOrMarket = Pick<EventListItemType, "_id" | "name"> | null;
|
|
947
|
+
type EventOrMarket = Pick<EventListItemType, "_id" | "name" | "dateTime"> | null;
|
|
948
948
|
/**
|
|
949
949
|
* This function attempts to find an Event or a Google Imported Market by the given resource ID.
|
|
950
950
|
* It first normalizes the resource ID to a string format, then performs parallel queries to both collections.
|
|
951
951
|
* If an Event is found, it returns that; otherwise, it checks for a Google Imported Market and returns it if found.
|
|
952
952
|
* If neither is found, it returns null.
|
|
953
953
|
* @param resourceId - The ID of the resource to find, which can be an ObjectId, string, null, or undefined.
|
|
954
|
-
* @returns A promise that resolves to either an Event or a Google Imported Market object containing _id and
|
|
954
|
+
* @returns A promise that resolves to either an Event or a Google Imported Market object containing _id, name, and dateTime, or null if not found.
|
|
955
955
|
*/
|
|
956
956
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
957
957
|
|
|
@@ -1108,6 +1108,19 @@ declare function getPartnerResourceInfo(userId: ObjectId, partnerId: ObjectId):
|
|
|
1108
1108
|
*/
|
|
1109
1109
|
declare function remindUsersAboutLicenseExpiration(): Promise<void>;
|
|
1110
1110
|
|
|
1111
|
+
/**
|
|
1112
|
+
* License expiration reminder window bounds.
|
|
1113
|
+
*
|
|
1114
|
+
* A licence qualifies for the "7 days before expiry" reminder when its expiry is
|
|
1115
|
+
* between {@link REMINDER_WINDOW_MIN_HOURS} and {@link REMINDER_WINDOW_MAX_HOURS}
|
|
1116
|
+
* away.
|
|
1117
|
+
*
|
|
1118
|
+
* Expressed in hours (derived from days) because dayjs rounds fractional "day"
|
|
1119
|
+
* adds: `now.add(6.5, "day")` becomes 7 days and `now.add(7.5, "day")` 8 days.
|
|
1120
|
+
*/
|
|
1121
|
+
declare const REMINDER_WINDOW_MIN_HOURS: number;
|
|
1122
|
+
declare const REMINDER_WINDOW_MAX_HOURS: number;
|
|
1123
|
+
|
|
1111
1124
|
/**
|
|
1112
1125
|
* Single source of truth for how a licence type is handled on expiry.
|
|
1113
1126
|
*
|
|
@@ -1224,4 +1237,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
1224
1237
|
resourceType: EnumResourceType;
|
|
1225
1238
|
}): Promise<void>;
|
|
1226
1239
|
|
|
1227
|
-
export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, ensureUserLicenseCompliance, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
|
|
1240
|
+
export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, ensureUserLicenseCompliance, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -944,14 +944,14 @@ declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T,
|
|
|
944
944
|
*/
|
|
945
945
|
declare function updateAllEventDateTimeStatuses(): Promise<void>;
|
|
946
946
|
|
|
947
|
-
type EventOrMarket = Pick<EventListItemType, "_id" | "name"> | null;
|
|
947
|
+
type EventOrMarket = Pick<EventListItemType, "_id" | "name" | "dateTime"> | null;
|
|
948
948
|
/**
|
|
949
949
|
* This function attempts to find an Event or a Google Imported Market by the given resource ID.
|
|
950
950
|
* It first normalizes the resource ID to a string format, then performs parallel queries to both collections.
|
|
951
951
|
* If an Event is found, it returns that; otherwise, it checks for a Google Imported Market and returns it if found.
|
|
952
952
|
* If neither is found, it returns null.
|
|
953
953
|
* @param resourceId - The ID of the resource to find, which can be an ObjectId, string, null, or undefined.
|
|
954
|
-
* @returns A promise that resolves to either an Event or a Google Imported Market object containing _id and
|
|
954
|
+
* @returns A promise that resolves to either an Event or a Google Imported Market object containing _id, name, and dateTime, or null if not found.
|
|
955
955
|
*/
|
|
956
956
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
957
957
|
|
|
@@ -1108,6 +1108,19 @@ declare function getPartnerResourceInfo(userId: ObjectId, partnerId: ObjectId):
|
|
|
1108
1108
|
*/
|
|
1109
1109
|
declare function remindUsersAboutLicenseExpiration(): Promise<void>;
|
|
1110
1110
|
|
|
1111
|
+
/**
|
|
1112
|
+
* License expiration reminder window bounds.
|
|
1113
|
+
*
|
|
1114
|
+
* A licence qualifies for the "7 days before expiry" reminder when its expiry is
|
|
1115
|
+
* between {@link REMINDER_WINDOW_MIN_HOURS} and {@link REMINDER_WINDOW_MAX_HOURS}
|
|
1116
|
+
* away.
|
|
1117
|
+
*
|
|
1118
|
+
* Expressed in hours (derived from days) because dayjs rounds fractional "day"
|
|
1119
|
+
* adds: `now.add(6.5, "day")` becomes 7 days and `now.add(7.5, "day")` 8 days.
|
|
1120
|
+
*/
|
|
1121
|
+
declare const REMINDER_WINDOW_MIN_HOURS: number;
|
|
1122
|
+
declare const REMINDER_WINDOW_MAX_HOURS: number;
|
|
1123
|
+
|
|
1111
1124
|
/**
|
|
1112
1125
|
* Single source of truth for how a licence type is handled on expiry.
|
|
1113
1126
|
*
|
|
@@ -1224,4 +1237,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
1224
1237
|
resourceType: EnumResourceType;
|
|
1225
1238
|
}): Promise<void>;
|
|
1226
1239
|
|
|
1227
|
-
export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, ensureUserLicenseCompliance, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
|
|
1240
|
+
export { ACTIVE_NOT_DELETED_FILTER, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, LicenceExpiryDate, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, didRemoveAnyEventDates, ensureUserLicenseCompliance, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, upgradeUserToLicence, userLicenseSchema, vendorLicences, vendorOwnerHasProLicence, vendorProductTypeSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -2418,6 +2418,14 @@ var GET_EVENT = gql`
|
|
|
2418
2418
|
}
|
|
2419
2419
|
${EVENT}
|
|
2420
2420
|
`;
|
|
2421
|
+
var GET_OWNED_EVENT = gql`
|
|
2422
|
+
query getOwnedEvent($_id: ID!) {
|
|
2423
|
+
ownedEvent(_id: $_id) {
|
|
2424
|
+
...EventFields
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
${EVENT}
|
|
2428
|
+
`;
|
|
2421
2429
|
var GET_EVENT_BY_PLACE_ID = gql`
|
|
2422
2430
|
query getEventByPlaceId($googlePlaceId: String!) {
|
|
2423
2431
|
eventByPlaceId(googlePlaceId: $googlePlaceId) {
|
|
@@ -7213,7 +7221,7 @@ var gameScreenIdentifierList2 = [
|
|
|
7213
7221
|
}
|
|
7214
7222
|
];
|
|
7215
7223
|
|
|
7216
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
7224
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-RCARDOVS.mjs
|
|
7217
7225
|
import dayjs4 from "dayjs";
|
|
7218
7226
|
var statusOptions2 = [
|
|
7219
7227
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -8927,8 +8935,8 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
8927
8935
|
}
|
|
8928
8936
|
const normalizedId = convertObjectIdsToStrings(resourceId);
|
|
8929
8937
|
const [eventDoc, googleImportedDoc] = await Promise.all([
|
|
8930
|
-
EventModel.findById(normalizedId).select("_id name").lean().exec(),
|
|
8931
|
-
GoogleImportedMarketModel.findById(normalizedId).select("_id name").lean().exec()
|
|
8938
|
+
EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
|
|
8939
|
+
GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
|
|
8932
8940
|
]);
|
|
8933
8941
|
return eventDoc ?? googleImportedDoc;
|
|
8934
8942
|
}
|
|
@@ -9655,6 +9663,10 @@ async function getPartnerResourceInfo(userId, partnerId) {
|
|
|
9655
9663
|
// src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
|
|
9656
9664
|
import dayjs12 from "dayjs";
|
|
9657
9665
|
|
|
9666
|
+
// src/service/license/reminder/reminderWindow.ts
|
|
9667
|
+
var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
9668
|
+
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
9669
|
+
|
|
9658
9670
|
// src/service/license/reminder/utils.ts
|
|
9659
9671
|
import dayjs11 from "dayjs";
|
|
9660
9672
|
|
|
@@ -9716,8 +9728,8 @@ async function checkAndCreateNotification(payload) {
|
|
|
9716
9728
|
}
|
|
9717
9729
|
function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
9718
9730
|
const expiry = dayjs11(expiryDate);
|
|
9719
|
-
const
|
|
9720
|
-
return
|
|
9731
|
+
const hoursUntilExpiry = expiry.diff(now, "hour", true);
|
|
9732
|
+
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
9721
9733
|
}
|
|
9722
9734
|
function getLicenseName(licenceType) {
|
|
9723
9735
|
return licenseNiceNames[licenceType] || licenceType;
|
|
@@ -9881,8 +9893,8 @@ async function processUserLicenseReminders(user, now) {
|
|
|
9881
9893
|
async function remindUsersAboutLicenseExpiration() {
|
|
9882
9894
|
const now = dayjs12();
|
|
9883
9895
|
console.log(`\u{1F50D} Checking for licenses expiring in 7 days at ${now.format()}`);
|
|
9884
|
-
const minExpiryDate = now.add(
|
|
9885
|
-
const maxExpiryDate = now.add(
|
|
9896
|
+
const minExpiryDate = now.add(REMINDER_WINDOW_MIN_HOURS, "hour").toDate();
|
|
9897
|
+
const maxExpiryDate = now.add(REMINDER_WINDOW_MAX_HOURS, "hour").toDate();
|
|
9886
9898
|
const users = await UserModel.find({
|
|
9887
9899
|
licences: {
|
|
9888
9900
|
$elemMatch: {
|
|
@@ -9939,6 +9951,8 @@ export {
|
|
|
9939
9951
|
PartnerModel,
|
|
9940
9952
|
PostModel,
|
|
9941
9953
|
PushTokenModel,
|
|
9954
|
+
REMINDER_WINDOW_MAX_HOURS,
|
|
9955
|
+
REMINDER_WINDOW_MIN_HOURS,
|
|
9942
9956
|
RelationModel,
|
|
9943
9957
|
RelationTypeSchema,
|
|
9944
9958
|
ResourceActivityModel,
|