@timardex/cluemart-server-shared 2.2.0 → 2.2.2

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.d.mts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate } from '@timardex/cluemart-shared';
3
+ export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
3
4
  import * as mongoose from 'mongoose';
4
5
  import mongoose__default from 'mongoose';
5
6
  export { default as mongoose } from 'mongoose';
6
7
  import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
7
8
  import express from 'express';
8
9
  export { default as express } from 'express';
9
- import dayjs, { Dayjs } from 'dayjs';
10
10
  import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
11
+ import dayjs, { Dayjs } from 'dayjs';
11
12
 
12
13
  declare const schemaAdresource: mongoose__default.Schema<_timardex_cluemart_shared.AdResource, mongoose__default.Model<_timardex_cluemart_shared.AdResource, any, any, any, mongoose__default.Document<unknown, any, _timardex_cluemart_shared.AdResource, any, {}> & _timardex_cluemart_shared.AdResource & {
13
14
  _id: mongoose__default.Types.ObjectId;
@@ -115,6 +116,10 @@ interface AuthUser {
115
116
  email: string;
116
117
  roles: EnumUserRole[];
117
118
  userId: ObjectId;
119
+ /** Set when this token represents an impersonation session. */
120
+ impersonationSessionId?: string;
121
+ /** The SUPER_ADMIN who started the impersonation session. */
122
+ impersonatorUserId?: ObjectId;
118
123
  }
119
124
  interface SubscriptionPayload {
120
125
  getChatMessage?: SchemaChatType;
@@ -893,6 +898,36 @@ declare const CouponModel: mongoose__default.Model<CouponDocument, {}, {}, {}, m
893
898
  __v: number;
894
899
  }, any>;
895
900
 
901
+ type SchemaImpersonationSessionType = {
902
+ /** The SUPER_ADMIN who is impersonating. */
903
+ impersonatorUserId: ObjectId;
904
+ /** The resource owner being impersonated. */
905
+ impersonatedUserId: ObjectId;
906
+ /** Hashed impersonation refresh token (stored here, not on the User doc). */
907
+ refreshToken: string;
908
+ expiresAt: Date;
909
+ };
910
+ declare const ImpersonationSessionModel: mongoose__default.Model<SchemaImpersonationSessionType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationSessionType, {}, {}> & SchemaImpersonationSessionType & {
911
+ _id: mongoose__default.Types.ObjectId;
912
+ } & {
913
+ __v: number;
914
+ }, any>;
915
+ type SchemaImpersonationAuditType = {
916
+ action: "start" | "end";
917
+ /** Reason for an `end` record (manual, logout, reuse_revoked, expired). */
918
+ endReason?: string | null;
919
+ impersonatedUserId: ObjectId;
920
+ impersonatorUserId: ObjectId;
921
+ resourceId?: ObjectId | null;
922
+ resourceType?: EnumResourceType | null;
923
+ sessionId: ObjectId;
924
+ };
925
+ declare const ImpersonationAuditModel: mongoose__default.Model<SchemaImpersonationAuditType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationAuditType, {}, {}> & SchemaImpersonationAuditType & {
926
+ _id: mongoose__default.Types.ObjectId;
927
+ } & {
928
+ __v: number;
929
+ }, any>;
930
+
896
931
  /**
897
932
  * Checks whether an affiliate code is already taken by an active, non-deleted affiliate.
898
933
  *
@@ -1012,9 +1047,8 @@ declare function publishNotificationEvents(userId: ObjectId, pubsub: Notificatio
1012
1047
  * is provided) publishes GraphQL subscription events for each affected user.
1013
1048
  *
1014
1049
  * Errors are logged and swallowed; this function never throws. Instead it
1015
- * returns `false` when notifications were not confirmed (an error was thrown,
1016
- * or `saveNotificationsInDb` failed to persist any rows for a non-empty
1017
- * `userIds`), so callers can gate success logs/metrics on the result.
1050
+ * returns `false` when notifications were not confirmed, so callers can gate
1051
+ * success logs/metrics on the result.
1018
1052
  */
1019
1053
  declare function notifyUsers({ payload, pubsub, }: {
1020
1054
  payload: SchemaCreateBulkNotificationInput;
@@ -1044,14 +1078,6 @@ declare function isValidObjectId(value: string): boolean;
1044
1078
  */
1045
1079
  declare function convertObjectIdsToStrings(obj: any): any;
1046
1080
 
1047
- /**
1048
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time.
1049
- * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
1050
- * @param dateTime The date-time object to update
1051
- * @returns A new object with an updated dateStatus value, or the original
1052
- * object when the stored status is a manual override
1053
- */
1054
- declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
1055
1081
  /**
1056
1082
  * Recomputes dateStatus for every dateTime slot on events and google imported
1057
1083
  * markets, moves ended event date slots into the event date archive, and keeps
@@ -1386,4 +1412,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1386
1412
  resourceType: EnumResourceType;
1387
1413
  }): Promise<void>;
1388
1414
 
1389
- export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, 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 SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, 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 SchemaStripeSubscription, 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, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, 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, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
1415
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, LicenceCategory, 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 SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, 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, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, 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, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate } from '@timardex/cluemart-shared';
3
+ export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
3
4
  import * as mongoose from 'mongoose';
4
5
  import mongoose__default from 'mongoose';
5
6
  export { default as mongoose } from 'mongoose';
6
7
  import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
7
8
  import express from 'express';
8
9
  export { default as express } from 'express';
9
- import dayjs, { Dayjs } from 'dayjs';
10
10
  import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
11
+ import dayjs, { Dayjs } from 'dayjs';
11
12
 
12
13
  declare const schemaAdresource: mongoose__default.Schema<_timardex_cluemart_shared.AdResource, mongoose__default.Model<_timardex_cluemart_shared.AdResource, any, any, any, mongoose__default.Document<unknown, any, _timardex_cluemart_shared.AdResource, any, {}> & _timardex_cluemart_shared.AdResource & {
13
14
  _id: mongoose__default.Types.ObjectId;
@@ -115,6 +116,10 @@ interface AuthUser {
115
116
  email: string;
116
117
  roles: EnumUserRole[];
117
118
  userId: ObjectId;
119
+ /** Set when this token represents an impersonation session. */
120
+ impersonationSessionId?: string;
121
+ /** The SUPER_ADMIN who started the impersonation session. */
122
+ impersonatorUserId?: ObjectId;
118
123
  }
119
124
  interface SubscriptionPayload {
120
125
  getChatMessage?: SchemaChatType;
@@ -893,6 +898,36 @@ declare const CouponModel: mongoose__default.Model<CouponDocument, {}, {}, {}, m
893
898
  __v: number;
894
899
  }, any>;
895
900
 
901
+ type SchemaImpersonationSessionType = {
902
+ /** The SUPER_ADMIN who is impersonating. */
903
+ impersonatorUserId: ObjectId;
904
+ /** The resource owner being impersonated. */
905
+ impersonatedUserId: ObjectId;
906
+ /** Hashed impersonation refresh token (stored here, not on the User doc). */
907
+ refreshToken: string;
908
+ expiresAt: Date;
909
+ };
910
+ declare const ImpersonationSessionModel: mongoose__default.Model<SchemaImpersonationSessionType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationSessionType, {}, {}> & SchemaImpersonationSessionType & {
911
+ _id: mongoose__default.Types.ObjectId;
912
+ } & {
913
+ __v: number;
914
+ }, any>;
915
+ type SchemaImpersonationAuditType = {
916
+ action: "start" | "end";
917
+ /** Reason for an `end` record (manual, logout, reuse_revoked, expired). */
918
+ endReason?: string | null;
919
+ impersonatedUserId: ObjectId;
920
+ impersonatorUserId: ObjectId;
921
+ resourceId?: ObjectId | null;
922
+ resourceType?: EnumResourceType | null;
923
+ sessionId: ObjectId;
924
+ };
925
+ declare const ImpersonationAuditModel: mongoose__default.Model<SchemaImpersonationAuditType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationAuditType, {}, {}> & SchemaImpersonationAuditType & {
926
+ _id: mongoose__default.Types.ObjectId;
927
+ } & {
928
+ __v: number;
929
+ }, any>;
930
+
896
931
  /**
897
932
  * Checks whether an affiliate code is already taken by an active, non-deleted affiliate.
898
933
  *
@@ -1012,9 +1047,8 @@ declare function publishNotificationEvents(userId: ObjectId, pubsub: Notificatio
1012
1047
  * is provided) publishes GraphQL subscription events for each affected user.
1013
1048
  *
1014
1049
  * Errors are logged and swallowed; this function never throws. Instead it
1015
- * returns `false` when notifications were not confirmed (an error was thrown,
1016
- * or `saveNotificationsInDb` failed to persist any rows for a non-empty
1017
- * `userIds`), so callers can gate success logs/metrics on the result.
1050
+ * returns `false` when notifications were not confirmed, so callers can gate
1051
+ * success logs/metrics on the result.
1018
1052
  */
1019
1053
  declare function notifyUsers({ payload, pubsub, }: {
1020
1054
  payload: SchemaCreateBulkNotificationInput;
@@ -1044,14 +1078,6 @@ declare function isValidObjectId(value: string): boolean;
1044
1078
  */
1045
1079
  declare function convertObjectIdsToStrings(obj: any): any;
1046
1080
 
1047
- /**
1048
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time.
1049
- * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
1050
- * @param dateTime The date-time object to update
1051
- * @returns A new object with an updated dateStatus value, or the original
1052
- * object when the stored status is a manual override
1053
- */
1054
- declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
1055
1081
  /**
1056
1082
  * Recomputes dateStatus for every dateTime slot on events and google imported
1057
1083
  * markets, moves ended event date slots into the event date archive, and keeps
@@ -1386,4 +1412,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1386
1412
  resourceType: EnumResourceType;
1387
1413
  }): Promise<void>;
1388
1414
 
1389
- export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, 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 SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, 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 SchemaStripeSubscription, 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, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, 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, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
1415
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, LicenceCategory, 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 SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, 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, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, 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, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
package/dist/index.mjs CHANGED
@@ -1083,16 +1083,24 @@ import {
1083
1083
  } from "@timardex/cluemart-shared";
1084
1084
  import mongoose11 from "mongoose";
1085
1085
  var MongooseSchema7 = mongoose11.Schema;
1086
+ var notificationDataSchema = new MongooseSchema7(
1087
+ {
1088
+ resourceId: { required: true, type: String },
1089
+ resourceName: { required: true, type: String },
1090
+ resourceType: {
1091
+ enum: Object.values(EnumNotificationResourceType),
1092
+ required: true,
1093
+ type: String
1094
+ }
1095
+ },
1096
+ { _id: false }
1097
+ );
1086
1098
  var schema8 = new MongooseSchema7(
1087
1099
  {
1088
1100
  data: {
1089
- resourceId: { required: true, type: String },
1090
- resourceName: { required: true, type: String },
1091
- resourceType: {
1092
- enum: Object.values(EnumNotificationResourceType),
1093
- required: true,
1094
- type: String
1095
- }
1101
+ default: null,
1102
+ required: false,
1103
+ type: notificationDataSchema
1096
1104
  },
1097
1105
  isRead: { default: false, index: true, required: true, type: Boolean },
1098
1106
  message: { required: true, type: String },
@@ -2513,6 +2521,62 @@ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2513
2521
  schema24.index({ "couponData.participantUsers.userId": 1 });
2514
2522
  var CouponModel = mongoose32.models.Coupon || mongoose32.model("Coupon", schema24);
2515
2523
 
2524
+ // src/mongoose/Impersonation.ts
2525
+ import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
2526
+ import mongoose33 from "mongoose";
2527
+ var MongooseSchema28 = mongoose33.Schema;
2528
+ var impersonationSessionSchema = new MongooseSchema28(
2529
+ {
2530
+ expiresAt: { expires: 0, required: true, type: Date },
2531
+ impersonatedUserId: {
2532
+ index: true,
2533
+ ref: "User",
2534
+ required: true,
2535
+ type: mongoose33.Schema.Types.ObjectId
2536
+ },
2537
+ impersonatorUserId: {
2538
+ index: true,
2539
+ ref: "User",
2540
+ required: true,
2541
+ type: mongoose33.Schema.Types.ObjectId
2542
+ },
2543
+ refreshToken: { required: true, type: String }
2544
+ },
2545
+ { timestamps: true }
2546
+ );
2547
+ var ImpersonationSessionModel = mongoose33.models.ImpersonationSession || mongoose33.model(
2548
+ "ImpersonationSession",
2549
+ impersonationSessionSchema
2550
+ );
2551
+ var impersonationAuditSchema = new MongooseSchema28(
2552
+ {
2553
+ action: { enum: ["start", "end"], required: true, type: String },
2554
+ endReason: { type: String },
2555
+ impersonatedUserId: {
2556
+ ref: "User",
2557
+ required: true,
2558
+ type: mongoose33.Schema.Types.ObjectId
2559
+ },
2560
+ impersonatorUserId: {
2561
+ ref: "User",
2562
+ required: true,
2563
+ type: mongoose33.Schema.Types.ObjectId
2564
+ },
2565
+ resourceId: { type: mongoose33.Schema.Types.ObjectId },
2566
+ resourceType: { enum: Object.values(EnumResourceType8), type: String },
2567
+ sessionId: {
2568
+ ref: "ImpersonationSession",
2569
+ required: true,
2570
+ type: mongoose33.Schema.Types.ObjectId
2571
+ }
2572
+ },
2573
+ { timestamps: true }
2574
+ );
2575
+ var ImpersonationAuditModel = mongoose33.models.ImpersonationAudit || mongoose33.model(
2576
+ "ImpersonationAudit",
2577
+ impersonationAuditSchema
2578
+ );
2579
+
2516
2580
  // src/service/promoCode/constants.ts
2517
2581
  var ACTIVE_NOT_DELETED_FILTER = {
2518
2582
  active: true,
@@ -2532,32 +2596,31 @@ async function activeAffiliateCodeExists(affiliateCode) {
2532
2596
  import {
2533
2597
  EnumNotificationResourceType as EnumNotificationResourceType3,
2534
2598
  EnumNotificationType as EnumNotificationType2,
2535
- EnumResourceType as EnumResourceType8
2599
+ EnumResourceType as EnumResourceType9
2536
2600
  } from "@timardex/cluemart-shared";
2537
2601
  import { createAffiliateReward } from "@timardex/cluemart-shared/utils";
2538
2602
 
2539
2603
  // src/service/saveNotificationsInDb.ts
2540
2604
  async function saveNotificationsInDb(payload) {
2541
2605
  const { data, message, title, type, userIds } = payload;
2542
- console.log("NOTIFICATION DATA", JSON.stringify(payload, null, 2));
2606
+ const notifications = userIds.map((userId) => ({
2607
+ data,
2608
+ isRead: false,
2609
+ message,
2610
+ title,
2611
+ type,
2612
+ userId
2613
+ }));
2543
2614
  try {
2544
- const notifications = userIds.map((userId) => ({
2545
- data,
2546
- isRead: false,
2547
- message,
2548
- title,
2549
- type,
2550
- userId
2551
- }));
2552
2615
  await NotificationModel.insertMany(notifications);
2553
- console.log(
2554
- `Created ${notifications.length} notifications for ${userIds.length} users`
2555
- );
2556
- return [...new Set(userIds)];
2557
2616
  } catch (error) {
2558
2617
  console.error("Failed to create notifications:", error);
2559
- return [];
2618
+ throw error;
2560
2619
  }
2620
+ console.log(
2621
+ `Created ${notifications.length} notifications for ${userIds.length} users`
2622
+ );
2623
+ return [...new Set(userIds)];
2561
2624
  }
2562
2625
 
2563
2626
  // src/service/sendPushNotifications.ts
@@ -2581,7 +2644,7 @@ function createPushMessages({
2581
2644
  }
2582
2645
  messages.push({
2583
2646
  body: message,
2584
- data: { ...data },
2647
+ ...data ? { data: { ...data } } : {},
2585
2648
  sound: "tui.wav",
2586
2649
  title,
2587
2650
  to: token
@@ -2636,7 +2699,6 @@ async function sendPushNotifications({
2636
2699
  }) {
2637
2700
  const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
2638
2701
  const expoTokens = pushTokens.map((token) => token.token);
2639
- if (!data) return;
2640
2702
  const { messages, invalidTokens } = createPushMessages({
2641
2703
  data,
2642
2704
  message,
@@ -2753,7 +2815,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
2753
2815
 
2754
2816
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2755
2817
  function isEligibleVendorResource(resource) {
2756
- return resource.resourceType === EnumResourceType8.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2818
+ return resource.resourceType === EnumResourceType9.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2757
2819
  }
2758
2820
  async function findAffiliatesWithActiveVendorReferrals() {
2759
2821
  return await AffiliateModel.find({
@@ -2762,7 +2824,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
2762
2824
  $elemMatch: {
2763
2825
  resourceActive: true,
2764
2826
  resourceDeletedAt: null,
2765
- resourceType: EnumResourceType8.VENDOR
2827
+ resourceType: EnumResourceType9.VENDOR
2766
2828
  }
2767
2829
  },
2768
2830
  deletedAt: null
@@ -2829,7 +2891,7 @@ async function tryAwardSubscriptionReward({
2829
2891
  resourceActive: true,
2830
2892
  resourceDeletedAt: null,
2831
2893
  resourceId: resource.resourceId,
2832
- resourceType: EnumResourceType8.VENDOR,
2894
+ resourceType: EnumResourceType9.VENDOR,
2833
2895
  rewards: {
2834
2896
  $not: {
2835
2897
  $elemMatch: {
@@ -2950,7 +3012,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
2950
3012
  }
2951
3013
 
2952
3014
  // src/service/database.ts
2953
- import mongoose33 from "mongoose";
3015
+ import mongoose34 from "mongoose";
2954
3016
  var connectToDatabase = async ({
2955
3017
  appName,
2956
3018
  dbName,
@@ -2963,7 +3025,7 @@ var connectToDatabase = async ({
2963
3025
  // Fallback to MongoDB Atlas connection string
2964
3026
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
2965
3027
  );
2966
- await mongoose33.connect(mongoUri);
3028
+ await mongoose34.connect(mongoUri);
2967
3029
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
2968
3030
  console.log(
2969
3031
  `${connectionType} connected from server/src/service/database.ts`
@@ -2976,7 +3038,7 @@ var connectToDatabase = async ({
2976
3038
 
2977
3039
  // src/types/index.ts
2978
3040
  import express from "express";
2979
- import mongoose34 from "mongoose";
3041
+ import mongoose35 from "mongoose";
2980
3042
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
2981
3043
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
2982
3044
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -3097,15 +3159,15 @@ async function updateAdStatuses() {
3097
3159
  }
3098
3160
 
3099
3161
  // src/service/objectIdToString.ts
3100
- import mongoose35 from "mongoose";
3162
+ import mongoose36 from "mongoose";
3101
3163
  function isValidObjectId(value) {
3102
- return mongoose35.Types.ObjectId.isValid(value);
3164
+ return mongoose36.Types.ObjectId.isValid(value);
3103
3165
  }
3104
3166
  function convertObjectIdsToStrings(obj) {
3105
3167
  if (obj === null || obj === void 0) {
3106
3168
  return obj;
3107
3169
  }
3108
- if (obj instanceof mongoose35.Types.ObjectId) {
3170
+ if (obj instanceof mongoose36.Types.ObjectId) {
3109
3171
  return obj.toString();
3110
3172
  }
3111
3173
  if (obj instanceof Date) {
@@ -3126,14 +3188,11 @@ function convertObjectIdsToStrings(obj) {
3126
3188
 
3127
3189
  // src/service/event/updateAllEventDateTimeStatuses.ts
3128
3190
  import {
3129
- dateFormat,
3130
3191
  EnumEventDateStatus as EnumEventDateStatus7,
3131
3192
  filterDatesByFutureStatus,
3132
- timeFormat
3193
+ updateSingleDateTimeStatus
3133
3194
  } from "@timardex/cluemart-shared";
3134
3195
  import dayjs2 from "dayjs";
3135
- import customParseFormat from "dayjs/plugin/customParseFormat";
3136
- import isoWeek from "dayjs/plugin/isoWeek";
3137
3196
 
3138
3197
  // src/service/event/archiveEndedEventDates.ts
3139
3198
  import { EnumEventDateStatus as EnumEventDateStatus6 } from "@timardex/cluemart-shared";
@@ -3176,73 +3235,6 @@ async function persistArchivedEventDates(eventId, slots) {
3176
3235
  }
3177
3236
 
3178
3237
  // src/service/event/updateAllEventDateTimeStatuses.ts
3179
- dayjs2.extend(customParseFormat);
3180
- dayjs2.extend(isoWeek);
3181
- var MANUAL_DATE_STATUSES = /* @__PURE__ */ new Set([
3182
- EnumEventDateStatus7.CANCELED,
3183
- EnumEventDateStatus7.RE_SCHEDULED
3184
- ]);
3185
- function getFutureEventStatus(startDateTime, now) {
3186
- const hoursUntilStart = startDateTime.diff(now, "hour", true);
3187
- if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
3188
- return EnumEventDateStatus7.STARTING_SOON;
3189
- }
3190
- if (startDateTime.isSame(now, "day")) {
3191
- return EnumEventDateStatus7.TODAY;
3192
- }
3193
- if (startDateTime.isSame(now.add(1, "day"), "day")) {
3194
- return EnumEventDateStatus7.TOMORROW;
3195
- }
3196
- if (startDateTime.isSame(now, "isoWeek")) {
3197
- return EnumEventDateStatus7.THIS_WEEK;
3198
- }
3199
- if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
3200
- return EnumEventDateStatus7.NEXT_WEEK;
3201
- }
3202
- return EnumEventDateStatus7.UPCOMING;
3203
- }
3204
- function updateSingleDateTimeStatus(dateTime, now = dayjs2()) {
3205
- if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {
3206
- return dateTime;
3207
- }
3208
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
3209
- const startDateTime = dayjs2(
3210
- `${dateTime.startDate} ${dateTime.startTime}`,
3211
- dateTimeFormat,
3212
- true
3213
- );
3214
- const endDateTime = dayjs2(
3215
- `${dateTime.endDate} ${dateTime.endTime}`,
3216
- dateTimeFormat,
3217
- true
3218
- );
3219
- if (!startDateTime.isValid() || !endDateTime.isValid()) {
3220
- return {
3221
- ...dateTime,
3222
- dateStatus: EnumEventDateStatus7.INVALID
3223
- };
3224
- }
3225
- if (endDateTime.isBefore(startDateTime)) {
3226
- return {
3227
- ...dateTime,
3228
- dateStatus: EnumEventDateStatus7.INVALID
3229
- };
3230
- }
3231
- let dateStatus;
3232
- if (endDateTime.isAfter(now)) {
3233
- if (startDateTime.isAfter(now)) {
3234
- dateStatus = getFutureEventStatus(startDateTime, now);
3235
- } else {
3236
- dateStatus = EnumEventDateStatus7.STARTED;
3237
- }
3238
- } else {
3239
- dateStatus = EnumEventDateStatus7.ENDED;
3240
- }
3241
- return {
3242
- ...dateTime,
3243
- dateStatus
3244
- };
3245
- }
3246
3238
  var dateTimeStatusFilter = {
3247
3239
  dateTime: { $ne: [], $type: "array" },
3248
3240
  deletedAt: null
@@ -3421,6 +3413,9 @@ async function updateAllEventDateTimeStatuses() {
3421
3413
  }
3422
3414
  }
3423
3415
 
3416
+ // src/service/index.ts
3417
+ import { updateSingleDateTimeStatus as updateSingleDateTimeStatus2 } from "@timardex/cluemart-shared";
3418
+
3424
3419
  // src/service/event/findEventOrImportedMarketById.ts
3425
3420
  async function findEventOrImportedMarketById(resourceId) {
3426
3421
  if (!resourceId) {
@@ -3709,7 +3704,7 @@ import dayjs4 from "dayjs";
3709
3704
 
3710
3705
  // src/service/license/models.ts
3711
3706
  import {
3712
- EnumResourceType as EnumResourceType9,
3707
+ EnumResourceType as EnumResourceType10,
3713
3708
  EnumUserLicence as EnumUserLicence8,
3714
3709
  isNonVisitorResourceType,
3715
3710
  LicenceExpiryDate
@@ -3905,11 +3900,11 @@ async function checkOwnerHasLicence({
3905
3900
  const owner = await UserModel.findById(userId);
3906
3901
  if (!owner) throw new GraphQLError("Owner not found");
3907
3902
  const categoryByResource = {
3908
- [EnumResourceType9.EVENT]: "event" /* EVENT */,
3909
- [EnumResourceType9.PARTNER]: "partner" /* PARTNER */,
3910
- [EnumResourceType9.VENDOR]: "vendor" /* VENDOR */,
3911
- [EnumResourceType9.AFFILIATE]: "affiliate" /* AFFILIATE */,
3912
- [EnumResourceType9.SCHOOL]: "school" /* SCHOOL */
3903
+ [EnumResourceType10.EVENT]: "event" /* EVENT */,
3904
+ [EnumResourceType10.PARTNER]: "partner" /* PARTNER */,
3905
+ [EnumResourceType10.VENDOR]: "vendor" /* VENDOR */,
3906
+ [EnumResourceType10.AFFILIATE]: "affiliate" /* AFFILIATE */,
3907
+ [EnumResourceType10.SCHOOL]: "school" /* SCHOOL */
3913
3908
  };
3914
3909
  if (!isNonVisitorResourceType(resourceType)) {
3915
3910
  throw new GraphQLError(`Invalid resource type: ${resourceType}.`);
@@ -4312,7 +4307,7 @@ var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4312
4307
 
4313
4308
  // src/service/license/reminder/utils.ts
4314
4309
  import {
4315
- dateFormat as dateFormat2,
4310
+ dateFormat,
4316
4311
  EnumNotificationResourceType as EnumNotificationResourceType6,
4317
4312
  EnumNotificationType as EnumNotificationType5,
4318
4313
  EnumUserLicence as EnumUserLicence11,
@@ -4457,7 +4452,7 @@ function getLicenceExpiryMode(licenceType) {
4457
4452
  }
4458
4453
  async function sendLicenseReminder(user, licence) {
4459
4454
  const licenceName = getLicenseName(licence.licenceType);
4460
- const expiryDate = dayjs7(licence.expiryDate).format(dateFormat2);
4455
+ const expiryDate = dayjs7(licence.expiryDate).format(dateFormat);
4461
4456
  const userId = String(user._id);
4462
4457
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4463
4458
  if (!resourceInfo) {
@@ -4605,6 +4600,8 @@ export {
4605
4600
  EventModel,
4606
4601
  GameModel,
4607
4602
  GoogleImportedMarketModel,
4603
+ ImpersonationAuditModel,
4604
+ ImpersonationSessionModel,
4608
4605
  LicenceCategory,
4609
4606
  NotificationModel,
4610
4607
  OwnerTypeSchema,
@@ -4667,7 +4664,7 @@ export {
4667
4664
  locationGeoSchema,
4668
4665
  locationsSchema,
4669
4666
  mapVendorLicenceToSubscriptionRewardType,
4670
- mongoose34 as mongoose,
4667
+ mongoose35 as mongoose,
4671
4668
  normalizeAffiliatePromoCodes,
4672
4669
  normalizePromoCode,
4673
4670
  notifyUsers,
@@ -4696,7 +4693,7 @@ export {
4696
4693
  updateAdStatuses,
4697
4694
  updateAllEventDateTimeStatuses,
4698
4695
  updateRelationDatesToUnavailable,
4699
- updateSingleDateTimeStatus,
4696
+ updateSingleDateTimeStatus2 as updateSingleDateTimeStatus,
4700
4697
  upgradeUserToLicence,
4701
4698
  userLicenseSchema,
4702
4699
  vendorOwnerHasProLicence,