@timardex/cluemart-server-shared 1.0.263 → 1.0.265
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-BDHZYR65.mjs → chunk-SHBCW7T5.mjs} +140 -29
- package/dist/chunk-SHBCW7T5.mjs.map +1 -0
- package/dist/index.cjs +147 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +23 -4
- package/dist/index.d.ts +23 -4
- package/dist/index.mjs +146 -35
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +139 -27
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +23 -4
- package/dist/mongoose/index.d.ts +23 -4
- package/dist/mongoose/index.mjs +3 -1
- package/dist/service/index.cjs +141 -31
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-BDHZYR65.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
2
|
-
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, EnumUserLicence, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
|
|
2
|
+
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, AffiliateReward, AffiliateResourceType, AffiliateType, EnumUserLicence, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
|
|
3
3
|
import mongoose from 'mongoose';
|
|
4
4
|
export { default as mongoose } from 'mongoose';
|
|
5
5
|
import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
|
|
@@ -512,8 +512,9 @@ declare const ResourceActivityModel: mongoose.Model<ResourceActivityType, {}, {}
|
|
|
512
512
|
type SchemaUserActivityEvent = Omit<UserActivityEvent, "resourceId"> & {
|
|
513
513
|
resourceId: ObjectId;
|
|
514
514
|
};
|
|
515
|
-
type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school"> & {
|
|
515
|
+
type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school" | "affiliate"> & {
|
|
516
516
|
_id: ObjectId;
|
|
517
|
+
affiliate: ObjectId;
|
|
517
518
|
events: ObjectId[];
|
|
518
519
|
game: ObjectId;
|
|
519
520
|
partner: ObjectId;
|
|
@@ -536,8 +537,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActi
|
|
|
536
537
|
};
|
|
537
538
|
};
|
|
538
539
|
};
|
|
539
|
-
declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school"> & {
|
|
540
|
+
declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school" | "affiliate"> & {
|
|
540
541
|
_id: ObjectId;
|
|
542
|
+
affiliate: ObjectId;
|
|
541
543
|
events: ObjectId[];
|
|
542
544
|
game: ObjectId;
|
|
543
545
|
partner: ObjectId;
|
|
@@ -723,6 +725,23 @@ declare const SchoolModel: mongoose.Model<SchoolDocument, {}, {}, {}, mongoose.D
|
|
|
723
725
|
__v: number;
|
|
724
726
|
}, any>;
|
|
725
727
|
|
|
728
|
+
type SchemaAffiliateReward = AffiliateReward;
|
|
729
|
+
type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceId"> & {
|
|
730
|
+
resourceId: ObjectId;
|
|
731
|
+
};
|
|
732
|
+
type AffiliateDocument = Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
|
|
733
|
+
affiliateResources: SchemaAffiliateResourceType[];
|
|
734
|
+
owner: SchemaOwnerType;
|
|
735
|
+
};
|
|
736
|
+
declare const AffiliateModel: mongoose.Model<AffiliateDocument, {}, {}, {}, mongoose.Document<unknown, {}, AffiliateDocument, {}, {}> & Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
|
|
737
|
+
affiliateResources: SchemaAffiliateResourceType[];
|
|
738
|
+
owner: SchemaOwnerType;
|
|
739
|
+
} & {
|
|
740
|
+
_id: mongoose.Types.ObjectId;
|
|
741
|
+
} & {
|
|
742
|
+
__v: number;
|
|
743
|
+
}, any>;
|
|
744
|
+
|
|
726
745
|
/**
|
|
727
746
|
* Connect to MongoDB using Mongoose.
|
|
728
747
|
* Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).
|
|
@@ -790,4 +809,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
790
809
|
*/
|
|
791
810
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
792
811
|
|
|
793
|
-
export { APP_SETTINGS_ID, AdModel, 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 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, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
812
|
+
export { 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, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
2
|
-
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, EnumUserLicence, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
|
|
2
|
+
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, AffiliateReward, AffiliateResourceType, AffiliateType, EnumUserLicence, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
|
|
3
3
|
import mongoose from 'mongoose';
|
|
4
4
|
export { default as mongoose } from 'mongoose';
|
|
5
5
|
import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
|
|
@@ -512,8 +512,9 @@ declare const ResourceActivityModel: mongoose.Model<ResourceActivityType, {}, {}
|
|
|
512
512
|
type SchemaUserActivityEvent = Omit<UserActivityEvent, "resourceId"> & {
|
|
513
513
|
resourceId: ObjectId;
|
|
514
514
|
};
|
|
515
|
-
type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school"> & {
|
|
515
|
+
type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school" | "affiliate"> & {
|
|
516
516
|
_id: ObjectId;
|
|
517
|
+
affiliate: ObjectId;
|
|
517
518
|
events: ObjectId[];
|
|
518
519
|
game: ObjectId;
|
|
519
520
|
partner: ObjectId;
|
|
@@ -536,8 +537,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActi
|
|
|
536
537
|
};
|
|
537
538
|
};
|
|
538
539
|
};
|
|
539
|
-
declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school"> & {
|
|
540
|
+
declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school" | "affiliate"> & {
|
|
540
541
|
_id: ObjectId;
|
|
542
|
+
affiliate: ObjectId;
|
|
541
543
|
events: ObjectId[];
|
|
542
544
|
game: ObjectId;
|
|
543
545
|
partner: ObjectId;
|
|
@@ -723,6 +725,23 @@ declare const SchoolModel: mongoose.Model<SchoolDocument, {}, {}, {}, mongoose.D
|
|
|
723
725
|
__v: number;
|
|
724
726
|
}, any>;
|
|
725
727
|
|
|
728
|
+
type SchemaAffiliateReward = AffiliateReward;
|
|
729
|
+
type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceId"> & {
|
|
730
|
+
resourceId: ObjectId;
|
|
731
|
+
};
|
|
732
|
+
type AffiliateDocument = Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
|
|
733
|
+
affiliateResources: SchemaAffiliateResourceType[];
|
|
734
|
+
owner: SchemaOwnerType;
|
|
735
|
+
};
|
|
736
|
+
declare const AffiliateModel: mongoose.Model<AffiliateDocument, {}, {}, {}, mongoose.Document<unknown, {}, AffiliateDocument, {}, {}> & Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
|
|
737
|
+
affiliateResources: SchemaAffiliateResourceType[];
|
|
738
|
+
owner: SchemaOwnerType;
|
|
739
|
+
} & {
|
|
740
|
+
_id: mongoose.Types.ObjectId;
|
|
741
|
+
} & {
|
|
742
|
+
__v: number;
|
|
743
|
+
}, any>;
|
|
744
|
+
|
|
726
745
|
/**
|
|
727
746
|
* Connect to MongoDB using Mongoose.
|
|
728
747
|
* Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).
|
|
@@ -790,4 +809,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
790
809
|
*/
|
|
791
810
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
792
811
|
|
|
793
|
-
export { APP_SETTINGS_ID, AdModel, 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 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, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
812
|
+
export { 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, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, didRemoveAnyEventDates, findEventOrImportedMarketById, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -3480,6 +3480,7 @@ var gameScreenIdentifierList = [
|
|
|
3480
3480
|
match: "/visitors"
|
|
3481
3481
|
}
|
|
3482
3482
|
];
|
|
3483
|
+
var PROMO_CODE_PREFIX = "CM-";
|
|
3483
3484
|
var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn2) => {
|
|
3484
3485
|
EnumAdShowOn2["EVENTS_PAGE"] = "Events_page";
|
|
3485
3486
|
EnumAdShowOn2["FRONT_PAGE"] = "Front_page";
|
|
@@ -3538,6 +3539,12 @@ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
|
|
|
3538
3539
|
EnumGameType2["ODD_ONE_OUT"] = "oddOneOut";
|
|
3539
3540
|
return EnumGameType2;
|
|
3540
3541
|
})(EnumGameType || {});
|
|
3542
|
+
var EnumAffiliateRewardType = /* @__PURE__ */ ((EnumAffiliateRewardType2) => {
|
|
3543
|
+
EnumAffiliateRewardType2["NEW_EVENT_REGISTRATION"] = "NEW_EVENT_REGISTRATION";
|
|
3544
|
+
EnumAffiliateRewardType2["NEW_VENDOR_REGISTRATION"] = "NEW_VENDOR_REGISTRATION";
|
|
3545
|
+
EnumAffiliateRewardType2["NEW_PARTNER_REGISTRATION"] = "NEW_PARTNER_REGISTRATION";
|
|
3546
|
+
return EnumAffiliateRewardType2;
|
|
3547
|
+
})(EnumAffiliateRewardType || {});
|
|
3541
3548
|
var mapArrayToOptions = (items) => items.map((item) => ({
|
|
3542
3549
|
label: item,
|
|
3543
3550
|
value: item
|
|
@@ -3555,6 +3562,8 @@ var paymentMethodOptions = mapArrayToOptions(
|
|
|
3555
3562
|
Object.values(EnumPaymentMethod)
|
|
3556
3563
|
);
|
|
3557
3564
|
var CLUEMART_MAIN_DOMAIN_URL = "https://cluemart.co.nz";
|
|
3565
|
+
var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
|
|
3566
|
+
var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
|
|
3558
3567
|
var dateFormat = "DD-MM-YYYY";
|
|
3559
3568
|
var timeFormat = "HH:mm";
|
|
3560
3569
|
dayjs.extend(customParseFormat);
|
|
@@ -4950,12 +4959,6 @@ var REDEEMED_REWARD_FIELDS_FRAGMENT = gql`
|
|
|
4950
4959
|
redeemedAt
|
|
4951
4960
|
}
|
|
4952
4961
|
`;
|
|
4953
|
-
var AFFILIATE_FIELDS_FRAGMENT = gql`
|
|
4954
|
-
fragment AffiliateFields on AffiliateType {
|
|
4955
|
-
affiliateCode
|
|
4956
|
-
pointsAvailable
|
|
4957
|
-
}
|
|
4958
|
-
`;
|
|
4959
4962
|
var USER_FIELDS_FRAGMENT = gql`
|
|
4960
4963
|
fragment UserFields on UserType {
|
|
4961
4964
|
_id
|
|
@@ -4963,9 +4966,7 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
4963
4966
|
associates {
|
|
4964
4967
|
...AssociatesFields
|
|
4965
4968
|
}
|
|
4966
|
-
affiliate
|
|
4967
|
-
...AffiliateFields
|
|
4968
|
-
}
|
|
4969
|
+
affiliate
|
|
4969
4970
|
avatar {
|
|
4970
4971
|
...ResourceImageFields
|
|
4971
4972
|
}
|
|
@@ -5009,7 +5010,6 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
5009
5010
|
${LICENCE_FIELDS_FRAGMENT}
|
|
5010
5011
|
${LOCATION_FIELDS_FRAGMENT}
|
|
5011
5012
|
${REDEEMED_REWARD_FIELDS_FRAGMENT}
|
|
5012
|
-
${AFFILIATE_FIELDS_FRAGMENT}
|
|
5013
5013
|
`;
|
|
5014
5014
|
var STALL_TYPE_FIELDS_FRAGMENT = gql`
|
|
5015
5015
|
fragment StallTypeFields on StallTypeType {
|
|
@@ -7355,6 +7355,63 @@ var REQUEST_MARKETING_MATERIAL_MUTATION = gql`
|
|
|
7355
7355
|
}
|
|
7356
7356
|
}
|
|
7357
7357
|
`;
|
|
7358
|
+
var AFFILIATE_REWARD_FIELDS_FRAGMENT = gql`
|
|
7359
|
+
fragment AffiliateRewardFields on AffiliateRewardType {
|
|
7360
|
+
createdAt
|
|
7361
|
+
deletedAt
|
|
7362
|
+
redeemedAt
|
|
7363
|
+
rewardDescription
|
|
7364
|
+
rewardType
|
|
7365
|
+
rewardValue
|
|
7366
|
+
updatedAt
|
|
7367
|
+
}
|
|
7368
|
+
`;
|
|
7369
|
+
var AFFILIATE_RESOURCE_FIELDS_FRAGMENT = gql`
|
|
7370
|
+
fragment AffiliateResourceFields on AffiliateResourceType {
|
|
7371
|
+
resourceActive
|
|
7372
|
+
resourceId
|
|
7373
|
+
resourceType
|
|
7374
|
+
rewards {
|
|
7375
|
+
...AffiliateRewardFields
|
|
7376
|
+
}
|
|
7377
|
+
}
|
|
7378
|
+
${AFFILIATE_REWARD_FIELDS_FRAGMENT}
|
|
7379
|
+
`;
|
|
7380
|
+
var AFFILIATE_FIELDS_FRAGMENT = gql`
|
|
7381
|
+
fragment AffiliateFields on AffiliateType {
|
|
7382
|
+
_id
|
|
7383
|
+
active
|
|
7384
|
+
affiliateCode
|
|
7385
|
+
affiliateResources {
|
|
7386
|
+
...AffiliateResourceFields
|
|
7387
|
+
}
|
|
7388
|
+
createdAt
|
|
7389
|
+
deletedAt
|
|
7390
|
+
overallPoints
|
|
7391
|
+
owner {
|
|
7392
|
+
...OwnerFields
|
|
7393
|
+
}
|
|
7394
|
+
updatedAt
|
|
7395
|
+
}
|
|
7396
|
+
${AFFILIATE_RESOURCE_FIELDS_FRAGMENT}
|
|
7397
|
+
${OWNER_FIELDS_FRAGMENT}
|
|
7398
|
+
`;
|
|
7399
|
+
var GET_AFFILIATE = gql`
|
|
7400
|
+
query getAffiliate($_id: ID!) {
|
|
7401
|
+
affiliate(_id: $_id) {
|
|
7402
|
+
...AffiliateFields
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
${AFFILIATE_FIELDS_FRAGMENT}
|
|
7406
|
+
`;
|
|
7407
|
+
var GET_AFFILIATES = gql`
|
|
7408
|
+
query getAffiliates {
|
|
7409
|
+
affiliates {
|
|
7410
|
+
...AffiliateFields
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
${AFFILIATE_FIELDS_FRAGMENT}
|
|
7414
|
+
`;
|
|
7358
7415
|
var PKG = "@timardex/cluemart-shared";
|
|
7359
7416
|
var IMAGE_EXTENSION = ".webp";
|
|
7360
7417
|
var posterIds = [
|
|
@@ -8369,19 +8426,13 @@ var redeemedRewardSchema = new MongooseSchema11(
|
|
|
8369
8426
|
},
|
|
8370
8427
|
{ _id: false }
|
|
8371
8428
|
);
|
|
8372
|
-
var affiliateSchema = new MongooseSchema11(
|
|
8373
|
-
{
|
|
8374
|
-
affiliateCode: { required: true, type: String },
|
|
8375
|
-
pointsAvailable: { required: true, type: Number }
|
|
8376
|
-
},
|
|
8377
|
-
{ _id: false }
|
|
8378
|
-
);
|
|
8379
8429
|
var schema7 = new MongooseSchema11(
|
|
8380
8430
|
{
|
|
8381
8431
|
active: { default: false, required: true, type: Boolean },
|
|
8382
8432
|
affiliate: {
|
|
8433
|
+
ref: "Affiliate",
|
|
8383
8434
|
required: false,
|
|
8384
|
-
type:
|
|
8435
|
+
type: mongoose11.Schema.Types.ObjectId
|
|
8385
8436
|
},
|
|
8386
8437
|
associates: {
|
|
8387
8438
|
required: false,
|
|
@@ -8481,13 +8532,6 @@ var schema7 = new MongooseSchema11(
|
|
|
8481
8532
|
},
|
|
8482
8533
|
{ strict: false, timestamps: true }
|
|
8483
8534
|
);
|
|
8484
|
-
schema7.index(
|
|
8485
|
-
{ "affiliate.affiliateCode": 1 },
|
|
8486
|
-
{
|
|
8487
|
-
partialFilterExpression: { active: true, deletedAt: null },
|
|
8488
|
-
unique: true
|
|
8489
|
-
}
|
|
8490
|
-
);
|
|
8491
8535
|
schema7.index({ "associates.email": 1 });
|
|
8492
8536
|
schema7.index({ "licences.expiryDate": 1 });
|
|
8493
8537
|
schema7.index({ "licences.licenceType": 1 });
|
|
@@ -8978,9 +9022,9 @@ var gameDataSchemas = {
|
|
|
8978
9022
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
8979
9023
|
};
|
|
8980
9024
|
var gameDataDefinition = Object.fromEntries(
|
|
8981
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
9025
|
+
Object.entries(gameDataSchemas).map(([key, schema18]) => [
|
|
8982
9026
|
key,
|
|
8983
|
-
{ default: null, required: false, type:
|
|
9027
|
+
{ default: null, required: false, type: schema18 }
|
|
8984
9028
|
])
|
|
8985
9029
|
);
|
|
8986
9030
|
var gameHistorySchema = new MongooseSchema23(
|
|
@@ -9079,8 +9123,74 @@ schema16.index(
|
|
|
9079
9123
|
);
|
|
9080
9124
|
var SchoolModel = mongoose24.models.School || mongoose24.model("School", schema16);
|
|
9081
9125
|
|
|
9082
|
-
// src/
|
|
9126
|
+
// src/mongoose/Affiliate.ts
|
|
9083
9127
|
import mongoose25 from "mongoose";
|
|
9128
|
+
var MongooseSchema25 = mongoose25.Schema;
|
|
9129
|
+
var affiliateRewardSchema = new MongooseSchema25(
|
|
9130
|
+
{
|
|
9131
|
+
createdAt: { required: true, type: Date },
|
|
9132
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
9133
|
+
redeemedAt: { default: null, required: false, type: Date },
|
|
9134
|
+
rewardDescription: { required: true, type: String },
|
|
9135
|
+
rewardType: {
|
|
9136
|
+
enum: Object.values(EnumAffiliateRewardType),
|
|
9137
|
+
required: true,
|
|
9138
|
+
type: String
|
|
9139
|
+
},
|
|
9140
|
+
rewardValue: { required: true, type: Number },
|
|
9141
|
+
updatedAt: { default: null, required: false, type: Date }
|
|
9142
|
+
},
|
|
9143
|
+
{ _id: false }
|
|
9144
|
+
);
|
|
9145
|
+
var affiliateResourceSchema = new MongooseSchema25(
|
|
9146
|
+
{
|
|
9147
|
+
resourceActive: { default: true, required: true, type: Boolean },
|
|
9148
|
+
resourceId: {
|
|
9149
|
+
required: true,
|
|
9150
|
+
type: mongoose25.Schema.Types.ObjectId
|
|
9151
|
+
},
|
|
9152
|
+
resourceType: {
|
|
9153
|
+
enum: Object.values(EnumResourceType),
|
|
9154
|
+
required: true,
|
|
9155
|
+
type: String
|
|
9156
|
+
},
|
|
9157
|
+
rewards: {
|
|
9158
|
+
default: [],
|
|
9159
|
+
required: false,
|
|
9160
|
+
type: [affiliateRewardSchema]
|
|
9161
|
+
}
|
|
9162
|
+
},
|
|
9163
|
+
{ _id: false }
|
|
9164
|
+
);
|
|
9165
|
+
var schema17 = new MongooseSchema25(
|
|
9166
|
+
{
|
|
9167
|
+
active: { default: true, required: true, type: Boolean },
|
|
9168
|
+
affiliateCode: { required: true, type: String },
|
|
9169
|
+
affiliateResources: {
|
|
9170
|
+
default: [],
|
|
9171
|
+
required: false,
|
|
9172
|
+
type: [affiliateResourceSchema]
|
|
9173
|
+
},
|
|
9174
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
9175
|
+
overallPoints: { default: 0, required: true, type: Number },
|
|
9176
|
+
owner: {
|
|
9177
|
+
required: true,
|
|
9178
|
+
type: OwnerTypeSchema
|
|
9179
|
+
}
|
|
9180
|
+
},
|
|
9181
|
+
{ timestamps: true }
|
|
9182
|
+
);
|
|
9183
|
+
schema17.index(
|
|
9184
|
+
{ affiliateCode: 1 },
|
|
9185
|
+
{
|
|
9186
|
+
partialFilterExpression: { deletedAt: null },
|
|
9187
|
+
unique: true
|
|
9188
|
+
}
|
|
9189
|
+
);
|
|
9190
|
+
var AffiliateModel = mongoose25.models.Affiliate || mongoose25.model("Affiliate", schema17);
|
|
9191
|
+
|
|
9192
|
+
// src/service/database.ts
|
|
9193
|
+
import mongoose26 from "mongoose";
|
|
9084
9194
|
var connectToDatabase = async ({
|
|
9085
9195
|
appName,
|
|
9086
9196
|
dbName,
|
|
@@ -9093,7 +9203,7 @@ var connectToDatabase = async ({
|
|
|
9093
9203
|
// Fallback to MongoDB Atlas connection string
|
|
9094
9204
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
9095
9205
|
);
|
|
9096
|
-
await
|
|
9206
|
+
await mongoose26.connect(mongoUri);
|
|
9097
9207
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
9098
9208
|
console.log(
|
|
9099
9209
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -9273,9 +9383,9 @@ async function updateAdStatuses() {
|
|
|
9273
9383
|
}
|
|
9274
9384
|
|
|
9275
9385
|
// src/service/associate.ts
|
|
9276
|
-
import
|
|
9386
|
+
import mongoose27 from "mongoose";
|
|
9277
9387
|
function normalizeObjectId(id) {
|
|
9278
|
-
return typeof id === "string" ? new
|
|
9388
|
+
return typeof id === "string" ? new mongoose27.Types.ObjectId(id) : id;
|
|
9279
9389
|
}
|
|
9280
9390
|
async function getAssociateEmailsForResource({
|
|
9281
9391
|
normalizedResourceId,
|
|
@@ -9427,12 +9537,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
9427
9537
|
}
|
|
9428
9538
|
|
|
9429
9539
|
// src/service/objectIdToString.ts
|
|
9430
|
-
import
|
|
9540
|
+
import mongoose28 from "mongoose";
|
|
9431
9541
|
function convertObjectIdsToStrings(obj) {
|
|
9432
9542
|
if (obj === null || obj === void 0) {
|
|
9433
9543
|
return obj;
|
|
9434
9544
|
}
|
|
9435
|
-
if (obj instanceof
|
|
9545
|
+
if (obj instanceof mongoose28.Types.ObjectId) {
|
|
9436
9546
|
return obj.toString();
|
|
9437
9547
|
}
|
|
9438
9548
|
if (obj instanceof Date) {
|
|
@@ -9616,7 +9726,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
9616
9726
|
|
|
9617
9727
|
// src/types/index.ts
|
|
9618
9728
|
import express from "express";
|
|
9619
|
-
import
|
|
9729
|
+
import mongoose29 from "mongoose";
|
|
9620
9730
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
9621
9731
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
9622
9732
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -9627,6 +9737,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
|
9627
9737
|
export {
|
|
9628
9738
|
APP_SETTINGS_ID,
|
|
9629
9739
|
AdModel,
|
|
9740
|
+
AffiliateModel,
|
|
9630
9741
|
AppSettingModel,
|
|
9631
9742
|
CategorySchema,
|
|
9632
9743
|
ChatModel,
|
|
@@ -9664,7 +9775,7 @@ export {
|
|
|
9664
9775
|
findEventOrImportedMarketById,
|
|
9665
9776
|
locationGeoSchema,
|
|
9666
9777
|
locationsSchema,
|
|
9667
|
-
|
|
9778
|
+
mongoose29 as mongoose,
|
|
9668
9779
|
refundPolicySchema,
|
|
9669
9780
|
relatedPostSchema,
|
|
9670
9781
|
relationDatesSchema,
|