@timardex/cluemart-server-shared 1.0.284 → 1.0.289
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4FWW5CDC.mjs → chunk-KRG2CATM.mjs} +64 -32
- package/dist/chunk-KRG2CATM.mjs.map +1 -0
- package/dist/index.cjs +360 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.mjs +351 -116
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +61 -31
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +358 -120
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +40 -2
- package/dist/service/index.d.ts +40 -2
- package/dist/service/index.mjs +285 -78
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-4FWW5CDC.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -754,6 +754,31 @@ declare const AffiliateModel: mongoose__default.Model<AffiliateDocument, {}, {},
|
|
|
754
754
|
*/
|
|
755
755
|
declare function activeAffiliateCodeExists(affiliateCode: string): Promise<boolean>;
|
|
756
756
|
|
|
757
|
+
type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
758
|
+
awarded: number;
|
|
759
|
+
skipped: number;
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Awards monthly vendor subscription rewards to affiliates with active referred vendors.
|
|
763
|
+
*
|
|
764
|
+
* Eligibility per affiliate resource:
|
|
765
|
+
* - Affiliate is not soft-deleted
|
|
766
|
+
* - Linked `affiliateResources` entry is vendor, `resourceActive`, and not deleted
|
|
767
|
+
* - Vendor is active, not deleted, and `promoCodes` includes the affiliate code
|
|
768
|
+
* - Vendor owner has a non-expired Standard / Pro / Pro+ vendor licence
|
|
769
|
+
*
|
|
770
|
+
* Reward type follows the owner's highest valid licence:
|
|
771
|
+
* - Pro / Pro+ → `ACTIVE_VENDOR_PRO_SUBSCRIPTION` (3 pts)
|
|
772
|
+
* - Standard → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
|
|
773
|
+
*
|
|
774
|
+
* Idempotent per affiliate + vendor + reward type + calendar month.
|
|
775
|
+
* On successful award, notifies the affiliate owner (best-effort).
|
|
776
|
+
*
|
|
777
|
+
* @param now - Reference time for month bounds and licence expiry (defaults to now).
|
|
778
|
+
* @returns Counts of awarded and skipped candidates.
|
|
779
|
+
*/
|
|
780
|
+
declare function awardAffiliateVendorSubscriptionRewards(now?: Date): Promise<AwardAffiliateVendorSubscriptionRewardsResult>;
|
|
781
|
+
|
|
757
782
|
declare const AFFILIATE_REWARDS: {
|
|
758
783
|
NEW_EVENT_REGISTRATION: {
|
|
759
784
|
description: string;
|
|
@@ -820,6 +845,19 @@ declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mo
|
|
|
820
845
|
*/
|
|
821
846
|
declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null | undefined): PromoCodeType[];
|
|
822
847
|
|
|
848
|
+
/**
|
|
849
|
+
* Maps a vendor owner's highest valid vendor licence to a monthly subscription reward.
|
|
850
|
+
*
|
|
851
|
+
* Prefer Pro / Pro+ over Standard when both are valid.
|
|
852
|
+
* Returns `null` when no non-expired vendor licence applies.
|
|
853
|
+
*/
|
|
854
|
+
declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date): EnumAffiliateRewardType | null;
|
|
855
|
+
/** Inclusive start / exclusive end of the UTC calendar month containing `now`. */
|
|
856
|
+
declare function getSubscriptionRewardPeriodBounds(now?: Date): {
|
|
857
|
+
periodEnd: Date;
|
|
858
|
+
periodStart: Date;
|
|
859
|
+
};
|
|
860
|
+
|
|
823
861
|
/**
|
|
824
862
|
* Connect to MongoDB using Mongoose.
|
|
825
863
|
* Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).
|
|
@@ -895,4 +933,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
895
933
|
*/
|
|
896
934
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
897
935
|
|
|
898
|
-
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, normalizeAffiliatePromoCodes, normalizePromoCode, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
936
|
+
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, awardAffiliateVendorSubscriptionRewards, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -754,6 +754,31 @@ declare const AffiliateModel: mongoose__default.Model<AffiliateDocument, {}, {},
|
|
|
754
754
|
*/
|
|
755
755
|
declare function activeAffiliateCodeExists(affiliateCode: string): Promise<boolean>;
|
|
756
756
|
|
|
757
|
+
type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
758
|
+
awarded: number;
|
|
759
|
+
skipped: number;
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Awards monthly vendor subscription rewards to affiliates with active referred vendors.
|
|
763
|
+
*
|
|
764
|
+
* Eligibility per affiliate resource:
|
|
765
|
+
* - Affiliate is not soft-deleted
|
|
766
|
+
* - Linked `affiliateResources` entry is vendor, `resourceActive`, and not deleted
|
|
767
|
+
* - Vendor is active, not deleted, and `promoCodes` includes the affiliate code
|
|
768
|
+
* - Vendor owner has a non-expired Standard / Pro / Pro+ vendor licence
|
|
769
|
+
*
|
|
770
|
+
* Reward type follows the owner's highest valid licence:
|
|
771
|
+
* - Pro / Pro+ → `ACTIVE_VENDOR_PRO_SUBSCRIPTION` (3 pts)
|
|
772
|
+
* - Standard → `ACTIVE_VENDOR_STANDARD_SUBSCRIPTION` (1 pt)
|
|
773
|
+
*
|
|
774
|
+
* Idempotent per affiliate + vendor + reward type + calendar month.
|
|
775
|
+
* On successful award, notifies the affiliate owner (best-effort).
|
|
776
|
+
*
|
|
777
|
+
* @param now - Reference time for month bounds and licence expiry (defaults to now).
|
|
778
|
+
* @returns Counts of awarded and skipped candidates.
|
|
779
|
+
*/
|
|
780
|
+
declare function awardAffiliateVendorSubscriptionRewards(now?: Date): Promise<AwardAffiliateVendorSubscriptionRewardsResult>;
|
|
781
|
+
|
|
757
782
|
declare const AFFILIATE_REWARDS: {
|
|
758
783
|
NEW_EVENT_REGISTRATION: {
|
|
759
784
|
description: string;
|
|
@@ -820,6 +845,19 @@ declare function findAffiliateByPromoCode(promoCode: PromoCodeType): Promise<(mo
|
|
|
820
845
|
*/
|
|
821
846
|
declare function normalizeAffiliatePromoCodes(promoCodes: PromoCodeType[] | null | undefined): PromoCodeType[];
|
|
822
847
|
|
|
848
|
+
/**
|
|
849
|
+
* Maps a vendor owner's highest valid vendor licence to a monthly subscription reward.
|
|
850
|
+
*
|
|
851
|
+
* Prefer Pro / Pro+ over Standard when both are valid.
|
|
852
|
+
* Returns `null` when no non-expired vendor licence applies.
|
|
853
|
+
*/
|
|
854
|
+
declare function mapVendorLicenceToSubscriptionRewardType(licences: UserLicenceType[] | null | undefined, now?: Date): EnumAffiliateRewardType | null;
|
|
855
|
+
/** Inclusive start / exclusive end of the UTC calendar month containing `now`. */
|
|
856
|
+
declare function getSubscriptionRewardPeriodBounds(now?: Date): {
|
|
857
|
+
periodEnd: Date;
|
|
858
|
+
periodStart: Date;
|
|
859
|
+
};
|
|
860
|
+
|
|
823
861
|
/**
|
|
824
862
|
* Connect to MongoDB using Mongoose.
|
|
825
863
|
* Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).
|
|
@@ -895,4 +933,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
895
933
|
*/
|
|
896
934
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
897
935
|
|
|
898
|
-
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, normalizeAffiliatePromoCodes, normalizePromoCode, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
936
|
+
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, awardAffiliateVendorSubscriptionRewards, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -3608,14 +3608,14 @@ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
|
|
|
3608
3608
|
EnumGameType2["ODD_ONE_OUT"] = "oddOneOut";
|
|
3609
3609
|
return EnumGameType2;
|
|
3610
3610
|
})(EnumGameType || {});
|
|
3611
|
-
var EnumAffiliateRewardType = /* @__PURE__ */ ((
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
return
|
|
3611
|
+
var EnumAffiliateRewardType = /* @__PURE__ */ ((EnumAffiliateRewardType22) => {
|
|
3612
|
+
EnumAffiliateRewardType22["ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS"] = "ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS";
|
|
3613
|
+
EnumAffiliateRewardType22["ACTIVE_VENDOR_BONUS_REWARD"] = "ACTIVE_VENDOR_BONUS_REWARD";
|
|
3614
|
+
EnumAffiliateRewardType22["ACTIVE_VENDOR_PRO_SUBSCRIPTION"] = "ACTIVE_VENDOR_PRO_SUBSCRIPTION";
|
|
3615
|
+
EnumAffiliateRewardType22["ACTIVE_VENDOR_STANDARD_SUBSCRIPTION"] = "ACTIVE_VENDOR_STANDARD_SUBSCRIPTION";
|
|
3616
|
+
EnumAffiliateRewardType22["NEW_EVENT_REGISTRATION"] = "NEW_EVENT_REGISTRATION";
|
|
3617
|
+
EnumAffiliateRewardType22["NEW_VENDOR_REGISTRATION"] = "NEW_VENDOR_REGISTRATION";
|
|
3618
|
+
return EnumAffiliateRewardType22;
|
|
3619
3619
|
})(EnumAffiliateRewardType || {});
|
|
3620
3620
|
var statusOptions = [
|
|
3621
3621
|
...Object.values(EnumInviteStatus).map((status) => ({
|
|
@@ -4654,29 +4654,6 @@ var tagOptions = availableTagTypes.map((tag) => ({
|
|
|
4654
4654
|
label: tag.label,
|
|
4655
4655
|
value: tag.label
|
|
4656
4656
|
}));
|
|
4657
|
-
var stallTypes = [
|
|
4658
|
-
"1.8m table only",
|
|
4659
|
-
"2x2m mini stall",
|
|
4660
|
-
"3x3m tent site",
|
|
4661
|
-
"Corner stall",
|
|
4662
|
-
"Craft stall with power",
|
|
4663
|
-
"Craft stall without power",
|
|
4664
|
-
"Double stall (6x3m)",
|
|
4665
|
-
"Food truck site",
|
|
4666
|
-
"Food vendor with power",
|
|
4667
|
-
"Food vendor without power",
|
|
4668
|
-
"Inside hall stall",
|
|
4669
|
-
"Non-profit/community stall",
|
|
4670
|
-
"Outdoor open area",
|
|
4671
|
-
"Shared table space",
|
|
4672
|
-
"Wall-based vendor",
|
|
4673
|
-
"Workshop/seating area"
|
|
4674
|
-
];
|
|
4675
|
-
var stallTypeOptions = stallTypes.map((type) => ({
|
|
4676
|
-
label: type,
|
|
4677
|
-
price: 0,
|
|
4678
|
-
stallCapacity: 0
|
|
4679
|
-
}));
|
|
4680
4657
|
var emailField = {
|
|
4681
4658
|
helperText: "Enter email address",
|
|
4682
4659
|
keyboardType: "email-address",
|
|
@@ -4701,6 +4678,51 @@ var companyContactFields = [
|
|
|
4701
4678
|
placeholder: "Landline Phone Number"
|
|
4702
4679
|
}
|
|
4703
4680
|
];
|
|
4681
|
+
var bankAccountDetailsFields = [
|
|
4682
|
+
{
|
|
4683
|
+
helperText: "Account holder name *",
|
|
4684
|
+
name: "accountHolderName",
|
|
4685
|
+
placeholder: "Account holder name"
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
helperText: "Account number *",
|
|
4689
|
+
keyboardType: "number-pad",
|
|
4690
|
+
name: "accountNumber",
|
|
4691
|
+
placeholder: "Account number"
|
|
4692
|
+
}
|
|
4693
|
+
];
|
|
4694
|
+
var eventInfoPaymentInfo = [
|
|
4695
|
+
...bankAccountDetailsFields,
|
|
4696
|
+
{
|
|
4697
|
+
helperText: "Payment link, where applicants can pay *",
|
|
4698
|
+
keyboardType: "url",
|
|
4699
|
+
name: "link",
|
|
4700
|
+
placeholder: "Payment link"
|
|
4701
|
+
}
|
|
4702
|
+
];
|
|
4703
|
+
var stallTypes = [
|
|
4704
|
+
"1.8m table only",
|
|
4705
|
+
"2x2m mini stall",
|
|
4706
|
+
"3x3m tent site",
|
|
4707
|
+
"Corner stall",
|
|
4708
|
+
"Craft stall with power",
|
|
4709
|
+
"Craft stall without power",
|
|
4710
|
+
"Double stall (6x3m)",
|
|
4711
|
+
"Food truck site",
|
|
4712
|
+
"Food vendor with power",
|
|
4713
|
+
"Food vendor without power",
|
|
4714
|
+
"Inside hall stall",
|
|
4715
|
+
"Non-profit/community stall",
|
|
4716
|
+
"Outdoor open area",
|
|
4717
|
+
"Shared table space",
|
|
4718
|
+
"Wall-based vendor",
|
|
4719
|
+
"Workshop/seating area"
|
|
4720
|
+
];
|
|
4721
|
+
var stallTypeOptions = stallTypes.map((type) => ({
|
|
4722
|
+
label: type,
|
|
4723
|
+
price: 0,
|
|
4724
|
+
stallCapacity: 0
|
|
4725
|
+
}));
|
|
4704
4726
|
var loginFields = [
|
|
4705
4727
|
{
|
|
4706
4728
|
...emailField,
|
|
@@ -7472,8 +7494,10 @@ var AFFILIATE_FIELDS_FRAGMENT = gql`
|
|
|
7472
7494
|
}
|
|
7473
7495
|
createdAt
|
|
7474
7496
|
deletedAt
|
|
7475
|
-
|
|
7476
|
-
|
|
7497
|
+
redeemHistory {
|
|
7498
|
+
redeemedAt
|
|
7499
|
+
rewardValue
|
|
7500
|
+
}
|
|
7477
7501
|
overallPoints
|
|
7478
7502
|
owner {
|
|
7479
7503
|
...OwnerFields
|
|
@@ -9259,6 +9283,13 @@ var affiliateDetailsSchema = new MongooseSchema25(
|
|
|
9259
9283
|
},
|
|
9260
9284
|
{ _id: false }
|
|
9261
9285
|
);
|
|
9286
|
+
var redeemHistorySchema = new MongooseSchema25(
|
|
9287
|
+
{
|
|
9288
|
+
redeemedAt: { required: true, type: Date },
|
|
9289
|
+
rewardValue: { required: true, type: Number }
|
|
9290
|
+
},
|
|
9291
|
+
{ _id: false }
|
|
9292
|
+
);
|
|
9262
9293
|
var schema17 = new MongooseSchema25(
|
|
9263
9294
|
{
|
|
9264
9295
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -9275,16 +9306,15 @@ var schema17 = new MongooseSchema25(
|
|
|
9275
9306
|
type: [affiliateResourceSchema]
|
|
9276
9307
|
},
|
|
9277
9308
|
deletedAt: { default: null, required: false, type: Date },
|
|
9278
|
-
lastRewardRedemptionAt: { default: null, required: false, type: Date },
|
|
9279
|
-
lastRewardRedemptionPoints: {
|
|
9280
|
-
default: null,
|
|
9281
|
-
required: false,
|
|
9282
|
-
type: Number
|
|
9283
|
-
},
|
|
9284
9309
|
overallPoints: { default: 0, required: true, type: Number },
|
|
9285
9310
|
owner: {
|
|
9286
9311
|
required: true,
|
|
9287
9312
|
type: OwnerTypeSchema
|
|
9313
|
+
},
|
|
9314
|
+
redeemHistory: {
|
|
9315
|
+
default: [],
|
|
9316
|
+
required: false,
|
|
9317
|
+
type: [redeemHistorySchema]
|
|
9288
9318
|
}
|
|
9289
9319
|
},
|
|
9290
9320
|
{ timestamps: true }
|
|
@@ -9313,89 +9343,12 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
9313
9343
|
return existing !== null;
|
|
9314
9344
|
}
|
|
9315
9345
|
|
|
9316
|
-
// src/service/affiliate/createAffiliateReward.ts
|
|
9317
|
-
var AFFILIATE_REWARDS = {
|
|
9318
|
-
[EnumAffiliateRewardType.NEW_EVENT_REGISTRATION]: {
|
|
9319
|
-
description: "10 points for new event registration (one-time reward)",
|
|
9320
|
-
value: 10
|
|
9321
|
-
},
|
|
9322
|
-
[EnumAffiliateRewardType.NEW_VENDOR_REGISTRATION]: {
|
|
9323
|
-
description: "5 points for new vendor registration (one-time reward)",
|
|
9324
|
-
value: 5
|
|
9325
|
-
},
|
|
9326
|
-
[EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION]: {
|
|
9327
|
-
description: "3 points for active vendor pro subscription (monthly reward)",
|
|
9328
|
-
value: 3
|
|
9329
|
-
},
|
|
9330
|
-
[EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION]: {
|
|
9331
|
-
description: "1 point for active vendor standard subscription (monthly reward)",
|
|
9332
|
-
value: 1
|
|
9333
|
-
},
|
|
9334
|
-
[EnumAffiliateRewardType.ACTIVE_VENDOR_BONUS_REWARD]: {
|
|
9335
|
-
description: "5 bonus points for every 10th active vendor (one-time reward)",
|
|
9336
|
-
value: 5
|
|
9337
|
-
},
|
|
9338
|
-
[EnumAffiliateRewardType.ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS]: {
|
|
9339
|
-
description: "50 points for active event with vendor registrations (one-time reward)",
|
|
9340
|
-
value: 50
|
|
9341
|
-
}
|
|
9342
|
-
};
|
|
9343
|
-
function createAffiliateReward(rewardType, createdAt) {
|
|
9344
|
-
const reward = AFFILIATE_REWARDS[rewardType];
|
|
9345
|
-
return {
|
|
9346
|
-
createdAt,
|
|
9347
|
-
redeemedAt: null,
|
|
9348
|
-
rewardDescription: reward.description,
|
|
9349
|
-
rewardType,
|
|
9350
|
-
rewardValue: reward.value
|
|
9351
|
-
};
|
|
9352
|
-
}
|
|
9353
|
-
|
|
9354
|
-
// src/service/affiliate/findAffiliateByPromoCode.ts
|
|
9355
|
-
async function findAffiliateByPromoCode(promoCode) {
|
|
9356
|
-
return AffiliateModel.findOne({
|
|
9357
|
-
affiliateCode: promoCode,
|
|
9358
|
-
deletedAt: null
|
|
9359
|
-
}).exec();
|
|
9360
|
-
}
|
|
9361
|
-
|
|
9362
9346
|
// src/service/promoCode/normalizePromoCode.ts
|
|
9363
9347
|
function normalizePromoCode(decoratedPromoCode) {
|
|
9364
9348
|
const normalized = decoratedPromoCode?.trim().toUpperCase();
|
|
9365
9349
|
return normalized || null;
|
|
9366
9350
|
}
|
|
9367
9351
|
|
|
9368
|
-
// src/service/affiliate/normalizeAffiliatePromoCodes.ts
|
|
9369
|
-
function normalizeAffiliatePromoCodes(promoCodes) {
|
|
9370
|
-
const normalized = (promoCodes ?? []).map((code) => normalizePromoCode(code)).filter((code) => code !== null);
|
|
9371
|
-
return [...new Set(normalized)];
|
|
9372
|
-
}
|
|
9373
|
-
|
|
9374
|
-
// src/service/database.ts
|
|
9375
|
-
import mongoose26 from "mongoose";
|
|
9376
|
-
var connectToDatabase = async ({
|
|
9377
|
-
appName,
|
|
9378
|
-
dbName,
|
|
9379
|
-
dbPassword,
|
|
9380
|
-
dbUser,
|
|
9381
|
-
mongodbUri
|
|
9382
|
-
}) => {
|
|
9383
|
-
try {
|
|
9384
|
-
const mongoUri = mongodbUri ? mongodbUri : (
|
|
9385
|
-
// Fallback to MongoDB Atlas connection string
|
|
9386
|
-
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
9387
|
-
);
|
|
9388
|
-
await mongoose26.connect(mongoUri);
|
|
9389
|
-
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
9390
|
-
console.log(
|
|
9391
|
-
`${connectionType} connected from server/src/service/database.ts`
|
|
9392
|
-
);
|
|
9393
|
-
} catch (err) {
|
|
9394
|
-
console.error("Error connecting to MongoDB:", err);
|
|
9395
|
-
throw err;
|
|
9396
|
-
}
|
|
9397
|
-
};
|
|
9398
|
-
|
|
9399
9352
|
// src/service/saveNotificationsInDb.ts
|
|
9400
9353
|
async function saveNotificationsInDb(payload) {
|
|
9401
9354
|
const { data, message, title, type, userIds } = payload;
|
|
@@ -9529,6 +9482,285 @@ async function sendPushNotifications({
|
|
|
9529
9482
|
}
|
|
9530
9483
|
}
|
|
9531
9484
|
|
|
9485
|
+
// src/service/affiliate/createAffiliateReward.ts
|
|
9486
|
+
var AFFILIATE_REWARDS = {
|
|
9487
|
+
[EnumAffiliateRewardType.NEW_EVENT_REGISTRATION]: {
|
|
9488
|
+
description: "10 points for new event registration (one-time reward)",
|
|
9489
|
+
value: 10
|
|
9490
|
+
},
|
|
9491
|
+
[EnumAffiliateRewardType.NEW_VENDOR_REGISTRATION]: {
|
|
9492
|
+
description: "5 points for new vendor registration (one-time reward)",
|
|
9493
|
+
value: 5
|
|
9494
|
+
},
|
|
9495
|
+
[EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION]: {
|
|
9496
|
+
description: "3 points for active vendor pro subscription (monthly reward)",
|
|
9497
|
+
value: 3
|
|
9498
|
+
},
|
|
9499
|
+
[EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION]: {
|
|
9500
|
+
description: "1 point for active vendor standard subscription (monthly reward)",
|
|
9501
|
+
value: 1
|
|
9502
|
+
},
|
|
9503
|
+
[EnumAffiliateRewardType.ACTIVE_VENDOR_BONUS_REWARD]: {
|
|
9504
|
+
description: "5 bonus points for every 10th active vendor (one-time reward)",
|
|
9505
|
+
value: 5
|
|
9506
|
+
},
|
|
9507
|
+
[EnumAffiliateRewardType.ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS]: {
|
|
9508
|
+
description: "50 points for active event with vendor registrations (one-time reward)",
|
|
9509
|
+
value: 50
|
|
9510
|
+
}
|
|
9511
|
+
};
|
|
9512
|
+
function createAffiliateReward(rewardType, createdAt) {
|
|
9513
|
+
const reward = AFFILIATE_REWARDS[rewardType];
|
|
9514
|
+
return {
|
|
9515
|
+
createdAt,
|
|
9516
|
+
redeemedAt: null,
|
|
9517
|
+
rewardDescription: reward.description,
|
|
9518
|
+
rewardType,
|
|
9519
|
+
rewardValue: reward.value
|
|
9520
|
+
};
|
|
9521
|
+
}
|
|
9522
|
+
|
|
9523
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
9524
|
+
function mapVendorLicenceToSubscriptionRewardType(licences, now = /* @__PURE__ */ new Date()) {
|
|
9525
|
+
const validTypes = new Set(
|
|
9526
|
+
(licences ?? []).filter(
|
|
9527
|
+
(licence) => new Date(licence.expiryDate).getTime() > now.getTime()
|
|
9528
|
+
).map((licence) => licence.licenceType)
|
|
9529
|
+
);
|
|
9530
|
+
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
9531
|
+
return EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
|
|
9532
|
+
}
|
|
9533
|
+
if (validTypes.has(EnumUserLicence.STANDARD_VENDOR)) {
|
|
9534
|
+
return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
9535
|
+
}
|
|
9536
|
+
return null;
|
|
9537
|
+
}
|
|
9538
|
+
function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
9539
|
+
const periodStart = new Date(
|
|
9540
|
+
Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)
|
|
9541
|
+
);
|
|
9542
|
+
const periodEnd = new Date(
|
|
9543
|
+
Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1)
|
|
9544
|
+
);
|
|
9545
|
+
return { periodEnd, periodStart };
|
|
9546
|
+
}
|
|
9547
|
+
|
|
9548
|
+
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
9549
|
+
function isEligibleVendorResource(resource) {
|
|
9550
|
+
return resource.resourceType === EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
9551
|
+
}
|
|
9552
|
+
async function findAffiliatesWithActiveVendorReferrals() {
|
|
9553
|
+
return await AffiliateModel.find({
|
|
9554
|
+
affiliateResources: {
|
|
9555
|
+
$elemMatch: {
|
|
9556
|
+
resourceActive: true,
|
|
9557
|
+
resourceDeletedAt: null,
|
|
9558
|
+
resourceType: EnumResourceType.VENDOR
|
|
9559
|
+
}
|
|
9560
|
+
},
|
|
9561
|
+
deletedAt: null
|
|
9562
|
+
}).select("_id affiliateCode affiliateResources owner").lean().exec();
|
|
9563
|
+
}
|
|
9564
|
+
async function findEligibleReferredVendor(resourceId, affiliateCode) {
|
|
9565
|
+
return await VendorModel.findOne({
|
|
9566
|
+
_id: resourceId,
|
|
9567
|
+
active: true,
|
|
9568
|
+
deletedAt: null,
|
|
9569
|
+
promoCodes: affiliateCode
|
|
9570
|
+
}).select("_id name owner.userId").lean().exec();
|
|
9571
|
+
}
|
|
9572
|
+
async function resolveSubscriptionRewardTypeForVendorOwner(vendorOwnerUserId, now) {
|
|
9573
|
+
const vendorOwner = await UserModel.findById(vendorOwnerUserId).select("licences").lean().exec();
|
|
9574
|
+
return mapVendorLicenceToSubscriptionRewardType(vendorOwner?.licences, now);
|
|
9575
|
+
}
|
|
9576
|
+
async function notifyAffiliateOwnerOfSubscriptionReward({
|
|
9577
|
+
affiliateId,
|
|
9578
|
+
affiliateOwnerUserId,
|
|
9579
|
+
resourceName,
|
|
9580
|
+
rewardValue
|
|
9581
|
+
}) {
|
|
9582
|
+
const payload = {
|
|
9583
|
+
data: {
|
|
9584
|
+
resourceId: String(affiliateId),
|
|
9585
|
+
resourceName,
|
|
9586
|
+
resourceType: EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
|
|
9587
|
+
},
|
|
9588
|
+
message: `You earned ${rewardValue} points! Your referred vendor "${resourceName}" has an active subscription.`,
|
|
9589
|
+
title: "Affiliate points earned",
|
|
9590
|
+
type: EnumNotificationType.SYSTEM,
|
|
9591
|
+
userIds: [affiliateOwnerUserId]
|
|
9592
|
+
};
|
|
9593
|
+
try {
|
|
9594
|
+
await saveNotificationsInDb(payload);
|
|
9595
|
+
await sendPushNotifications(payload);
|
|
9596
|
+
} catch (error) {
|
|
9597
|
+
console.error(
|
|
9598
|
+
`[affiliate] subscription reward notification failed for affiliate ${String(affiliateId)}:`,
|
|
9599
|
+
error instanceof Error ? error.message : error
|
|
9600
|
+
);
|
|
9601
|
+
}
|
|
9602
|
+
}
|
|
9603
|
+
async function tryAwardSubscriptionReward({
|
|
9604
|
+
affiliate,
|
|
9605
|
+
createdAt,
|
|
9606
|
+
period,
|
|
9607
|
+
resource,
|
|
9608
|
+
rewardType,
|
|
9609
|
+
vendor
|
|
9610
|
+
}) {
|
|
9611
|
+
const reward = createAffiliateReward(rewardType, createdAt);
|
|
9612
|
+
const updateResult = await AffiliateModel.updateOne(
|
|
9613
|
+
{
|
|
9614
|
+
_id: affiliate._id,
|
|
9615
|
+
affiliateResources: {
|
|
9616
|
+
$elemMatch: {
|
|
9617
|
+
resourceActive: true,
|
|
9618
|
+
resourceDeletedAt: null,
|
|
9619
|
+
resourceId: vendor._id,
|
|
9620
|
+
resourceType: EnumResourceType.VENDOR,
|
|
9621
|
+
rewards: {
|
|
9622
|
+
$not: {
|
|
9623
|
+
$elemMatch: {
|
|
9624
|
+
createdAt: {
|
|
9625
|
+
$gte: period.periodStart,
|
|
9626
|
+
$lt: period.periodEnd
|
|
9627
|
+
},
|
|
9628
|
+
rewardType
|
|
9629
|
+
}
|
|
9630
|
+
}
|
|
9631
|
+
}
|
|
9632
|
+
}
|
|
9633
|
+
},
|
|
9634
|
+
deletedAt: null
|
|
9635
|
+
},
|
|
9636
|
+
{
|
|
9637
|
+
$inc: { overallPoints: reward.rewardValue },
|
|
9638
|
+
$push: { "affiliateResources.$.rewards": reward }
|
|
9639
|
+
}
|
|
9640
|
+
).exec();
|
|
9641
|
+
if (updateResult.modifiedCount === 0) {
|
|
9642
|
+
return "skipped";
|
|
9643
|
+
}
|
|
9644
|
+
const affiliateOwnerUserId = affiliate.owner?.userId;
|
|
9645
|
+
if (affiliateOwnerUserId) {
|
|
9646
|
+
await notifyAffiliateOwnerOfSubscriptionReward({
|
|
9647
|
+
affiliateId: affiliate._id,
|
|
9648
|
+
affiliateOwnerUserId,
|
|
9649
|
+
resourceName: resource.resourceName || vendor.name || "vendor",
|
|
9650
|
+
rewardValue: reward.rewardValue
|
|
9651
|
+
});
|
|
9652
|
+
}
|
|
9653
|
+
return "awarded";
|
|
9654
|
+
}
|
|
9655
|
+
async function processAffiliateVendorReferral({
|
|
9656
|
+
affiliate,
|
|
9657
|
+
affiliateCode,
|
|
9658
|
+
createdAt,
|
|
9659
|
+
now,
|
|
9660
|
+
period,
|
|
9661
|
+
resource
|
|
9662
|
+
}) {
|
|
9663
|
+
const vendor = await findEligibleReferredVendor(
|
|
9664
|
+
resource.resourceId,
|
|
9665
|
+
affiliateCode
|
|
9666
|
+
);
|
|
9667
|
+
if (!vendor?.owner?.userId) {
|
|
9668
|
+
return "skipped";
|
|
9669
|
+
}
|
|
9670
|
+
const rewardType = await resolveSubscriptionRewardTypeForVendorOwner(
|
|
9671
|
+
vendor.owner.userId,
|
|
9672
|
+
now
|
|
9673
|
+
);
|
|
9674
|
+
if (!rewardType) {
|
|
9675
|
+
return "skipped";
|
|
9676
|
+
}
|
|
9677
|
+
return tryAwardSubscriptionReward({
|
|
9678
|
+
affiliate,
|
|
9679
|
+
createdAt,
|
|
9680
|
+
period,
|
|
9681
|
+
resource,
|
|
9682
|
+
rewardType,
|
|
9683
|
+
vendor
|
|
9684
|
+
});
|
|
9685
|
+
}
|
|
9686
|
+
async function awardAffiliateVendorSubscriptionRewards(now = /* @__PURE__ */ new Date()) {
|
|
9687
|
+
const period = getSubscriptionRewardPeriodBounds(now);
|
|
9688
|
+
const createdAt = now;
|
|
9689
|
+
const affiliates = await findAffiliatesWithActiveVendorReferrals();
|
|
9690
|
+
let awarded = 0;
|
|
9691
|
+
let skipped = 0;
|
|
9692
|
+
const seenPairs = /* @__PURE__ */ new Set();
|
|
9693
|
+
for (const affiliate of affiliates) {
|
|
9694
|
+
const affiliateCode = normalizePromoCode(affiliate.affiliateCode);
|
|
9695
|
+
if (!affiliateCode) {
|
|
9696
|
+
continue;
|
|
9697
|
+
}
|
|
9698
|
+
for (const resource of affiliate.affiliateResources) {
|
|
9699
|
+
if (!isEligibleVendorResource(resource)) {
|
|
9700
|
+
continue;
|
|
9701
|
+
}
|
|
9702
|
+
const pairKey = `${String(affiliate._id)}:${String(resource.resourceId)}`;
|
|
9703
|
+
if (seenPairs.has(pairKey)) {
|
|
9704
|
+
continue;
|
|
9705
|
+
}
|
|
9706
|
+
seenPairs.add(pairKey);
|
|
9707
|
+
const outcome = await processAffiliateVendorReferral({
|
|
9708
|
+
affiliate,
|
|
9709
|
+
affiliateCode,
|
|
9710
|
+
createdAt,
|
|
9711
|
+
now,
|
|
9712
|
+
period,
|
|
9713
|
+
resource
|
|
9714
|
+
});
|
|
9715
|
+
if (outcome === "awarded") {
|
|
9716
|
+
awarded += 1;
|
|
9717
|
+
} else {
|
|
9718
|
+
skipped += 1;
|
|
9719
|
+
}
|
|
9720
|
+
}
|
|
9721
|
+
}
|
|
9722
|
+
return { awarded, skipped };
|
|
9723
|
+
}
|
|
9724
|
+
|
|
9725
|
+
// src/service/affiliate/findAffiliateByPromoCode.ts
|
|
9726
|
+
async function findAffiliateByPromoCode(promoCode) {
|
|
9727
|
+
return AffiliateModel.findOne({
|
|
9728
|
+
affiliateCode: promoCode,
|
|
9729
|
+
deletedAt: null
|
|
9730
|
+
}).exec();
|
|
9731
|
+
}
|
|
9732
|
+
|
|
9733
|
+
// src/service/affiliate/normalizeAffiliatePromoCodes.ts
|
|
9734
|
+
function normalizeAffiliatePromoCodes(promoCodes) {
|
|
9735
|
+
const normalized = (promoCodes ?? []).map((code) => normalizePromoCode(code)).filter((code) => code !== null);
|
|
9736
|
+
return [...new Set(normalized)];
|
|
9737
|
+
}
|
|
9738
|
+
|
|
9739
|
+
// src/service/database.ts
|
|
9740
|
+
import mongoose26 from "mongoose";
|
|
9741
|
+
var connectToDatabase = async ({
|
|
9742
|
+
appName,
|
|
9743
|
+
dbName,
|
|
9744
|
+
dbPassword,
|
|
9745
|
+
dbUser,
|
|
9746
|
+
mongodbUri
|
|
9747
|
+
}) => {
|
|
9748
|
+
try {
|
|
9749
|
+
const mongoUri = mongodbUri ? mongodbUri : (
|
|
9750
|
+
// Fallback to MongoDB Atlas connection string
|
|
9751
|
+
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
9752
|
+
);
|
|
9753
|
+
await mongoose26.connect(mongoUri);
|
|
9754
|
+
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
9755
|
+
console.log(
|
|
9756
|
+
`${connectionType} connected from server/src/service/database.ts`
|
|
9757
|
+
);
|
|
9758
|
+
} catch (err) {
|
|
9759
|
+
console.error("Error connecting to MongoDB:", err);
|
|
9760
|
+
throw err;
|
|
9761
|
+
}
|
|
9762
|
+
};
|
|
9763
|
+
|
|
9532
9764
|
// src/service/updateAdStatus.ts
|
|
9533
9765
|
async function updateAdStatuses() {
|
|
9534
9766
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -9951,6 +10183,7 @@ export {
|
|
|
9951
10183
|
VerificationTokenModel,
|
|
9952
10184
|
activeAffiliateCodeExists,
|
|
9953
10185
|
associatesSchema,
|
|
10186
|
+
awardAffiliateVendorSubscriptionRewards,
|
|
9954
10187
|
baseResourceFields,
|
|
9955
10188
|
connectToDatabase,
|
|
9956
10189
|
convertObjectIdsToStrings,
|
|
@@ -9960,8 +10193,10 @@ export {
|
|
|
9960
10193
|
express,
|
|
9961
10194
|
findAffiliateByPromoCode,
|
|
9962
10195
|
findEventOrImportedMarketById,
|
|
10196
|
+
getSubscriptionRewardPeriodBounds,
|
|
9963
10197
|
locationGeoSchema,
|
|
9964
10198
|
locationsSchema,
|
|
10199
|
+
mapVendorLicenceToSubscriptionRewardType,
|
|
9965
10200
|
mongoose29 as mongoose,
|
|
9966
10201
|
normalizeAffiliatePromoCodes,
|
|
9967
10202
|
normalizePromoCode,
|