@timardex/cluemart-server-shared 2.2.1 → 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/{Affiliate-i11rkfv5.d.mts → Affiliate-6AEy-gNx.d.mts} +1 -1
- package/dist/{Affiliate-BSF7Wm6O.d.ts → Affiliate-D40kRxO_.d.ts} +1 -1
- package/dist/{chunk-ZKHRT2PV.mjs → chunk-TIGQ6F5T.mjs} +60 -2
- package/dist/chunk-TIGQ6F5T.mjs.map +1 -0
- package/dist/{chunk-6PNG5BI5.mjs → chunk-TMPPPLIW.mjs} +1 -1
- package/dist/chunk-TMPPPLIW.mjs.map +1 -0
- package/dist/{index-Bq-lT7a2.d.mts → index-CmtBYjpi.d.mts} +4 -0
- package/dist/{index-Bq-lT7a2.d.ts → index-CmtBYjpi.d.ts} +4 -0
- package/dist/index.cjs +183 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +38 -11
- package/dist/index.d.ts +38 -11
- package/dist/index.mjs +82 -91
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +60 -0
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +36 -6
- package/dist/mongoose/index.d.ts +36 -6
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +178 -188
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +5 -12
- package/dist/service/index.d.ts +5 -12
- package/dist/service/index.mjs +9 -76
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-6PNG5BI5.mjs.map +0 -1
- package/dist/chunk-ZKHRT2PV.mjs.map +0 -1
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,
|
|
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
|
*
|
|
@@ -1043,14 +1078,6 @@ declare function isValidObjectId(value: string): boolean;
|
|
|
1043
1078
|
*/
|
|
1044
1079
|
declare function convertObjectIdsToStrings(obj: any): any;
|
|
1045
1080
|
|
|
1046
|
-
/**
|
|
1047
|
-
* Updates the dateStatus field for a single DateTimeType object based on the current date/time.
|
|
1048
|
-
* Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
|
|
1049
|
-
* @param dateTime The date-time object to update
|
|
1050
|
-
* @returns A new object with an updated dateStatus value, or the original
|
|
1051
|
-
* object when the stored status is a manual override
|
|
1052
|
-
*/
|
|
1053
|
-
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
|
|
1054
1081
|
/**
|
|
1055
1082
|
* Recomputes dateStatus for every dateTime slot on events and google imported
|
|
1056
1083
|
* markets, moves ended event date slots into the event date archive, and keeps
|
|
@@ -1385,4 +1412,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
1385
1412
|
resourceType: EnumResourceType;
|
|
1386
1413
|
}): Promise<void>;
|
|
1387
1414
|
|
|
1388
|
-
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,
|
|
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,
|
|
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
|
*
|
|
@@ -1043,14 +1078,6 @@ declare function isValidObjectId(value: string): boolean;
|
|
|
1043
1078
|
*/
|
|
1044
1079
|
declare function convertObjectIdsToStrings(obj: any): any;
|
|
1045
1080
|
|
|
1046
|
-
/**
|
|
1047
|
-
* Updates the dateStatus field for a single DateTimeType object based on the current date/time.
|
|
1048
|
-
* Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
|
|
1049
|
-
* @param dateTime The date-time object to update
|
|
1050
|
-
* @returns A new object with an updated dateStatus value, or the original
|
|
1051
|
-
* object when the stored status is a manual override
|
|
1052
|
-
*/
|
|
1053
|
-
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
|
|
1054
1081
|
/**
|
|
1055
1082
|
* Recomputes dateStatus for every dateTime slot on events and google imported
|
|
1056
1083
|
* markets, moves ended event date slots into the event date archive, and keeps
|
|
@@ -1385,4 +1412,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
1385
1412
|
resourceType: EnumResourceType;
|
|
1386
1413
|
}): Promise<void>;
|
|
1387
1414
|
|
|
1388
|
-
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,
|
|
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
|
@@ -2521,6 +2521,62 @@ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
|
2521
2521
|
schema24.index({ "couponData.participantUsers.userId": 1 });
|
|
2522
2522
|
var CouponModel = mongoose32.models.Coupon || mongoose32.model("Coupon", schema24);
|
|
2523
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
|
+
|
|
2524
2580
|
// src/service/promoCode/constants.ts
|
|
2525
2581
|
var ACTIVE_NOT_DELETED_FILTER = {
|
|
2526
2582
|
active: true,
|
|
@@ -2540,7 +2596,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
2540
2596
|
import {
|
|
2541
2597
|
EnumNotificationResourceType as EnumNotificationResourceType3,
|
|
2542
2598
|
EnumNotificationType as EnumNotificationType2,
|
|
2543
|
-
EnumResourceType as
|
|
2599
|
+
EnumResourceType as EnumResourceType9
|
|
2544
2600
|
} from "@timardex/cluemart-shared";
|
|
2545
2601
|
import { createAffiliateReward } from "@timardex/cluemart-shared/utils";
|
|
2546
2602
|
|
|
@@ -2759,7 +2815,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
|
2759
2815
|
|
|
2760
2816
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2761
2817
|
function isEligibleVendorResource(resource) {
|
|
2762
|
-
return resource.resourceType ===
|
|
2818
|
+
return resource.resourceType === EnumResourceType9.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
2763
2819
|
}
|
|
2764
2820
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
2765
2821
|
return await AffiliateModel.find({
|
|
@@ -2768,7 +2824,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
2768
2824
|
$elemMatch: {
|
|
2769
2825
|
resourceActive: true,
|
|
2770
2826
|
resourceDeletedAt: null,
|
|
2771
|
-
resourceType:
|
|
2827
|
+
resourceType: EnumResourceType9.VENDOR
|
|
2772
2828
|
}
|
|
2773
2829
|
},
|
|
2774
2830
|
deletedAt: null
|
|
@@ -2835,7 +2891,7 @@ async function tryAwardSubscriptionReward({
|
|
|
2835
2891
|
resourceActive: true,
|
|
2836
2892
|
resourceDeletedAt: null,
|
|
2837
2893
|
resourceId: resource.resourceId,
|
|
2838
|
-
resourceType:
|
|
2894
|
+
resourceType: EnumResourceType9.VENDOR,
|
|
2839
2895
|
rewards: {
|
|
2840
2896
|
$not: {
|
|
2841
2897
|
$elemMatch: {
|
|
@@ -2956,7 +3012,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
2956
3012
|
}
|
|
2957
3013
|
|
|
2958
3014
|
// src/service/database.ts
|
|
2959
|
-
import
|
|
3015
|
+
import mongoose34 from "mongoose";
|
|
2960
3016
|
var connectToDatabase = async ({
|
|
2961
3017
|
appName,
|
|
2962
3018
|
dbName,
|
|
@@ -2969,7 +3025,7 @@ var connectToDatabase = async ({
|
|
|
2969
3025
|
// Fallback to MongoDB Atlas connection string
|
|
2970
3026
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
2971
3027
|
);
|
|
2972
|
-
await
|
|
3028
|
+
await mongoose34.connect(mongoUri);
|
|
2973
3029
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
2974
3030
|
console.log(
|
|
2975
3031
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -2982,7 +3038,7 @@ var connectToDatabase = async ({
|
|
|
2982
3038
|
|
|
2983
3039
|
// src/types/index.ts
|
|
2984
3040
|
import express from "express";
|
|
2985
|
-
import
|
|
3041
|
+
import mongoose35 from "mongoose";
|
|
2986
3042
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
2987
3043
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
2988
3044
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3103,15 +3159,15 @@ async function updateAdStatuses() {
|
|
|
3103
3159
|
}
|
|
3104
3160
|
|
|
3105
3161
|
// src/service/objectIdToString.ts
|
|
3106
|
-
import
|
|
3162
|
+
import mongoose36 from "mongoose";
|
|
3107
3163
|
function isValidObjectId(value) {
|
|
3108
|
-
return
|
|
3164
|
+
return mongoose36.Types.ObjectId.isValid(value);
|
|
3109
3165
|
}
|
|
3110
3166
|
function convertObjectIdsToStrings(obj) {
|
|
3111
3167
|
if (obj === null || obj === void 0) {
|
|
3112
3168
|
return obj;
|
|
3113
3169
|
}
|
|
3114
|
-
if (obj instanceof
|
|
3170
|
+
if (obj instanceof mongoose36.Types.ObjectId) {
|
|
3115
3171
|
return obj.toString();
|
|
3116
3172
|
}
|
|
3117
3173
|
if (obj instanceof Date) {
|
|
@@ -3132,14 +3188,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
3132
3188
|
|
|
3133
3189
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
3134
3190
|
import {
|
|
3135
|
-
dateFormat,
|
|
3136
3191
|
EnumEventDateStatus as EnumEventDateStatus7,
|
|
3137
3192
|
filterDatesByFutureStatus,
|
|
3138
|
-
|
|
3193
|
+
updateSingleDateTimeStatus
|
|
3139
3194
|
} from "@timardex/cluemart-shared";
|
|
3140
3195
|
import dayjs2 from "dayjs";
|
|
3141
|
-
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
3142
|
-
import isoWeek from "dayjs/plugin/isoWeek";
|
|
3143
3196
|
|
|
3144
3197
|
// src/service/event/archiveEndedEventDates.ts
|
|
3145
3198
|
import { EnumEventDateStatus as EnumEventDateStatus6 } from "@timardex/cluemart-shared";
|
|
@@ -3182,73 +3235,6 @@ async function persistArchivedEventDates(eventId, slots) {
|
|
|
3182
3235
|
}
|
|
3183
3236
|
|
|
3184
3237
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
3185
|
-
dayjs2.extend(customParseFormat);
|
|
3186
|
-
dayjs2.extend(isoWeek);
|
|
3187
|
-
var MANUAL_DATE_STATUSES = /* @__PURE__ */ new Set([
|
|
3188
|
-
EnumEventDateStatus7.CANCELED,
|
|
3189
|
-
EnumEventDateStatus7.RE_SCHEDULED
|
|
3190
|
-
]);
|
|
3191
|
-
function getFutureEventStatus(startDateTime, now) {
|
|
3192
|
-
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
3193
|
-
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
3194
|
-
return EnumEventDateStatus7.STARTING_SOON;
|
|
3195
|
-
}
|
|
3196
|
-
if (startDateTime.isSame(now, "day")) {
|
|
3197
|
-
return EnumEventDateStatus7.TODAY;
|
|
3198
|
-
}
|
|
3199
|
-
if (startDateTime.isSame(now.add(1, "day"), "day")) {
|
|
3200
|
-
return EnumEventDateStatus7.TOMORROW;
|
|
3201
|
-
}
|
|
3202
|
-
if (startDateTime.isSame(now, "isoWeek")) {
|
|
3203
|
-
return EnumEventDateStatus7.THIS_WEEK;
|
|
3204
|
-
}
|
|
3205
|
-
if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
|
|
3206
|
-
return EnumEventDateStatus7.NEXT_WEEK;
|
|
3207
|
-
}
|
|
3208
|
-
return EnumEventDateStatus7.UPCOMING;
|
|
3209
|
-
}
|
|
3210
|
-
function updateSingleDateTimeStatus(dateTime, now = dayjs2()) {
|
|
3211
|
-
if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {
|
|
3212
|
-
return dateTime;
|
|
3213
|
-
}
|
|
3214
|
-
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
3215
|
-
const startDateTime = dayjs2(
|
|
3216
|
-
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
3217
|
-
dateTimeFormat,
|
|
3218
|
-
true
|
|
3219
|
-
);
|
|
3220
|
-
const endDateTime = dayjs2(
|
|
3221
|
-
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
3222
|
-
dateTimeFormat,
|
|
3223
|
-
true
|
|
3224
|
-
);
|
|
3225
|
-
if (!startDateTime.isValid() || !endDateTime.isValid()) {
|
|
3226
|
-
return {
|
|
3227
|
-
...dateTime,
|
|
3228
|
-
dateStatus: EnumEventDateStatus7.INVALID
|
|
3229
|
-
};
|
|
3230
|
-
}
|
|
3231
|
-
if (endDateTime.isBefore(startDateTime)) {
|
|
3232
|
-
return {
|
|
3233
|
-
...dateTime,
|
|
3234
|
-
dateStatus: EnumEventDateStatus7.INVALID
|
|
3235
|
-
};
|
|
3236
|
-
}
|
|
3237
|
-
let dateStatus;
|
|
3238
|
-
if (endDateTime.isAfter(now)) {
|
|
3239
|
-
if (startDateTime.isAfter(now)) {
|
|
3240
|
-
dateStatus = getFutureEventStatus(startDateTime, now);
|
|
3241
|
-
} else {
|
|
3242
|
-
dateStatus = EnumEventDateStatus7.STARTED;
|
|
3243
|
-
}
|
|
3244
|
-
} else {
|
|
3245
|
-
dateStatus = EnumEventDateStatus7.ENDED;
|
|
3246
|
-
}
|
|
3247
|
-
return {
|
|
3248
|
-
...dateTime,
|
|
3249
|
-
dateStatus
|
|
3250
|
-
};
|
|
3251
|
-
}
|
|
3252
3238
|
var dateTimeStatusFilter = {
|
|
3253
3239
|
dateTime: { $ne: [], $type: "array" },
|
|
3254
3240
|
deletedAt: null
|
|
@@ -3427,6 +3413,9 @@ async function updateAllEventDateTimeStatuses() {
|
|
|
3427
3413
|
}
|
|
3428
3414
|
}
|
|
3429
3415
|
|
|
3416
|
+
// src/service/index.ts
|
|
3417
|
+
import { updateSingleDateTimeStatus as updateSingleDateTimeStatus2 } from "@timardex/cluemart-shared";
|
|
3418
|
+
|
|
3430
3419
|
// src/service/event/findEventOrImportedMarketById.ts
|
|
3431
3420
|
async function findEventOrImportedMarketById(resourceId) {
|
|
3432
3421
|
if (!resourceId) {
|
|
@@ -3715,7 +3704,7 @@ import dayjs4 from "dayjs";
|
|
|
3715
3704
|
|
|
3716
3705
|
// src/service/license/models.ts
|
|
3717
3706
|
import {
|
|
3718
|
-
EnumResourceType as
|
|
3707
|
+
EnumResourceType as EnumResourceType10,
|
|
3719
3708
|
EnumUserLicence as EnumUserLicence8,
|
|
3720
3709
|
isNonVisitorResourceType,
|
|
3721
3710
|
LicenceExpiryDate
|
|
@@ -3911,11 +3900,11 @@ async function checkOwnerHasLicence({
|
|
|
3911
3900
|
const owner = await UserModel.findById(userId);
|
|
3912
3901
|
if (!owner) throw new GraphQLError("Owner not found");
|
|
3913
3902
|
const categoryByResource = {
|
|
3914
|
-
[
|
|
3915
|
-
[
|
|
3916
|
-
[
|
|
3917
|
-
[
|
|
3918
|
-
[
|
|
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 */
|
|
3919
3908
|
};
|
|
3920
3909
|
if (!isNonVisitorResourceType(resourceType)) {
|
|
3921
3910
|
throw new GraphQLError(`Invalid resource type: ${resourceType}.`);
|
|
@@ -4318,7 +4307,7 @@ var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
|
4318
4307
|
|
|
4319
4308
|
// src/service/license/reminder/utils.ts
|
|
4320
4309
|
import {
|
|
4321
|
-
dateFormat
|
|
4310
|
+
dateFormat,
|
|
4322
4311
|
EnumNotificationResourceType as EnumNotificationResourceType6,
|
|
4323
4312
|
EnumNotificationType as EnumNotificationType5,
|
|
4324
4313
|
EnumUserLicence as EnumUserLicence11,
|
|
@@ -4463,7 +4452,7 @@ function getLicenceExpiryMode(licenceType) {
|
|
|
4463
4452
|
}
|
|
4464
4453
|
async function sendLicenseReminder(user, licence) {
|
|
4465
4454
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4466
|
-
const expiryDate = dayjs7(licence.expiryDate).format(
|
|
4455
|
+
const expiryDate = dayjs7(licence.expiryDate).format(dateFormat);
|
|
4467
4456
|
const userId = String(user._id);
|
|
4468
4457
|
const resourceInfo = await getLicenseResourceInfo(user, licence);
|
|
4469
4458
|
if (!resourceInfo) {
|
|
@@ -4611,6 +4600,8 @@ export {
|
|
|
4611
4600
|
EventModel,
|
|
4612
4601
|
GameModel,
|
|
4613
4602
|
GoogleImportedMarketModel,
|
|
4603
|
+
ImpersonationAuditModel,
|
|
4604
|
+
ImpersonationSessionModel,
|
|
4614
4605
|
LicenceCategory,
|
|
4615
4606
|
NotificationModel,
|
|
4616
4607
|
OwnerTypeSchema,
|
|
@@ -4673,7 +4664,7 @@ export {
|
|
|
4673
4664
|
locationGeoSchema,
|
|
4674
4665
|
locationsSchema,
|
|
4675
4666
|
mapVendorLicenceToSubscriptionRewardType,
|
|
4676
|
-
|
|
4667
|
+
mongoose35 as mongoose,
|
|
4677
4668
|
normalizeAffiliatePromoCodes,
|
|
4678
4669
|
normalizePromoCode,
|
|
4679
4670
|
notifyUsers,
|
|
@@ -4702,7 +4693,7 @@ export {
|
|
|
4702
4693
|
updateAdStatuses,
|
|
4703
4694
|
updateAllEventDateTimeStatuses,
|
|
4704
4695
|
updateRelationDatesToUnavailable,
|
|
4705
|
-
updateSingleDateTimeStatus,
|
|
4696
|
+
updateSingleDateTimeStatus2 as updateSingleDateTimeStatus,
|
|
4706
4697
|
upgradeUserToLicence,
|
|
4707
4698
|
userLicenseSchema,
|
|
4708
4699
|
vendorOwnerHasProLicence,
|