@timardex/cluemart-server-shared 1.0.281 → 1.0.287
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-C_g6TdeG.d.ts +396 -0
- package/dist/Affiliate-CmS0A1gU.d.mts +396 -0
- package/dist/{Chat-DYkhie3G.d.mts → Chat-Bnqec74U.d.mts} +4 -4
- package/dist/{Chat-DYkhie3G.d.ts → Chat-Bnqec74U.d.ts} +4 -4
- package/dist/{chunk-6IK6D2KS.mjs → chunk-6EDO734D.mjs} +6 -1
- package/dist/chunk-6EDO734D.mjs.map +1 -0
- package/dist/index.cjs +334 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +273 -149
- package/dist/index.d.ts +273 -149
- package/dist/index.mjs +318 -31
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +2 -0
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +40 -387
- package/dist/mongoose/index.d.ts +40 -387
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +677 -382
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +129 -5
- package/dist/service/index.d.ts +129 -5
- package/dist/service/index.mjs +313 -24
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/Relation-6t3Gn4pM.d.ts +0 -47
- package/dist/Relation-BjYghDE9.d.mts +0 -47
- package/dist/chunk-6IK6D2KS.mjs.map +0 -1
package/dist/service/index.cjs
CHANGED
|
@@ -30,10 +30,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/service/index.ts
|
|
31
31
|
var service_exports = {};
|
|
32
32
|
__export(service_exports, {
|
|
33
|
+
ACTIVE_NOT_DELETED_FILTER: () => ACTIVE_NOT_DELETED_FILTER,
|
|
34
|
+
AFFILIATE_REWARDS: () => AFFILIATE_REWARDS,
|
|
35
|
+
activeAffiliateCodeExists: () => activeAffiliateCodeExists,
|
|
36
|
+
awardAffiliateVendorSubscriptionRewards: () => awardAffiliateVendorSubscriptionRewards,
|
|
33
37
|
connectToDatabase: () => connectToDatabase,
|
|
34
38
|
convertObjectIdsToStrings: () => convertObjectIdsToStrings,
|
|
39
|
+
createAffiliateReward: () => createAffiliateReward,
|
|
35
40
|
didRemoveAnyEventDates: () => didRemoveAnyEventDates,
|
|
41
|
+
findAffiliateByPromoCode: () => findAffiliateByPromoCode,
|
|
36
42
|
findEventOrImportedMarketById: () => findEventOrImportedMarketById,
|
|
43
|
+
getSubscriptionRewardPeriodBounds: () => getSubscriptionRewardPeriodBounds,
|
|
44
|
+
mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
|
|
45
|
+
normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
|
|
46
|
+
normalizePromoCode: () => normalizePromoCode,
|
|
37
47
|
saveNotificationsInDb: () => saveNotificationsInDb,
|
|
38
48
|
sendPushNotifications: () => sendPushNotifications,
|
|
39
49
|
updateAdStatuses: () => updateAdStatuses,
|
|
@@ -44,31 +54,6 @@ __export(service_exports, {
|
|
|
44
54
|
});
|
|
45
55
|
module.exports = __toCommonJS(service_exports);
|
|
46
56
|
|
|
47
|
-
// src/service/database.ts
|
|
48
|
-
var import_mongoose = __toESM(require("mongoose"));
|
|
49
|
-
var connectToDatabase = async ({
|
|
50
|
-
appName,
|
|
51
|
-
dbName,
|
|
52
|
-
dbPassword,
|
|
53
|
-
dbUser,
|
|
54
|
-
mongodbUri
|
|
55
|
-
}) => {
|
|
56
|
-
try {
|
|
57
|
-
const mongoUri = mongodbUri ? mongodbUri : (
|
|
58
|
-
// Fallback to MongoDB Atlas connection string
|
|
59
|
-
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
60
|
-
);
|
|
61
|
-
await import_mongoose.default.connect(mongoUri);
|
|
62
|
-
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
63
|
-
console.log(
|
|
64
|
-
`${connectionType} connected from server/src/service/database.ts`
|
|
65
|
-
);
|
|
66
|
-
} catch (err) {
|
|
67
|
-
console.error("Error connecting to MongoDB:", err);
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
57
|
// node_modules/@timardex/cluemart-shared/dist/index.mjs
|
|
73
58
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
74
59
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"), 1);
|
|
@@ -3679,14 +3664,14 @@ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
|
|
|
3679
3664
|
EnumGameType2["ODD_ONE_OUT"] = "oddOneOut";
|
|
3680
3665
|
return EnumGameType2;
|
|
3681
3666
|
})(EnumGameType || {});
|
|
3682
|
-
var EnumAffiliateRewardType = /* @__PURE__ */ ((
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
return
|
|
3667
|
+
var EnumAffiliateRewardType = /* @__PURE__ */ ((EnumAffiliateRewardType22) => {
|
|
3668
|
+
EnumAffiliateRewardType22["ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS"] = "ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS";
|
|
3669
|
+
EnumAffiliateRewardType22["ACTIVE_VENDOR_BONUS_REWARD"] = "ACTIVE_VENDOR_BONUS_REWARD";
|
|
3670
|
+
EnumAffiliateRewardType22["ACTIVE_VENDOR_PRO_SUBSCRIPTION"] = "ACTIVE_VENDOR_PRO_SUBSCRIPTION";
|
|
3671
|
+
EnumAffiliateRewardType22["ACTIVE_VENDOR_STANDARD_SUBSCRIPTION"] = "ACTIVE_VENDOR_STANDARD_SUBSCRIPTION";
|
|
3672
|
+
EnumAffiliateRewardType22["NEW_EVENT_REGISTRATION"] = "NEW_EVENT_REGISTRATION";
|
|
3673
|
+
EnumAffiliateRewardType22["NEW_VENDOR_REGISTRATION"] = "NEW_VENDOR_REGISTRATION";
|
|
3674
|
+
return EnumAffiliateRewardType22;
|
|
3690
3675
|
})(EnumAffiliateRewardType || {});
|
|
3691
3676
|
var statusOptions = [
|
|
3692
3677
|
...Object.values(EnumInviteStatus).map((status) => ({
|
|
@@ -7491,6 +7476,7 @@ var AFFILIATE_REWARD_FIELDS_FRAGMENT = gql`
|
|
|
7491
7476
|
var AFFILIATE_RESOURCE_FIELDS_FRAGMENT = gql`
|
|
7492
7477
|
fragment AffiliateResourceFields on AffiliateResourceType {
|
|
7493
7478
|
resourceActive
|
|
7479
|
+
resourceDeletedAt
|
|
7494
7480
|
resourceId
|
|
7495
7481
|
resourceName
|
|
7496
7482
|
resourceType
|
|
@@ -7681,209 +7667,10 @@ var SHARE_TYPE_PATH_REGEX = [
|
|
|
7681
7667
|
RELATION_SHARE_INVITATION
|
|
7682
7668
|
].join("|");
|
|
7683
7669
|
|
|
7684
|
-
// src/mongoose/Notification.ts
|
|
7685
|
-
var import_mongoose2 = __toESM(require("mongoose"));
|
|
7686
|
-
var MongooseSchema = import_mongoose2.default.Schema;
|
|
7687
|
-
var schema = new MongooseSchema(
|
|
7688
|
-
{
|
|
7689
|
-
data: {
|
|
7690
|
-
resourceId: { required: true, type: String },
|
|
7691
|
-
resourceName: { required: true, type: String },
|
|
7692
|
-
resourceType: {
|
|
7693
|
-
enum: Object.values(EnumNotificationResourceType),
|
|
7694
|
-
required: true,
|
|
7695
|
-
type: String
|
|
7696
|
-
}
|
|
7697
|
-
},
|
|
7698
|
-
isRead: { default: false, index: true, required: true, type: Boolean },
|
|
7699
|
-
message: { required: true, type: String },
|
|
7700
|
-
title: { required: true, type: String },
|
|
7701
|
-
type: {
|
|
7702
|
-
default: EnumNotificationType.SYSTEM,
|
|
7703
|
-
enum: Object.values(EnumNotificationType),
|
|
7704
|
-
required: true,
|
|
7705
|
-
type: String
|
|
7706
|
-
},
|
|
7707
|
-
userId: {
|
|
7708
|
-
ref: "User",
|
|
7709
|
-
required: true,
|
|
7710
|
-
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
7711
|
-
}
|
|
7712
|
-
},
|
|
7713
|
-
{ timestamps: true }
|
|
7714
|
-
);
|
|
7715
|
-
schema.index({ isRead: 1, userId: 1 });
|
|
7716
|
-
schema.index({ createdAt: -1, userId: 1 });
|
|
7717
|
-
var NotificationModel = import_mongoose2.default.models.Notification || import_mongoose2.default.model("Notification", schema);
|
|
7718
|
-
|
|
7719
|
-
// src/service/saveNotificationsInDb.ts
|
|
7720
|
-
async function saveNotificationsInDb(payload) {
|
|
7721
|
-
const { data, message, title, type, userIds } = payload;
|
|
7722
|
-
console.log("NOTIFICATION DATA", JSON.stringify(payload, null, 2));
|
|
7723
|
-
try {
|
|
7724
|
-
const notifications = userIds.map((userId) => ({
|
|
7725
|
-
data,
|
|
7726
|
-
isRead: false,
|
|
7727
|
-
message,
|
|
7728
|
-
title,
|
|
7729
|
-
type,
|
|
7730
|
-
userId
|
|
7731
|
-
}));
|
|
7732
|
-
await NotificationModel.insertMany(notifications);
|
|
7733
|
-
console.log(
|
|
7734
|
-
`Created ${notifications.length} notifications for ${userIds.length} users`
|
|
7735
|
-
);
|
|
7736
|
-
return [...new Set(userIds)];
|
|
7737
|
-
} catch (error) {
|
|
7738
|
-
console.error("Failed to create notifications:", error);
|
|
7739
|
-
return [];
|
|
7740
|
-
}
|
|
7741
|
-
}
|
|
7742
|
-
|
|
7743
|
-
// src/service/sendPushNotifications.ts
|
|
7744
|
-
var import_expo_server_sdk = require("expo-server-sdk");
|
|
7745
|
-
|
|
7746
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-LETM2YHF.mjs
|
|
7747
|
-
var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
|
|
7748
|
-
EnumOSPlatform22["ANDROID"] = "android";
|
|
7749
|
-
EnumOSPlatform22["IOS"] = "ios";
|
|
7750
|
-
EnumOSPlatform22["WEB"] = "web";
|
|
7751
|
-
return EnumOSPlatform22;
|
|
7752
|
-
})(EnumOSPlatform2 || {});
|
|
7753
|
-
|
|
7754
|
-
// src/mongoose/PushToken.ts
|
|
7755
|
-
var import_mongoose3 = __toESM(require("mongoose"));
|
|
7756
|
-
var MongooseSchema2 = import_mongoose3.default.Schema;
|
|
7757
|
-
var schema2 = new MongooseSchema2(
|
|
7758
|
-
{
|
|
7759
|
-
platform: {
|
|
7760
|
-
enum: Object.values(EnumOSPlatform2),
|
|
7761
|
-
required: true,
|
|
7762
|
-
type: String
|
|
7763
|
-
},
|
|
7764
|
-
token: { required: true, type: String },
|
|
7765
|
-
userId: {
|
|
7766
|
-
ref: "User",
|
|
7767
|
-
required: true,
|
|
7768
|
-
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
7769
|
-
}
|
|
7770
|
-
},
|
|
7771
|
-
{ timestamps: true }
|
|
7772
|
-
);
|
|
7773
|
-
var PushTokenModel = import_mongoose3.default.models.PushToken || import_mongoose3.default.model("PushToken", schema2);
|
|
7774
|
-
|
|
7775
|
-
// src/service/sendPushNotifications.ts
|
|
7776
|
-
var expo = new import_expo_server_sdk.Expo();
|
|
7777
|
-
function extractTokensFromMessage(message) {
|
|
7778
|
-
return Array.isArray(message.to) ? message.to : [message.to];
|
|
7779
|
-
}
|
|
7780
|
-
function createPushMessages({
|
|
7781
|
-
tokens,
|
|
7782
|
-
message,
|
|
7783
|
-
title,
|
|
7784
|
-
data
|
|
7785
|
-
}) {
|
|
7786
|
-
const messages = [];
|
|
7787
|
-
const invalidTokens = [];
|
|
7788
|
-
for (const token of tokens) {
|
|
7789
|
-
if (!import_expo_server_sdk.Expo.isExpoPushToken(token)) {
|
|
7790
|
-
invalidTokens.push(token);
|
|
7791
|
-
continue;
|
|
7792
|
-
}
|
|
7793
|
-
messages.push({
|
|
7794
|
-
body: message,
|
|
7795
|
-
data: { ...data },
|
|
7796
|
-
sound: "tui.wav",
|
|
7797
|
-
title,
|
|
7798
|
-
to: token
|
|
7799
|
-
});
|
|
7800
|
-
}
|
|
7801
|
-
return { invalidTokens, messages };
|
|
7802
|
-
}
|
|
7803
|
-
function processChunkResults(tickets, chunk) {
|
|
7804
|
-
let successCount = 0;
|
|
7805
|
-
const failedTokens = [];
|
|
7806
|
-
for (const [ticketIndex, ticket] of tickets.entries()) {
|
|
7807
|
-
if (ticket.status === "error") {
|
|
7808
|
-
const message = chunk[ticketIndex];
|
|
7809
|
-
if (message) {
|
|
7810
|
-
const tokens = extractTokensFromMessage(message);
|
|
7811
|
-
if (ticket.details?.error === "DeviceNotRegistered") {
|
|
7812
|
-
failedTokens.push(...tokens);
|
|
7813
|
-
}
|
|
7814
|
-
console.log("Push notification error", {
|
|
7815
|
-
error: ticket.details?.error,
|
|
7816
|
-
tokens
|
|
7817
|
-
});
|
|
7818
|
-
}
|
|
7819
|
-
} else {
|
|
7820
|
-
successCount++;
|
|
7821
|
-
}
|
|
7822
|
-
}
|
|
7823
|
-
return { failedTokens, successCount };
|
|
7824
|
-
}
|
|
7825
|
-
async function sendChunk(chunk, chunkIndex) {
|
|
7826
|
-
try {
|
|
7827
|
-
const tickets = await expo.sendPushNotificationsAsync(chunk);
|
|
7828
|
-
const { successCount, failedTokens } = processChunkResults(tickets, chunk);
|
|
7829
|
-
console.log(
|
|
7830
|
-
`Chunk ${chunkIndex + 1}: Sent ${successCount}/${chunk.length} notifications successfully`
|
|
7831
|
-
);
|
|
7832
|
-
return { failedTokens, successCount };
|
|
7833
|
-
} catch (error) {
|
|
7834
|
-
console.log("Error sending Expo push notification chunk", {
|
|
7835
|
-
chunkIndex,
|
|
7836
|
-
chunkSize: chunk.length,
|
|
7837
|
-
error: error instanceof Error ? error.message : String(error)
|
|
7838
|
-
});
|
|
7839
|
-
return { failedTokens: [], successCount: 0 };
|
|
7840
|
-
}
|
|
7841
|
-
}
|
|
7842
|
-
async function sendPushNotifications({
|
|
7843
|
-
data,
|
|
7844
|
-
message,
|
|
7845
|
-
title,
|
|
7846
|
-
userIds
|
|
7847
|
-
}) {
|
|
7848
|
-
const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
|
|
7849
|
-
const expoTokens = pushTokens.map((token) => token.token);
|
|
7850
|
-
if (!data) return;
|
|
7851
|
-
const { messages, invalidTokens } = createPushMessages({
|
|
7852
|
-
data,
|
|
7853
|
-
message,
|
|
7854
|
-
title,
|
|
7855
|
-
tokens: expoTokens
|
|
7856
|
-
});
|
|
7857
|
-
if (invalidTokens.length > 0) {
|
|
7858
|
-
console.log(`Found ${invalidTokens.length} invalid push tokens`);
|
|
7859
|
-
}
|
|
7860
|
-
if (messages.length === 0) {
|
|
7861
|
-
console.log("No valid messages to send after filtering tokens");
|
|
7862
|
-
return;
|
|
7863
|
-
}
|
|
7864
|
-
const chunks = expo.chunkPushNotifications(messages);
|
|
7865
|
-
let totalSuccessCount = 0;
|
|
7866
|
-
const allFailedTokens = [];
|
|
7867
|
-
for (const [chunkIndex, chunk] of chunks.entries()) {
|
|
7868
|
-
const { successCount, failedTokens } = await sendChunk(
|
|
7869
|
-
chunk,
|
|
7870
|
-
chunkIndex + 1
|
|
7871
|
-
);
|
|
7872
|
-
totalSuccessCount += successCount;
|
|
7873
|
-
allFailedTokens.push(...failedTokens);
|
|
7874
|
-
}
|
|
7875
|
-
console.log(
|
|
7876
|
-
`Sent push notification to ${totalSuccessCount}/${messages.length} tokens across ${chunks.length} chunks`
|
|
7877
|
-
);
|
|
7878
|
-
if (allFailedTokens.length > 0) {
|
|
7879
|
-
console.log(`Found ${allFailedTokens.length} failed push tokens`);
|
|
7880
|
-
}
|
|
7881
|
-
}
|
|
7882
|
-
|
|
7883
7670
|
// src/mongoose/Ad.ts
|
|
7884
|
-
var
|
|
7885
|
-
var
|
|
7886
|
-
var schemaAdresource = new
|
|
7671
|
+
var import_mongoose = __toESM(require("mongoose"));
|
|
7672
|
+
var MongooseSchema = import_mongoose.default.Schema;
|
|
7673
|
+
var schemaAdresource = new MongooseSchema({
|
|
7887
7674
|
adDescription: { required: true, type: String },
|
|
7888
7675
|
adImage: { required: true, type: String },
|
|
7889
7676
|
adStyle: {
|
|
@@ -7909,7 +7696,7 @@ var schemaAdresource = new MongooseSchema3({
|
|
|
7909
7696
|
type: String
|
|
7910
7697
|
}
|
|
7911
7698
|
});
|
|
7912
|
-
var
|
|
7699
|
+
var schema = new MongooseSchema(
|
|
7913
7700
|
{
|
|
7914
7701
|
active: { default: true, type: Boolean },
|
|
7915
7702
|
clicks: { default: 0, required: true, type: Number },
|
|
@@ -7935,51 +7722,51 @@ var schema3 = new MongooseSchema3(
|
|
|
7935
7722
|
timestamps: true
|
|
7936
7723
|
}
|
|
7937
7724
|
);
|
|
7938
|
-
|
|
7725
|
+
schema.index({
|
|
7939
7726
|
end: 1,
|
|
7940
7727
|
start: 1,
|
|
7941
7728
|
status: 1
|
|
7942
7729
|
});
|
|
7943
|
-
var AdModel =
|
|
7730
|
+
var AdModel = import_mongoose.default.models.Ad || import_mongoose.default.model("Ad", schema);
|
|
7944
7731
|
|
|
7945
7732
|
// src/mongoose/chat/Chat.ts
|
|
7946
|
-
var
|
|
7947
|
-
var
|
|
7948
|
-
var MessageReplyPreviewSchema = new
|
|
7733
|
+
var import_mongoose2 = __toESM(require("mongoose"));
|
|
7734
|
+
var MongooseSchema2 = import_mongoose2.default.Schema;
|
|
7735
|
+
var MessageReplyPreviewSchema = new MongooseSchema2(
|
|
7949
7736
|
{
|
|
7950
7737
|
contentPreview: { required: true, type: String },
|
|
7951
7738
|
senderId: {
|
|
7952
7739
|
ref: "User",
|
|
7953
7740
|
required: true,
|
|
7954
|
-
type:
|
|
7741
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
7955
7742
|
},
|
|
7956
7743
|
senderName: { required: true, type: String }
|
|
7957
7744
|
},
|
|
7958
7745
|
{ _id: false }
|
|
7959
7746
|
);
|
|
7960
|
-
var MessageReactionSchema = new
|
|
7747
|
+
var MessageReactionSchema = new MongooseSchema2(
|
|
7961
7748
|
{
|
|
7962
7749
|
createdAt: { required: true, type: Date },
|
|
7963
7750
|
userId: {
|
|
7964
7751
|
ref: "User",
|
|
7965
7752
|
required: true,
|
|
7966
|
-
type:
|
|
7753
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
7967
7754
|
}
|
|
7968
7755
|
},
|
|
7969
7756
|
{ _id: false }
|
|
7970
7757
|
);
|
|
7971
|
-
var MessageSeenSchema = new
|
|
7758
|
+
var MessageSeenSchema = new MongooseSchema2(
|
|
7972
7759
|
{
|
|
7973
7760
|
seenAt: { required: true, type: Date },
|
|
7974
7761
|
userId: {
|
|
7975
7762
|
ref: "User",
|
|
7976
7763
|
required: true,
|
|
7977
|
-
type:
|
|
7764
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
7978
7765
|
}
|
|
7979
7766
|
},
|
|
7980
7767
|
{ _id: false }
|
|
7981
7768
|
);
|
|
7982
|
-
var MessageSchema = new
|
|
7769
|
+
var MessageSchema = new MongooseSchema2(
|
|
7983
7770
|
{
|
|
7984
7771
|
content: { required: true, type: String },
|
|
7985
7772
|
likedBy: { default: [], required: false, type: [MessageReactionSchema] },
|
|
@@ -7990,18 +7777,18 @@ var MessageSchema = new MongooseSchema4(
|
|
|
7990
7777
|
replyToMessageId: {
|
|
7991
7778
|
ref: "Chat.messages",
|
|
7992
7779
|
required: false,
|
|
7993
|
-
type:
|
|
7780
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
7994
7781
|
},
|
|
7995
7782
|
seenBy: { default: [], required: false, type: [MessageSeenSchema] },
|
|
7996
7783
|
senderId: {
|
|
7997
7784
|
ref: "User",
|
|
7998
7785
|
required: true,
|
|
7999
|
-
type:
|
|
7786
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
8000
7787
|
}
|
|
8001
7788
|
},
|
|
8002
7789
|
{ timestamps: true }
|
|
8003
7790
|
);
|
|
8004
|
-
var ParticipantSchema = new
|
|
7791
|
+
var ParticipantSchema = new MongooseSchema2(
|
|
8005
7792
|
{
|
|
8006
7793
|
active: { default: true, required: true, type: Boolean },
|
|
8007
7794
|
isAssociate: { default: null, required: false, type: Boolean },
|
|
@@ -8010,14 +7797,14 @@ var ParticipantSchema = new MongooseSchema4(
|
|
|
8010
7797
|
userId: {
|
|
8011
7798
|
ref: "User",
|
|
8012
7799
|
required: true,
|
|
8013
|
-
type:
|
|
7800
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
8014
7801
|
},
|
|
8015
7802
|
userName: { required: true, type: String }
|
|
8016
7803
|
},
|
|
8017
7804
|
{ _id: false }
|
|
8018
7805
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8019
7806
|
);
|
|
8020
|
-
var ChatSchema = new
|
|
7807
|
+
var ChatSchema = new MongooseSchema2(
|
|
8021
7808
|
{
|
|
8022
7809
|
active: { default: true, required: true, type: Boolean },
|
|
8023
7810
|
chatDescription: { required: false, type: String },
|
|
@@ -8041,12 +7828,12 @@ ChatSchema.index({
|
|
|
8041
7828
|
"participants.userId": 1,
|
|
8042
7829
|
updatedAt: -1
|
|
8043
7830
|
});
|
|
8044
|
-
var ChatModel =
|
|
7831
|
+
var ChatModel = import_mongoose2.default.models.Chat || import_mongoose2.default.model("Chat", ChatSchema);
|
|
8045
7832
|
|
|
8046
7833
|
// src/mongoose/chat/ChatReport.ts
|
|
8047
|
-
var
|
|
8048
|
-
var
|
|
8049
|
-
var ReasonSchema = new
|
|
7834
|
+
var import_mongoose3 = __toESM(require("mongoose"));
|
|
7835
|
+
var MongooseSchema3 = import_mongoose3.default.Schema;
|
|
7836
|
+
var ReasonSchema = new MongooseSchema3(
|
|
8050
7837
|
{
|
|
8051
7838
|
details: { default: null, required: false, type: String },
|
|
8052
7839
|
reasonType: {
|
|
@@ -8057,23 +7844,23 @@ var ReasonSchema = new MongooseSchema5(
|
|
|
8057
7844
|
},
|
|
8058
7845
|
{ _id: false }
|
|
8059
7846
|
);
|
|
8060
|
-
var ChatReportSchema = new
|
|
7847
|
+
var ChatReportSchema = new MongooseSchema3(
|
|
8061
7848
|
{
|
|
8062
7849
|
chatId: {
|
|
8063
7850
|
ref: "Chat",
|
|
8064
7851
|
required: true,
|
|
8065
|
-
type:
|
|
7852
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
8066
7853
|
},
|
|
8067
7854
|
reason: { required: true, type: ReasonSchema },
|
|
8068
7855
|
reportedUserId: {
|
|
8069
7856
|
ref: "User",
|
|
8070
7857
|
required: true,
|
|
8071
|
-
type:
|
|
7858
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
8072
7859
|
},
|
|
8073
7860
|
reporterUserId: {
|
|
8074
7861
|
ref: "User",
|
|
8075
7862
|
required: true,
|
|
8076
|
-
type:
|
|
7863
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
8077
7864
|
},
|
|
8078
7865
|
resolved: { default: false, required: true, type: Boolean }
|
|
8079
7866
|
},
|
|
@@ -8081,18 +7868,18 @@ var ChatReportSchema = new MongooseSchema5(
|
|
|
8081
7868
|
);
|
|
8082
7869
|
ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
|
|
8083
7870
|
ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
|
|
8084
|
-
var ChatReportModel =
|
|
7871
|
+
var ChatReportModel = import_mongoose3.default.models.ChatReport || import_mongoose3.default.model("ChatReport", ChatReportSchema);
|
|
8085
7872
|
|
|
8086
7873
|
// src/mongoose/global.ts
|
|
8087
|
-
var
|
|
7874
|
+
var import_mongoose6 = __toESM(require("mongoose"));
|
|
8088
7875
|
|
|
8089
7876
|
// src/mongoose/Relation.ts
|
|
8090
|
-
var
|
|
7877
|
+
var import_mongoose5 = __toESM(require("mongoose"));
|
|
8091
7878
|
|
|
8092
7879
|
// src/mongoose/event/EventInfo.ts
|
|
8093
|
-
var
|
|
8094
|
-
var
|
|
8095
|
-
var StallTypeSchema = new
|
|
7880
|
+
var import_mongoose4 = __toESM(require("mongoose"));
|
|
7881
|
+
var MongooseSchema4 = import_mongoose4.default.Schema;
|
|
7882
|
+
var StallTypeSchema = new MongooseSchema4(
|
|
8096
7883
|
{
|
|
8097
7884
|
label: { required: false, type: String },
|
|
8098
7885
|
price: { required: false, type: Number },
|
|
@@ -8103,7 +7890,7 @@ var StallTypeSchema = new MongooseSchema6(
|
|
|
8103
7890
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8104
7891
|
}
|
|
8105
7892
|
);
|
|
8106
|
-
var dateTimeSchema = new
|
|
7893
|
+
var dateTimeSchema = new MongooseSchema4(
|
|
8107
7894
|
{
|
|
8108
7895
|
dateStatus: {
|
|
8109
7896
|
enum: Object.values(EnumEventDateStatus),
|
|
@@ -8119,7 +7906,7 @@ var dateTimeSchema = new MongooseSchema6(
|
|
|
8119
7906
|
{ _id: false }
|
|
8120
7907
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8121
7908
|
);
|
|
8122
|
-
var paymentInfoSchema = new
|
|
7909
|
+
var paymentInfoSchema = new MongooseSchema4(
|
|
8123
7910
|
{
|
|
8124
7911
|
accountHolderName: { required: false, type: String },
|
|
8125
7912
|
accountNumber: { required: false, type: String },
|
|
@@ -8133,7 +7920,7 @@ var paymentInfoSchema = new MongooseSchema6(
|
|
|
8133
7920
|
{ _id: false }
|
|
8134
7921
|
// Prevents Mongoose from creating an additional _id field
|
|
8135
7922
|
);
|
|
8136
|
-
var requirementsSchema = new
|
|
7923
|
+
var requirementsSchema = new MongooseSchema4(
|
|
8137
7924
|
{
|
|
8138
7925
|
category: { required: true, type: String },
|
|
8139
7926
|
label: { required: true, type: String },
|
|
@@ -8144,7 +7931,7 @@ var requirementsSchema = new MongooseSchema6(
|
|
|
8144
7931
|
// Prevents Mongoose from creating an additional _id field for
|
|
8145
7932
|
}
|
|
8146
7933
|
);
|
|
8147
|
-
var refundPolicySchema = new
|
|
7934
|
+
var refundPolicySchema = new MongooseSchema4(
|
|
8148
7935
|
{
|
|
8149
7936
|
category: { required: true, type: String },
|
|
8150
7937
|
label: { required: true, type: String },
|
|
@@ -8152,7 +7939,7 @@ var refundPolicySchema = new MongooseSchema6(
|
|
|
8152
7939
|
},
|
|
8153
7940
|
{ _id: false }
|
|
8154
7941
|
);
|
|
8155
|
-
var
|
|
7942
|
+
var schema2 = new MongooseSchema4(
|
|
8156
7943
|
{
|
|
8157
7944
|
active: { default: true, type: Boolean },
|
|
8158
7945
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -8160,7 +7947,7 @@ var schema4 = new MongooseSchema6(
|
|
|
8160
7947
|
eventId: {
|
|
8161
7948
|
ref: "Event",
|
|
8162
7949
|
required: true,
|
|
8163
|
-
type:
|
|
7950
|
+
type: import_mongoose4.default.Schema.Types.ObjectId
|
|
8164
7951
|
},
|
|
8165
7952
|
packInTime: { required: true, type: Number },
|
|
8166
7953
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -8170,11 +7957,11 @@ var schema4 = new MongooseSchema6(
|
|
|
8170
7957
|
},
|
|
8171
7958
|
{ timestamps: true }
|
|
8172
7959
|
);
|
|
8173
|
-
var EventInfoModel =
|
|
7960
|
+
var EventInfoModel = import_mongoose4.default.models.EventInfo || import_mongoose4.default.model("EventInfo", schema2);
|
|
8174
7961
|
|
|
8175
7962
|
// src/mongoose/Relation.ts
|
|
8176
|
-
var
|
|
8177
|
-
var relationDateTimeSchema = new
|
|
7963
|
+
var MongooseSchema5 = import_mongoose5.default.Schema;
|
|
7964
|
+
var relationDateTimeSchema = new MongooseSchema5(
|
|
8178
7965
|
{
|
|
8179
7966
|
dateStatus: {
|
|
8180
7967
|
enum: Object.values(EnumEventDateStatus),
|
|
@@ -8189,7 +7976,7 @@ var relationDateTimeSchema = new MongooseSchema7(
|
|
|
8189
7976
|
},
|
|
8190
7977
|
{ _id: false }
|
|
8191
7978
|
);
|
|
8192
|
-
var relationDatesSchema = new
|
|
7979
|
+
var relationDatesSchema = new MongooseSchema5(
|
|
8193
7980
|
{
|
|
8194
7981
|
dateTime: {
|
|
8195
7982
|
required: true,
|
|
@@ -8208,19 +7995,19 @@ var relationDatesSchema = new MongooseSchema7(
|
|
|
8208
7995
|
},
|
|
8209
7996
|
{ _id: false }
|
|
8210
7997
|
);
|
|
8211
|
-
var RelationTypeSchema = new
|
|
7998
|
+
var RelationTypeSchema = new MongooseSchema5(
|
|
8212
7999
|
{
|
|
8213
8000
|
active: { default: true, required: true, type: Boolean },
|
|
8214
8001
|
chatId: {
|
|
8215
8002
|
ref: "Chat",
|
|
8216
8003
|
required: true,
|
|
8217
|
-
type:
|
|
8004
|
+
type: import_mongoose5.default.Schema.Types.ObjectId
|
|
8218
8005
|
},
|
|
8219
8006
|
deletedAt: { default: null, required: false, type: Date },
|
|
8220
8007
|
eventId: {
|
|
8221
8008
|
ref: "Event",
|
|
8222
8009
|
required: true,
|
|
8223
|
-
type:
|
|
8010
|
+
type: import_mongoose5.default.Schema.Types.ObjectId
|
|
8224
8011
|
},
|
|
8225
8012
|
lastUpdateBy: {
|
|
8226
8013
|
enum: Object.values(EnumResourceType),
|
|
@@ -8236,7 +8023,7 @@ var RelationTypeSchema = new MongooseSchema7(
|
|
|
8236
8023
|
vendorId: {
|
|
8237
8024
|
ref: "Vendor",
|
|
8238
8025
|
required: true,
|
|
8239
|
-
type:
|
|
8026
|
+
type: import_mongoose5.default.Schema.Types.ObjectId
|
|
8240
8027
|
}
|
|
8241
8028
|
},
|
|
8242
8029
|
{ timestamps: true }
|
|
@@ -8248,23 +8035,23 @@ RelationTypeSchema.index({
|
|
|
8248
8035
|
"relationDates.status": 1,
|
|
8249
8036
|
vendorId: 1
|
|
8250
8037
|
});
|
|
8251
|
-
var RelationModel =
|
|
8038
|
+
var RelationModel = import_mongoose5.default.models.Relation || import_mongoose5.default.model("Relation", RelationTypeSchema);
|
|
8252
8039
|
|
|
8253
8040
|
// src/mongoose/global.ts
|
|
8254
|
-
var
|
|
8255
|
-
var OwnerTypeSchema = new
|
|
8041
|
+
var MongooseSchema6 = import_mongoose6.default.Schema;
|
|
8042
|
+
var OwnerTypeSchema = new MongooseSchema6(
|
|
8256
8043
|
{
|
|
8257
8044
|
email: { required: true, type: String },
|
|
8258
8045
|
userId: {
|
|
8259
8046
|
ref: "User",
|
|
8260
8047
|
required: true,
|
|
8261
|
-
type:
|
|
8048
|
+
type: import_mongoose6.default.Schema.Types.ObjectId
|
|
8262
8049
|
}
|
|
8263
8050
|
},
|
|
8264
8051
|
{ _id: false }
|
|
8265
8052
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8266
8053
|
);
|
|
8267
|
-
var SocialMediaTypeSchema = new
|
|
8054
|
+
var SocialMediaTypeSchema = new MongooseSchema6(
|
|
8268
8055
|
{
|
|
8269
8056
|
link: { required: true, type: String },
|
|
8270
8057
|
name: { required: true, type: String }
|
|
@@ -8272,7 +8059,7 @@ var SocialMediaTypeSchema = new MongooseSchema8(
|
|
|
8272
8059
|
{ _id: false }
|
|
8273
8060
|
// Prevents Mongoose from creating an additional _id field
|
|
8274
8061
|
);
|
|
8275
|
-
var ResourceImageTypeSchema = new
|
|
8062
|
+
var ResourceImageTypeSchema = new MongooseSchema6(
|
|
8276
8063
|
{
|
|
8277
8064
|
active: { default: true, required: true, type: Boolean },
|
|
8278
8065
|
source: { required: false, type: String },
|
|
@@ -8281,7 +8068,7 @@ var ResourceImageTypeSchema = new MongooseSchema8(
|
|
|
8281
8068
|
{ _id: false }
|
|
8282
8069
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8283
8070
|
);
|
|
8284
|
-
var SubCategorySchema = new
|
|
8071
|
+
var SubCategorySchema = new MongooseSchema6(
|
|
8285
8072
|
{
|
|
8286
8073
|
id: { required: false, type: String },
|
|
8287
8074
|
items: [
|
|
@@ -8295,7 +8082,7 @@ var SubCategorySchema = new MongooseSchema8(
|
|
|
8295
8082
|
{ _id: false }
|
|
8296
8083
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8297
8084
|
);
|
|
8298
|
-
var CategorySchema = new
|
|
8085
|
+
var CategorySchema = new MongooseSchema6(
|
|
8299
8086
|
{
|
|
8300
8087
|
id: { required: true, type: String },
|
|
8301
8088
|
name: { required: true, type: String },
|
|
@@ -8304,7 +8091,7 @@ var CategorySchema = new MongooseSchema8(
|
|
|
8304
8091
|
{ _id: false }
|
|
8305
8092
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8306
8093
|
);
|
|
8307
|
-
var PosterUsageTypeSchema = new
|
|
8094
|
+
var PosterUsageTypeSchema = new MongooseSchema6(
|
|
8308
8095
|
{
|
|
8309
8096
|
count: { default: 0, required: false, type: Number },
|
|
8310
8097
|
month: { required: false, type: String }
|
|
@@ -8312,7 +8099,7 @@ var PosterUsageTypeSchema = new MongooseSchema8(
|
|
|
8312
8099
|
{ _id: false }
|
|
8313
8100
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8314
8101
|
);
|
|
8315
|
-
var userLicenseSchema = new
|
|
8102
|
+
var userLicenseSchema = new MongooseSchema6(
|
|
8316
8103
|
{
|
|
8317
8104
|
expiryDate: { required: true, type: Date },
|
|
8318
8105
|
issuedDate: { required: true, type: Date },
|
|
@@ -8329,7 +8116,7 @@ var userLicenseSchema = new MongooseSchema8(
|
|
|
8329
8116
|
},
|
|
8330
8117
|
{ _id: false, timestamps: false }
|
|
8331
8118
|
);
|
|
8332
|
-
var associatesSchema = new
|
|
8119
|
+
var associatesSchema = new MongooseSchema6(
|
|
8333
8120
|
{
|
|
8334
8121
|
email: { required: true, type: String },
|
|
8335
8122
|
licence: {
|
|
@@ -8349,7 +8136,7 @@ var associatesSchema = new MongooseSchema8(
|
|
|
8349
8136
|
{ _id: false }
|
|
8350
8137
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8351
8138
|
);
|
|
8352
|
-
var ContactDetailsSchema = new
|
|
8139
|
+
var ContactDetailsSchema = new MongooseSchema6(
|
|
8353
8140
|
{
|
|
8354
8141
|
email: { required: false, type: String },
|
|
8355
8142
|
landlinePhone: { required: false, type: String },
|
|
@@ -8358,7 +8145,7 @@ var ContactDetailsSchema = new MongooseSchema8(
|
|
|
8358
8145
|
{ _id: false }
|
|
8359
8146
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8360
8147
|
);
|
|
8361
|
-
var termsAgreementSchema = new
|
|
8148
|
+
var termsAgreementSchema = new MongooseSchema6(
|
|
8362
8149
|
{
|
|
8363
8150
|
appBuildNumber: { required: true, type: String },
|
|
8364
8151
|
appId: { required: true, type: String },
|
|
@@ -8375,7 +8162,7 @@ var termsAgreementSchema = new MongooseSchema8(
|
|
|
8375
8162
|
},
|
|
8376
8163
|
{ _id: false }
|
|
8377
8164
|
);
|
|
8378
|
-
var resourceRelationsSchema = new
|
|
8165
|
+
var resourceRelationsSchema = new MongooseSchema6(
|
|
8379
8166
|
{
|
|
8380
8167
|
relationDates: {
|
|
8381
8168
|
default: [],
|
|
@@ -8385,12 +8172,12 @@ var resourceRelationsSchema = new MongooseSchema8(
|
|
|
8385
8172
|
relationId: {
|
|
8386
8173
|
ref: "Relation",
|
|
8387
8174
|
required: false,
|
|
8388
|
-
type:
|
|
8175
|
+
type: import_mongoose6.default.Schema.Types.ObjectId
|
|
8389
8176
|
}
|
|
8390
8177
|
},
|
|
8391
8178
|
{ _id: false }
|
|
8392
8179
|
);
|
|
8393
|
-
var dateTimeSchema2 = new
|
|
8180
|
+
var dateTimeSchema2 = new MongooseSchema6(
|
|
8394
8181
|
{
|
|
8395
8182
|
dateStatus: {
|
|
8396
8183
|
enum: Object.values(EnumEventDateStatus),
|
|
@@ -8405,7 +8192,7 @@ var dateTimeSchema2 = new MongooseSchema8(
|
|
|
8405
8192
|
{ _id: false }
|
|
8406
8193
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8407
8194
|
);
|
|
8408
|
-
var locationGeoSchema = new
|
|
8195
|
+
var locationGeoSchema = new MongooseSchema6(
|
|
8409
8196
|
{
|
|
8410
8197
|
coordinates: { required: true, type: [Number] },
|
|
8411
8198
|
// [longitude, latitude]
|
|
@@ -8414,7 +8201,7 @@ var locationGeoSchema = new MongooseSchema8(
|
|
|
8414
8201
|
{ _id: false }
|
|
8415
8202
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8416
8203
|
);
|
|
8417
|
-
var locationsSchema = new
|
|
8204
|
+
var locationsSchema = new MongooseSchema6(
|
|
8418
8205
|
{
|
|
8419
8206
|
city: { required: true, type: String },
|
|
8420
8207
|
country: { required: true, type: String },
|
|
@@ -8430,13 +8217,13 @@ var locationsSchema = new MongooseSchema8(
|
|
|
8430
8217
|
{ _id: false }
|
|
8431
8218
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8432
8219
|
);
|
|
8433
|
-
var relatedPostSchema = new
|
|
8220
|
+
var relatedPostSchema = new MongooseSchema6(
|
|
8434
8221
|
{
|
|
8435
8222
|
postActive: { default: true, required: true, type: Boolean },
|
|
8436
8223
|
postId: {
|
|
8437
8224
|
ref: "Post",
|
|
8438
8225
|
required: true,
|
|
8439
|
-
type:
|
|
8226
|
+
type: import_mongoose6.default.Schema.Types.ObjectId
|
|
8440
8227
|
},
|
|
8441
8228
|
postSlug: { required: true, type: String },
|
|
8442
8229
|
postType: {
|
|
@@ -8453,7 +8240,7 @@ var baseResourceFields = {
|
|
|
8453
8240
|
adIds: {
|
|
8454
8241
|
ref: "Ad",
|
|
8455
8242
|
required: false,
|
|
8456
|
-
type: [
|
|
8243
|
+
type: [import_mongoose6.default.Schema.Types.ObjectId]
|
|
8457
8244
|
},
|
|
8458
8245
|
associates: {
|
|
8459
8246
|
required: false,
|
|
@@ -8483,7 +8270,7 @@ var baseResourceFields = {
|
|
|
8483
8270
|
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
8484
8271
|
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
8485
8272
|
};
|
|
8486
|
-
var socialShareResourceSchema = new
|
|
8273
|
+
var socialShareResourceSchema = new MongooseSchema6(
|
|
8487
8274
|
{
|
|
8488
8275
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
8489
8276
|
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
@@ -8493,9 +8280,9 @@ var socialShareResourceSchema = new MongooseSchema8(
|
|
|
8493
8280
|
);
|
|
8494
8281
|
|
|
8495
8282
|
// src/mongoose/GoogleImportedMarket.ts
|
|
8496
|
-
var
|
|
8497
|
-
var
|
|
8498
|
-
var addressComponentSchema = new
|
|
8283
|
+
var import_mongoose7 = __toESM(require("mongoose"));
|
|
8284
|
+
var MongooseSchema7 = import_mongoose7.default.Schema;
|
|
8285
|
+
var addressComponentSchema = new MongooseSchema7(
|
|
8499
8286
|
{
|
|
8500
8287
|
longName: { required: false, type: String },
|
|
8501
8288
|
shortName: { required: false, type: String },
|
|
@@ -8503,7 +8290,7 @@ var addressComponentSchema = new MongooseSchema9(
|
|
|
8503
8290
|
},
|
|
8504
8291
|
{ _id: false }
|
|
8505
8292
|
);
|
|
8506
|
-
var
|
|
8293
|
+
var schema3 = new MongooseSchema7(
|
|
8507
8294
|
{
|
|
8508
8295
|
active: { default: false, required: true, type: Boolean },
|
|
8509
8296
|
address: { required: true, type: String },
|
|
@@ -8514,7 +8301,7 @@ var schema5 = new MongooseSchema9(
|
|
|
8514
8301
|
claimedByUserId: {
|
|
8515
8302
|
ref: "User",
|
|
8516
8303
|
required: false,
|
|
8517
|
-
type:
|
|
8304
|
+
type: import_mongoose7.default.Schema.Types.ObjectId
|
|
8518
8305
|
},
|
|
8519
8306
|
cover: {
|
|
8520
8307
|
required: false,
|
|
@@ -8526,7 +8313,7 @@ var schema5 = new MongooseSchema9(
|
|
|
8526
8313
|
eventId: {
|
|
8527
8314
|
ref: "Event",
|
|
8528
8315
|
required: false,
|
|
8529
|
-
type:
|
|
8316
|
+
type: import_mongoose7.default.Schema.Types.ObjectId
|
|
8530
8317
|
},
|
|
8531
8318
|
eventType: {
|
|
8532
8319
|
enum: Object.values(EnumEventType),
|
|
@@ -8565,17 +8352,81 @@ var schema5 = new MongooseSchema9(
|
|
|
8565
8352
|
},
|
|
8566
8353
|
{ timestamps: true }
|
|
8567
8354
|
);
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
var GoogleImportedMarketModel =
|
|
8355
|
+
schema3.index({ "location.geo": "2dsphere" });
|
|
8356
|
+
schema3.index({ name: 1 });
|
|
8357
|
+
schema3.index({ region: 1 });
|
|
8358
|
+
schema3.index({ deletedAt: 1 });
|
|
8359
|
+
schema3.index({ "dateTime.dateStatus": 1 });
|
|
8360
|
+
schema3.index({ slug: 1 });
|
|
8361
|
+
var GoogleImportedMarketModel = import_mongoose7.default.models.GoogleImportedMarket || import_mongoose7.default.model("GoogleImportedMarket", schema3);
|
|
8362
|
+
|
|
8363
|
+
// src/mongoose/Notification.ts
|
|
8364
|
+
var import_mongoose8 = __toESM(require("mongoose"));
|
|
8365
|
+
var MongooseSchema8 = import_mongoose8.default.Schema;
|
|
8366
|
+
var schema4 = new MongooseSchema8(
|
|
8367
|
+
{
|
|
8368
|
+
data: {
|
|
8369
|
+
resourceId: { required: true, type: String },
|
|
8370
|
+
resourceName: { required: true, type: String },
|
|
8371
|
+
resourceType: {
|
|
8372
|
+
enum: Object.values(EnumNotificationResourceType),
|
|
8373
|
+
required: true,
|
|
8374
|
+
type: String
|
|
8375
|
+
}
|
|
8376
|
+
},
|
|
8377
|
+
isRead: { default: false, index: true, required: true, type: Boolean },
|
|
8378
|
+
message: { required: true, type: String },
|
|
8379
|
+
title: { required: true, type: String },
|
|
8380
|
+
type: {
|
|
8381
|
+
default: EnumNotificationType.SYSTEM,
|
|
8382
|
+
enum: Object.values(EnumNotificationType),
|
|
8383
|
+
required: true,
|
|
8384
|
+
type: String
|
|
8385
|
+
},
|
|
8386
|
+
userId: {
|
|
8387
|
+
ref: "User",
|
|
8388
|
+
required: true,
|
|
8389
|
+
type: import_mongoose8.default.Schema.Types.ObjectId
|
|
8390
|
+
}
|
|
8391
|
+
},
|
|
8392
|
+
{ timestamps: true }
|
|
8393
|
+
);
|
|
8394
|
+
schema4.index({ isRead: 1, userId: 1 });
|
|
8395
|
+
schema4.index({ createdAt: -1, userId: 1 });
|
|
8396
|
+
var NotificationModel = import_mongoose8.default.models.Notification || import_mongoose8.default.model("Notification", schema4);
|
|
8397
|
+
|
|
8398
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-LETM2YHF.mjs
|
|
8399
|
+
var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
|
|
8400
|
+
EnumOSPlatform22["ANDROID"] = "android";
|
|
8401
|
+
EnumOSPlatform22["IOS"] = "ios";
|
|
8402
|
+
EnumOSPlatform22["WEB"] = "web";
|
|
8403
|
+
return EnumOSPlatform22;
|
|
8404
|
+
})(EnumOSPlatform2 || {});
|
|
8405
|
+
|
|
8406
|
+
// src/mongoose/PushToken.ts
|
|
8407
|
+
var import_mongoose9 = __toESM(require("mongoose"));
|
|
8408
|
+
var MongooseSchema9 = import_mongoose9.default.Schema;
|
|
8409
|
+
var schema5 = new MongooseSchema9(
|
|
8410
|
+
{
|
|
8411
|
+
platform: {
|
|
8412
|
+
enum: Object.values(EnumOSPlatform2),
|
|
8413
|
+
required: true,
|
|
8414
|
+
type: String
|
|
8415
|
+
},
|
|
8416
|
+
token: { required: true, type: String },
|
|
8417
|
+
userId: {
|
|
8418
|
+
ref: "User",
|
|
8419
|
+
required: true,
|
|
8420
|
+
type: import_mongoose9.default.Schema.Types.ObjectId
|
|
8421
|
+
}
|
|
8422
|
+
},
|
|
8423
|
+
{ timestamps: true }
|
|
8424
|
+
);
|
|
8425
|
+
var PushTokenModel = import_mongoose9.default.models.PushToken || import_mongoose9.default.model("PushToken", schema5);
|
|
8575
8426
|
|
|
8576
8427
|
// src/mongoose/ResourceActivity.ts
|
|
8577
|
-
var
|
|
8578
|
-
var MongooseSchema10 =
|
|
8428
|
+
var import_mongoose10 = __toESM(require("mongoose"));
|
|
8429
|
+
var MongooseSchema10 = import_mongoose10.default.Schema;
|
|
8579
8430
|
var ActivitySchema = new MongooseSchema10(
|
|
8580
8431
|
{
|
|
8581
8432
|
activityType: {
|
|
@@ -8618,18 +8469,18 @@ var schema6 = new MongooseSchema10(
|
|
|
8618
8469
|
);
|
|
8619
8470
|
schema6.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
8620
8471
|
schema6.index({ "views.location": "2dsphere" });
|
|
8621
|
-
var ResourceActivityModel =
|
|
8472
|
+
var ResourceActivityModel = import_mongoose10.default.models.ResourceActivity || import_mongoose10.default.model("ResourceActivity", schema6);
|
|
8622
8473
|
|
|
8623
8474
|
// src/mongoose/User.ts
|
|
8624
|
-
var
|
|
8625
|
-
var MongooseSchema11 =
|
|
8475
|
+
var import_mongoose11 = __toESM(require("mongoose"));
|
|
8476
|
+
var MongooseSchema11 = import_mongoose11.default.Schema;
|
|
8626
8477
|
var userActivityEventSchema = new MongooseSchema11(
|
|
8627
8478
|
{
|
|
8628
8479
|
dateTime: dateTimeSchema2,
|
|
8629
8480
|
resourceId: {
|
|
8630
8481
|
ref: "Event",
|
|
8631
8482
|
required: false,
|
|
8632
|
-
type:
|
|
8483
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8633
8484
|
}
|
|
8634
8485
|
},
|
|
8635
8486
|
{ _id: false }
|
|
@@ -8639,17 +8490,17 @@ var userActivityFavouritesSchema = new MongooseSchema11(
|
|
|
8639
8490
|
events: {
|
|
8640
8491
|
ref: "Event",
|
|
8641
8492
|
required: false,
|
|
8642
|
-
type: [
|
|
8493
|
+
type: [import_mongoose11.default.Schema.Types.ObjectId]
|
|
8643
8494
|
},
|
|
8644
8495
|
partners: {
|
|
8645
8496
|
ref: "Partner",
|
|
8646
8497
|
required: false,
|
|
8647
|
-
type: [
|
|
8498
|
+
type: [import_mongoose11.default.Schema.Types.ObjectId]
|
|
8648
8499
|
},
|
|
8649
8500
|
vendors: {
|
|
8650
8501
|
ref: "Vendor",
|
|
8651
8502
|
required: false,
|
|
8652
|
-
type: [
|
|
8503
|
+
type: [import_mongoose11.default.Schema.Types.ObjectId]
|
|
8653
8504
|
}
|
|
8654
8505
|
},
|
|
8655
8506
|
{ _id: false }
|
|
@@ -8703,7 +8554,7 @@ var schema7 = new MongooseSchema11(
|
|
|
8703
8554
|
affiliate: {
|
|
8704
8555
|
ref: "Affiliate",
|
|
8705
8556
|
required: false,
|
|
8706
|
-
type:
|
|
8557
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8707
8558
|
},
|
|
8708
8559
|
associates: {
|
|
8709
8560
|
required: false,
|
|
@@ -8723,13 +8574,13 @@ var schema7 = new MongooseSchema11(
|
|
|
8723
8574
|
events: {
|
|
8724
8575
|
ref: "Event",
|
|
8725
8576
|
required: false,
|
|
8726
|
-
type: [
|
|
8577
|
+
type: [import_mongoose11.default.Schema.Types.ObjectId]
|
|
8727
8578
|
},
|
|
8728
8579
|
firstName: { required: true, type: String },
|
|
8729
8580
|
game: {
|
|
8730
8581
|
ref: "Game",
|
|
8731
8582
|
required: false,
|
|
8732
|
-
type:
|
|
8583
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8733
8584
|
},
|
|
8734
8585
|
isTester: { default: false, required: true, type: Boolean },
|
|
8735
8586
|
lastName: { required: true, type: String },
|
|
@@ -8745,7 +8596,7 @@ var schema7 = new MongooseSchema11(
|
|
|
8745
8596
|
partner: {
|
|
8746
8597
|
ref: "Partner",
|
|
8747
8598
|
required: false,
|
|
8748
|
-
type:
|
|
8599
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8749
8600
|
},
|
|
8750
8601
|
password: { required: true, type: String },
|
|
8751
8602
|
platform: {
|
|
@@ -8778,7 +8629,7 @@ var schema7 = new MongooseSchema11(
|
|
|
8778
8629
|
school: {
|
|
8779
8630
|
ref: "School",
|
|
8780
8631
|
required: false,
|
|
8781
|
-
type:
|
|
8632
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8782
8633
|
},
|
|
8783
8634
|
stripe: {
|
|
8784
8635
|
required: false,
|
|
@@ -8803,7 +8654,7 @@ var schema7 = new MongooseSchema11(
|
|
|
8803
8654
|
vendor: {
|
|
8804
8655
|
ref: "Vendor",
|
|
8805
8656
|
required: false,
|
|
8806
|
-
type:
|
|
8657
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
8807
8658
|
}
|
|
8808
8659
|
},
|
|
8809
8660
|
{ strict: false, timestamps: true }
|
|
@@ -8811,11 +8662,11 @@ var schema7 = new MongooseSchema11(
|
|
|
8811
8662
|
schema7.index({ "associates.email": 1 });
|
|
8812
8663
|
schema7.index({ "licences.expiryDate": 1 });
|
|
8813
8664
|
schema7.index({ "licences.licenceType": 1 });
|
|
8814
|
-
var UserModel =
|
|
8665
|
+
var UserModel = import_mongoose11.default.models.User || import_mongoose11.default.model("User", schema7);
|
|
8815
8666
|
|
|
8816
8667
|
// src/mongoose/VerificationToken.ts
|
|
8817
|
-
var
|
|
8818
|
-
var MongooseSchema12 =
|
|
8668
|
+
var import_mongoose12 = __toESM(require("mongoose"));
|
|
8669
|
+
var MongooseSchema12 = import_mongoose12.default.Schema;
|
|
8819
8670
|
var schema8 = new MongooseSchema12(
|
|
8820
8671
|
{
|
|
8821
8672
|
createdAt: {
|
|
@@ -8831,11 +8682,11 @@ var schema8 = new MongooseSchema12(
|
|
|
8831
8682
|
},
|
|
8832
8683
|
{ timestamps: true }
|
|
8833
8684
|
);
|
|
8834
|
-
var VerificationTokenModel =
|
|
8685
|
+
var VerificationTokenModel = import_mongoose12.default.models.VerificationToken || import_mongoose12.default.model("VerificationToken", schema8);
|
|
8835
8686
|
|
|
8836
8687
|
// src/mongoose/vendor/Vendor.ts
|
|
8837
|
-
var
|
|
8838
|
-
var MongooseSchema13 =
|
|
8688
|
+
var import_mongoose13 = __toESM(require("mongoose"));
|
|
8689
|
+
var MongooseSchema13 = import_mongoose13.default.Schema;
|
|
8839
8690
|
var productTypeSchema = new MongooseSchema13(
|
|
8840
8691
|
{
|
|
8841
8692
|
description: { required: false, type: String },
|
|
@@ -8908,12 +8759,12 @@ var schema9 = new MongooseSchema13(
|
|
|
8908
8759
|
unregisteredVendorId: {
|
|
8909
8760
|
ref: "UnregisteredVendor",
|
|
8910
8761
|
required: false,
|
|
8911
|
-
type:
|
|
8762
|
+
type: import_mongoose13.default.Schema.Types.ObjectId
|
|
8912
8763
|
},
|
|
8913
8764
|
vendorInfoId: {
|
|
8914
8765
|
ref: "VendorInfo",
|
|
8915
8766
|
required: false,
|
|
8916
|
-
type:
|
|
8767
|
+
type: import_mongoose13.default.Schema.Types.ObjectId
|
|
8917
8768
|
},
|
|
8918
8769
|
vendorType: {
|
|
8919
8770
|
enum: Object.values(EnumVendorType),
|
|
@@ -8929,11 +8780,11 @@ schema9.index({ region: 1 });
|
|
|
8929
8780
|
schema9.index({ "categories.name": 1 });
|
|
8930
8781
|
schema9.index({ "associates.email": 1 });
|
|
8931
8782
|
schema9.index({ slug: 1 });
|
|
8932
|
-
var VendorModel =
|
|
8783
|
+
var VendorModel = import_mongoose13.default.models.Vendor || import_mongoose13.default.model("Vendor", schema9);
|
|
8933
8784
|
|
|
8934
8785
|
// src/mongoose/vendor/VendorInfo.ts
|
|
8935
|
-
var
|
|
8936
|
-
var MongooseSchema14 =
|
|
8786
|
+
var import_mongoose14 = __toESM(require("mongoose"));
|
|
8787
|
+
var MongooseSchema14 = import_mongoose14.default.Schema;
|
|
8937
8788
|
var AttributesSchema = new MongooseSchema14(
|
|
8938
8789
|
{
|
|
8939
8790
|
details: { required: false, type: String },
|
|
@@ -8976,23 +8827,23 @@ var schema10 = new MongooseSchema14(
|
|
|
8976
8827
|
vendorId: {
|
|
8977
8828
|
ref: "Vendor",
|
|
8978
8829
|
required: true,
|
|
8979
|
-
type:
|
|
8830
|
+
type: import_mongoose14.default.Schema.Types.ObjectId
|
|
8980
8831
|
}
|
|
8981
8832
|
},
|
|
8982
8833
|
{ timestamps: true }
|
|
8983
8834
|
);
|
|
8984
|
-
var VendorInfoModel =
|
|
8835
|
+
var VendorInfoModel = import_mongoose14.default.models.VendorInfo || import_mongoose14.default.model("VendorInfo", schema10);
|
|
8985
8836
|
|
|
8986
8837
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
8987
|
-
var
|
|
8988
|
-
var MongooseSchema15 =
|
|
8838
|
+
var import_mongoose15 = __toESM(require("mongoose"));
|
|
8839
|
+
var MongooseSchema15 = import_mongoose15.default.Schema;
|
|
8989
8840
|
var invitationSchema = new MongooseSchema15(
|
|
8990
8841
|
{
|
|
8991
8842
|
dateTime: { required: true, type: [dateTimeSchema2] },
|
|
8992
8843
|
inviterId: {
|
|
8993
8844
|
ref: "Event",
|
|
8994
8845
|
required: true,
|
|
8995
|
-
type:
|
|
8846
|
+
type: import_mongoose15.default.Schema.Types.ObjectId
|
|
8996
8847
|
}
|
|
8997
8848
|
},
|
|
8998
8849
|
{ _id: false }
|
|
@@ -9006,7 +8857,7 @@ var schema11 = new MongooseSchema15(
|
|
|
9006
8857
|
claimedByUserId: {
|
|
9007
8858
|
ref: "User",
|
|
9008
8859
|
required: false,
|
|
9009
|
-
type:
|
|
8860
|
+
type: import_mongoose15.default.Schema.Types.ObjectId
|
|
9010
8861
|
},
|
|
9011
8862
|
deletedAt: { default: null, required: false, type: Date },
|
|
9012
8863
|
email: { required: false, type: String },
|
|
@@ -9018,11 +8869,11 @@ var schema11 = new MongooseSchema15(
|
|
|
9018
8869
|
);
|
|
9019
8870
|
schema11.index({ name: 1 });
|
|
9020
8871
|
schema11.index({ email: 1 });
|
|
9021
|
-
var UnregisteredVendorModel =
|
|
8872
|
+
var UnregisteredVendorModel = import_mongoose15.default.models.UnregisteredVendor || import_mongoose15.default.model("UnregisteredVendor", schema11);
|
|
9022
8873
|
|
|
9023
8874
|
// src/mongoose/event/Event.ts
|
|
9024
|
-
var
|
|
9025
|
-
var MongooseSchema16 =
|
|
8875
|
+
var import_mongoose16 = __toESM(require("mongoose"));
|
|
8876
|
+
var MongooseSchema16 = import_mongoose16.default.Schema;
|
|
9026
8877
|
var schema12 = new MongooseSchema16(
|
|
9027
8878
|
{
|
|
9028
8879
|
...baseResourceFields,
|
|
@@ -9032,7 +8883,7 @@ var schema12 = new MongooseSchema16(
|
|
|
9032
8883
|
eventInfoId: {
|
|
9033
8884
|
ref: "EventInfo",
|
|
9034
8885
|
required: false,
|
|
9035
|
-
type:
|
|
8886
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
9036
8887
|
},
|
|
9037
8888
|
eventType: {
|
|
9038
8889
|
enum: Object.values(EnumEventType),
|
|
@@ -9071,11 +8922,11 @@ schema12.index({ "associates.email": 1 });
|
|
|
9071
8922
|
schema12.index({ deletedAt: 1 });
|
|
9072
8923
|
schema12.index({ "dateTime.dateStatus": 1 });
|
|
9073
8924
|
schema12.index({ slug: 1 });
|
|
9074
|
-
var EventModel =
|
|
8925
|
+
var EventModel = import_mongoose16.default.models.Event || import_mongoose16.default.model("Event", schema12);
|
|
9075
8926
|
|
|
9076
8927
|
// src/mongoose/Partner.ts
|
|
9077
|
-
var
|
|
9078
|
-
var MongooseSchema17 =
|
|
8928
|
+
var import_mongoose17 = __toESM(require("mongoose"));
|
|
8929
|
+
var MongooseSchema17 = import_mongoose17.default.Schema;
|
|
9079
8930
|
var schema13 = new MongooseSchema17(
|
|
9080
8931
|
{
|
|
9081
8932
|
...baseResourceFields,
|
|
@@ -9099,14 +8950,14 @@ schema13.index({ region: 1 });
|
|
|
9099
8950
|
schema13.index({ "location.geo": "2dsphere" });
|
|
9100
8951
|
schema13.index({ "associates.email": 1 });
|
|
9101
8952
|
schema13.index({ slug: 1 });
|
|
9102
|
-
var PartnerModel =
|
|
8953
|
+
var PartnerModel = import_mongoose17.default.models.Partner || import_mongoose17.default.model("Partner", schema13);
|
|
9103
8954
|
|
|
9104
8955
|
// src/mongoose/Post.ts
|
|
9105
|
-
var
|
|
9106
|
-
var MongooseSchema18 =
|
|
8956
|
+
var import_mongoose18 = __toESM(require("mongoose"));
|
|
8957
|
+
var MongooseSchema18 = import_mongoose18.default.Schema;
|
|
9107
8958
|
var contentSchema = new MongooseSchema18(
|
|
9108
8959
|
{
|
|
9109
|
-
contentData:
|
|
8960
|
+
contentData: import_mongoose18.Schema.Types.Mixed,
|
|
9110
8961
|
contentOrder: { required: true, type: Number },
|
|
9111
8962
|
contentType: {
|
|
9112
8963
|
enum: Object.values(EnumPostContentType),
|
|
@@ -9162,11 +9013,11 @@ var schema14 = new MongooseSchema18(
|
|
|
9162
9013
|
schema14.index({ title: 1 });
|
|
9163
9014
|
schema14.index({ tags: 1 });
|
|
9164
9015
|
schema14.index({ postType: 1, slug: 1 }, { unique: true });
|
|
9165
|
-
var PostModel =
|
|
9016
|
+
var PostModel = import_mongoose18.default.models.Post || import_mongoose18.default.model("Post", schema14);
|
|
9166
9017
|
|
|
9167
9018
|
// src/mongoose/AppSetting.ts
|
|
9168
|
-
var
|
|
9169
|
-
var MongooseSchema19 =
|
|
9019
|
+
var import_mongoose19 = __toESM(require("mongoose"));
|
|
9020
|
+
var MongooseSchema19 = import_mongoose19.default.Schema;
|
|
9170
9021
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
9171
9022
|
var AppSettingSchema = new MongooseSchema19(
|
|
9172
9023
|
{
|
|
@@ -9194,17 +9045,17 @@ var AppSettingSchema = new MongooseSchema19(
|
|
|
9194
9045
|
},
|
|
9195
9046
|
{ timestamps: true }
|
|
9196
9047
|
);
|
|
9197
|
-
var AppSettingModel =
|
|
9048
|
+
var AppSettingModel = import_mongoose19.default.models.AppSetting || import_mongoose19.default.model("AppSetting", AppSettingSchema);
|
|
9198
9049
|
|
|
9199
9050
|
// src/mongoose/game/Game.ts
|
|
9200
|
-
var
|
|
9051
|
+
var import_mongoose23 = __toESM(require("mongoose"));
|
|
9201
9052
|
|
|
9202
9053
|
// src/mongoose/game/DailyClue.ts
|
|
9203
|
-
var
|
|
9054
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
9204
9055
|
|
|
9205
9056
|
// src/mongoose/game/utils.ts
|
|
9206
|
-
var
|
|
9207
|
-
var MongooseSchema20 =
|
|
9057
|
+
var import_mongoose20 = __toESM(require("mongoose"));
|
|
9058
|
+
var MongooseSchema20 = import_mongoose20.default.Schema;
|
|
9208
9059
|
var schemaGameDate = new MongooseSchema20(
|
|
9209
9060
|
{
|
|
9210
9061
|
endDate: { required: true, type: Date },
|
|
@@ -9214,7 +9065,7 @@ var schemaGameDate = new MongooseSchema20(
|
|
|
9214
9065
|
);
|
|
9215
9066
|
|
|
9216
9067
|
// src/mongoose/game/DailyClue.ts
|
|
9217
|
-
var MongooseSchema21 =
|
|
9068
|
+
var MongooseSchema21 = import_mongoose21.default.Schema;
|
|
9218
9069
|
var schemaLetters = new MongooseSchema21(
|
|
9219
9070
|
{
|
|
9220
9071
|
collected: { required: false, type: [String] },
|
|
@@ -9245,8 +9096,8 @@ var schemaDailyClueGameData = new MongooseSchema21(
|
|
|
9245
9096
|
);
|
|
9246
9097
|
|
|
9247
9098
|
// src/mongoose/game/PuzzleGame.ts
|
|
9248
|
-
var
|
|
9249
|
-
var MongooseSchema22 =
|
|
9099
|
+
var import_mongoose22 = __toESM(require("mongoose"));
|
|
9100
|
+
var MongooseSchema22 = import_mongoose22.default.Schema;
|
|
9250
9101
|
var schemaPuzzleAnswer = new MongooseSchema22(
|
|
9251
9102
|
{
|
|
9252
9103
|
answer: { required: true, type: String },
|
|
@@ -9291,7 +9142,7 @@ var schemaPuzzleGameData = new MongooseSchema22(
|
|
|
9291
9142
|
);
|
|
9292
9143
|
|
|
9293
9144
|
// src/mongoose/game/Game.ts
|
|
9294
|
-
var MongooseSchema23 =
|
|
9145
|
+
var MongooseSchema23 = import_mongoose23.default.Schema;
|
|
9295
9146
|
var gameDataSchemas = {
|
|
9296
9147
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
9297
9148
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
@@ -9351,11 +9202,11 @@ var schema15 = new MongooseSchema23(
|
|
|
9351
9202
|
},
|
|
9352
9203
|
{ timestamps: true }
|
|
9353
9204
|
);
|
|
9354
|
-
var GameModel =
|
|
9205
|
+
var GameModel = import_mongoose23.default.models.Game || import_mongoose23.default.model("Game", schema15);
|
|
9355
9206
|
|
|
9356
9207
|
// src/mongoose/School.ts
|
|
9357
|
-
var
|
|
9358
|
-
var MongooseSchema24 =
|
|
9208
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
9209
|
+
var MongooseSchema24 = import_mongoose24.default.Schema;
|
|
9359
9210
|
var campaignsSchema = new MongooseSchema24(
|
|
9360
9211
|
{
|
|
9361
9212
|
endDate: { required: true, type: Date },
|
|
@@ -9397,11 +9248,11 @@ schema16.index(
|
|
|
9397
9248
|
unique: true
|
|
9398
9249
|
}
|
|
9399
9250
|
);
|
|
9400
|
-
var SchoolModel =
|
|
9251
|
+
var SchoolModel = import_mongoose24.default.models.School || import_mongoose24.default.model("School", schema16);
|
|
9401
9252
|
|
|
9402
9253
|
// src/mongoose/Affiliate.ts
|
|
9403
|
-
var
|
|
9404
|
-
var MongooseSchema25 =
|
|
9254
|
+
var import_mongoose25 = __toESM(require("mongoose"));
|
|
9255
|
+
var MongooseSchema25 = import_mongoose25.default.Schema;
|
|
9405
9256
|
var affiliateRewardSchema = new MongooseSchema25(
|
|
9406
9257
|
{
|
|
9407
9258
|
createdAt: { required: true, type: Date },
|
|
@@ -9419,9 +9270,10 @@ var affiliateRewardSchema = new MongooseSchema25(
|
|
|
9419
9270
|
var affiliateResourceSchema = new MongooseSchema25(
|
|
9420
9271
|
{
|
|
9421
9272
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
9273
|
+
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
9422
9274
|
resourceId: {
|
|
9423
9275
|
required: true,
|
|
9424
|
-
type:
|
|
9276
|
+
type: import_mongoose25.default.Schema.Types.ObjectId
|
|
9425
9277
|
},
|
|
9426
9278
|
resourceName: { required: true, type: String },
|
|
9427
9279
|
resourceType: {
|
|
@@ -9500,7 +9352,440 @@ schema17.index(
|
|
|
9500
9352
|
unique: true
|
|
9501
9353
|
}
|
|
9502
9354
|
);
|
|
9503
|
-
var AffiliateModel =
|
|
9355
|
+
var AffiliateModel = import_mongoose25.default.models.Affiliate || import_mongoose25.default.model("Affiliate", schema17);
|
|
9356
|
+
|
|
9357
|
+
// src/service/promoCode/constants.ts
|
|
9358
|
+
var ACTIVE_NOT_DELETED_FILTER = {
|
|
9359
|
+
active: true,
|
|
9360
|
+
deletedAt: null
|
|
9361
|
+
};
|
|
9362
|
+
|
|
9363
|
+
// src/service/affiliate/activeAffiliateCodeExists.ts
|
|
9364
|
+
async function activeAffiliateCodeExists(affiliateCode) {
|
|
9365
|
+
const existing = await AffiliateModel.exists({
|
|
9366
|
+
...ACTIVE_NOT_DELETED_FILTER,
|
|
9367
|
+
affiliateCode
|
|
9368
|
+
}).exec();
|
|
9369
|
+
return existing !== null;
|
|
9370
|
+
}
|
|
9371
|
+
|
|
9372
|
+
// src/service/promoCode/normalizePromoCode.ts
|
|
9373
|
+
function normalizePromoCode(decoratedPromoCode) {
|
|
9374
|
+
const normalized = decoratedPromoCode?.trim().toUpperCase();
|
|
9375
|
+
return normalized || null;
|
|
9376
|
+
}
|
|
9377
|
+
|
|
9378
|
+
// src/service/saveNotificationsInDb.ts
|
|
9379
|
+
async function saveNotificationsInDb(payload) {
|
|
9380
|
+
const { data, message, title, type, userIds } = payload;
|
|
9381
|
+
console.log("NOTIFICATION DATA", JSON.stringify(payload, null, 2));
|
|
9382
|
+
try {
|
|
9383
|
+
const notifications = userIds.map((userId) => ({
|
|
9384
|
+
data,
|
|
9385
|
+
isRead: false,
|
|
9386
|
+
message,
|
|
9387
|
+
title,
|
|
9388
|
+
type,
|
|
9389
|
+
userId
|
|
9390
|
+
}));
|
|
9391
|
+
await NotificationModel.insertMany(notifications);
|
|
9392
|
+
console.log(
|
|
9393
|
+
`Created ${notifications.length} notifications for ${userIds.length} users`
|
|
9394
|
+
);
|
|
9395
|
+
return [...new Set(userIds)];
|
|
9396
|
+
} catch (error) {
|
|
9397
|
+
console.error("Failed to create notifications:", error);
|
|
9398
|
+
return [];
|
|
9399
|
+
}
|
|
9400
|
+
}
|
|
9401
|
+
|
|
9402
|
+
// src/service/sendPushNotifications.ts
|
|
9403
|
+
var import_expo_server_sdk = require("expo-server-sdk");
|
|
9404
|
+
var expo = new import_expo_server_sdk.Expo();
|
|
9405
|
+
function extractTokensFromMessage(message) {
|
|
9406
|
+
return Array.isArray(message.to) ? message.to : [message.to];
|
|
9407
|
+
}
|
|
9408
|
+
function createPushMessages({
|
|
9409
|
+
tokens,
|
|
9410
|
+
message,
|
|
9411
|
+
title,
|
|
9412
|
+
data
|
|
9413
|
+
}) {
|
|
9414
|
+
const messages = [];
|
|
9415
|
+
const invalidTokens = [];
|
|
9416
|
+
for (const token of tokens) {
|
|
9417
|
+
if (!import_expo_server_sdk.Expo.isExpoPushToken(token)) {
|
|
9418
|
+
invalidTokens.push(token);
|
|
9419
|
+
continue;
|
|
9420
|
+
}
|
|
9421
|
+
messages.push({
|
|
9422
|
+
body: message,
|
|
9423
|
+
data: { ...data },
|
|
9424
|
+
sound: "tui.wav",
|
|
9425
|
+
title,
|
|
9426
|
+
to: token
|
|
9427
|
+
});
|
|
9428
|
+
}
|
|
9429
|
+
return { invalidTokens, messages };
|
|
9430
|
+
}
|
|
9431
|
+
function processChunkResults(tickets, chunk) {
|
|
9432
|
+
let successCount = 0;
|
|
9433
|
+
const failedTokens = [];
|
|
9434
|
+
for (const [ticketIndex, ticket] of tickets.entries()) {
|
|
9435
|
+
if (ticket.status === "error") {
|
|
9436
|
+
const message = chunk[ticketIndex];
|
|
9437
|
+
if (message) {
|
|
9438
|
+
const tokens = extractTokensFromMessage(message);
|
|
9439
|
+
if (ticket.details?.error === "DeviceNotRegistered") {
|
|
9440
|
+
failedTokens.push(...tokens);
|
|
9441
|
+
}
|
|
9442
|
+
console.log("Push notification error", {
|
|
9443
|
+
error: ticket.details?.error,
|
|
9444
|
+
tokens
|
|
9445
|
+
});
|
|
9446
|
+
}
|
|
9447
|
+
} else {
|
|
9448
|
+
successCount++;
|
|
9449
|
+
}
|
|
9450
|
+
}
|
|
9451
|
+
return { failedTokens, successCount };
|
|
9452
|
+
}
|
|
9453
|
+
async function sendChunk(chunk, chunkIndex) {
|
|
9454
|
+
try {
|
|
9455
|
+
const tickets = await expo.sendPushNotificationsAsync(chunk);
|
|
9456
|
+
const { successCount, failedTokens } = processChunkResults(tickets, chunk);
|
|
9457
|
+
console.log(
|
|
9458
|
+
`Chunk ${chunkIndex + 1}: Sent ${successCount}/${chunk.length} notifications successfully`
|
|
9459
|
+
);
|
|
9460
|
+
return { failedTokens, successCount };
|
|
9461
|
+
} catch (error) {
|
|
9462
|
+
console.log("Error sending Expo push notification chunk", {
|
|
9463
|
+
chunkIndex,
|
|
9464
|
+
chunkSize: chunk.length,
|
|
9465
|
+
error: error instanceof Error ? error.message : String(error)
|
|
9466
|
+
});
|
|
9467
|
+
return { failedTokens: [], successCount: 0 };
|
|
9468
|
+
}
|
|
9469
|
+
}
|
|
9470
|
+
async function sendPushNotifications({
|
|
9471
|
+
data,
|
|
9472
|
+
message,
|
|
9473
|
+
title,
|
|
9474
|
+
userIds
|
|
9475
|
+
}) {
|
|
9476
|
+
const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
|
|
9477
|
+
const expoTokens = pushTokens.map((token) => token.token);
|
|
9478
|
+
if (!data) return;
|
|
9479
|
+
const { messages, invalidTokens } = createPushMessages({
|
|
9480
|
+
data,
|
|
9481
|
+
message,
|
|
9482
|
+
title,
|
|
9483
|
+
tokens: expoTokens
|
|
9484
|
+
});
|
|
9485
|
+
if (invalidTokens.length > 0) {
|
|
9486
|
+
console.log(`Found ${invalidTokens.length} invalid push tokens`);
|
|
9487
|
+
}
|
|
9488
|
+
if (messages.length === 0) {
|
|
9489
|
+
console.log("No valid messages to send after filtering tokens");
|
|
9490
|
+
return;
|
|
9491
|
+
}
|
|
9492
|
+
const chunks = expo.chunkPushNotifications(messages);
|
|
9493
|
+
let totalSuccessCount = 0;
|
|
9494
|
+
const allFailedTokens = [];
|
|
9495
|
+
for (const [chunkIndex, chunk] of chunks.entries()) {
|
|
9496
|
+
const { successCount, failedTokens } = await sendChunk(
|
|
9497
|
+
chunk,
|
|
9498
|
+
chunkIndex + 1
|
|
9499
|
+
);
|
|
9500
|
+
totalSuccessCount += successCount;
|
|
9501
|
+
allFailedTokens.push(...failedTokens);
|
|
9502
|
+
}
|
|
9503
|
+
console.log(
|
|
9504
|
+
`Sent push notification to ${totalSuccessCount}/${messages.length} tokens across ${chunks.length} chunks`
|
|
9505
|
+
);
|
|
9506
|
+
if (allFailedTokens.length > 0) {
|
|
9507
|
+
console.log(`Found ${allFailedTokens.length} failed push tokens`);
|
|
9508
|
+
}
|
|
9509
|
+
}
|
|
9510
|
+
|
|
9511
|
+
// src/service/affiliate/createAffiliateReward.ts
|
|
9512
|
+
var AFFILIATE_REWARDS = {
|
|
9513
|
+
[EnumAffiliateRewardType.NEW_EVENT_REGISTRATION]: {
|
|
9514
|
+
description: "10 points for new event registration (one-time reward)",
|
|
9515
|
+
value: 10
|
|
9516
|
+
},
|
|
9517
|
+
[EnumAffiliateRewardType.NEW_VENDOR_REGISTRATION]: {
|
|
9518
|
+
description: "5 points for new vendor registration (one-time reward)",
|
|
9519
|
+
value: 5
|
|
9520
|
+
},
|
|
9521
|
+
[EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION]: {
|
|
9522
|
+
description: "3 points for active vendor pro subscription (monthly reward)",
|
|
9523
|
+
value: 3
|
|
9524
|
+
},
|
|
9525
|
+
[EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION]: {
|
|
9526
|
+
description: "1 point for active vendor standard subscription (monthly reward)",
|
|
9527
|
+
value: 1
|
|
9528
|
+
},
|
|
9529
|
+
[EnumAffiliateRewardType.ACTIVE_VENDOR_BONUS_REWARD]: {
|
|
9530
|
+
description: "5 bonus points for every 10th active vendor (one-time reward)",
|
|
9531
|
+
value: 5
|
|
9532
|
+
},
|
|
9533
|
+
[EnumAffiliateRewardType.ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS]: {
|
|
9534
|
+
description: "50 points for active event with vendor registrations (one-time reward)",
|
|
9535
|
+
value: 50
|
|
9536
|
+
}
|
|
9537
|
+
};
|
|
9538
|
+
function createAffiliateReward(rewardType, createdAt) {
|
|
9539
|
+
const reward = AFFILIATE_REWARDS[rewardType];
|
|
9540
|
+
return {
|
|
9541
|
+
createdAt,
|
|
9542
|
+
redeemedAt: null,
|
|
9543
|
+
rewardDescription: reward.description,
|
|
9544
|
+
rewardType,
|
|
9545
|
+
rewardValue: reward.value
|
|
9546
|
+
};
|
|
9547
|
+
}
|
|
9548
|
+
|
|
9549
|
+
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
9550
|
+
function mapVendorLicenceToSubscriptionRewardType(licences, now = /* @__PURE__ */ new Date()) {
|
|
9551
|
+
const validTypes = new Set(
|
|
9552
|
+
(licences ?? []).filter(
|
|
9553
|
+
(licence) => new Date(licence.expiryDate).getTime() > now.getTime()
|
|
9554
|
+
).map((licence) => licence.licenceType)
|
|
9555
|
+
);
|
|
9556
|
+
if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
9557
|
+
return EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
|
|
9558
|
+
}
|
|
9559
|
+
if (validTypes.has(EnumUserLicence.STANDARD_VENDOR)) {
|
|
9560
|
+
return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
9561
|
+
}
|
|
9562
|
+
return null;
|
|
9563
|
+
}
|
|
9564
|
+
function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
9565
|
+
const periodStart = new Date(
|
|
9566
|
+
Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)
|
|
9567
|
+
);
|
|
9568
|
+
const periodEnd = new Date(
|
|
9569
|
+
Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1)
|
|
9570
|
+
);
|
|
9571
|
+
return { periodEnd, periodStart };
|
|
9572
|
+
}
|
|
9573
|
+
|
|
9574
|
+
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
9575
|
+
function isEligibleVendorResource(resource) {
|
|
9576
|
+
return resource.resourceType === EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
9577
|
+
}
|
|
9578
|
+
async function findAffiliatesWithActiveVendorReferrals() {
|
|
9579
|
+
return await AffiliateModel.find({
|
|
9580
|
+
affiliateResources: {
|
|
9581
|
+
$elemMatch: {
|
|
9582
|
+
resourceActive: true,
|
|
9583
|
+
resourceDeletedAt: null,
|
|
9584
|
+
resourceType: EnumResourceType.VENDOR
|
|
9585
|
+
}
|
|
9586
|
+
},
|
|
9587
|
+
deletedAt: null
|
|
9588
|
+
}).select("_id affiliateCode affiliateResources owner").lean().exec();
|
|
9589
|
+
}
|
|
9590
|
+
async function findEligibleReferredVendor(resourceId, affiliateCode) {
|
|
9591
|
+
return await VendorModel.findOne({
|
|
9592
|
+
_id: resourceId,
|
|
9593
|
+
active: true,
|
|
9594
|
+
deletedAt: null,
|
|
9595
|
+
promoCodes: affiliateCode
|
|
9596
|
+
}).select("_id name owner.userId").lean().exec();
|
|
9597
|
+
}
|
|
9598
|
+
async function resolveSubscriptionRewardTypeForVendorOwner(vendorOwnerUserId, now) {
|
|
9599
|
+
const vendorOwner = await UserModel.findById(vendorOwnerUserId).select("licences").lean().exec();
|
|
9600
|
+
return mapVendorLicenceToSubscriptionRewardType(vendorOwner?.licences, now);
|
|
9601
|
+
}
|
|
9602
|
+
async function notifyAffiliateOwnerOfSubscriptionReward({
|
|
9603
|
+
affiliateId,
|
|
9604
|
+
affiliateOwnerUserId,
|
|
9605
|
+
resourceName,
|
|
9606
|
+
rewardValue
|
|
9607
|
+
}) {
|
|
9608
|
+
const payload = {
|
|
9609
|
+
data: {
|
|
9610
|
+
resourceId: String(affiliateId),
|
|
9611
|
+
resourceName,
|
|
9612
|
+
resourceType: EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
|
|
9613
|
+
},
|
|
9614
|
+
message: `You earned ${rewardValue} points! Your referred vendor "${resourceName}" has an active subscription.`,
|
|
9615
|
+
title: "Affiliate points earned",
|
|
9616
|
+
type: EnumNotificationType.SYSTEM,
|
|
9617
|
+
userIds: [affiliateOwnerUserId]
|
|
9618
|
+
};
|
|
9619
|
+
try {
|
|
9620
|
+
await saveNotificationsInDb(payload);
|
|
9621
|
+
await sendPushNotifications(payload);
|
|
9622
|
+
} catch (error) {
|
|
9623
|
+
console.error(
|
|
9624
|
+
`[affiliate] subscription reward notification failed for affiliate ${String(affiliateId)}:`,
|
|
9625
|
+
error instanceof Error ? error.message : error
|
|
9626
|
+
);
|
|
9627
|
+
}
|
|
9628
|
+
}
|
|
9629
|
+
async function tryAwardSubscriptionReward({
|
|
9630
|
+
affiliate,
|
|
9631
|
+
createdAt,
|
|
9632
|
+
period,
|
|
9633
|
+
resource,
|
|
9634
|
+
rewardType,
|
|
9635
|
+
vendor
|
|
9636
|
+
}) {
|
|
9637
|
+
const reward = createAffiliateReward(rewardType, createdAt);
|
|
9638
|
+
const updateResult = await AffiliateModel.updateOne(
|
|
9639
|
+
{
|
|
9640
|
+
_id: affiliate._id,
|
|
9641
|
+
affiliateResources: {
|
|
9642
|
+
$elemMatch: {
|
|
9643
|
+
resourceActive: true,
|
|
9644
|
+
resourceDeletedAt: null,
|
|
9645
|
+
resourceId: vendor._id,
|
|
9646
|
+
resourceType: EnumResourceType.VENDOR,
|
|
9647
|
+
rewards: {
|
|
9648
|
+
$not: {
|
|
9649
|
+
$elemMatch: {
|
|
9650
|
+
createdAt: {
|
|
9651
|
+
$gte: period.periodStart,
|
|
9652
|
+
$lt: period.periodEnd
|
|
9653
|
+
},
|
|
9654
|
+
rewardType
|
|
9655
|
+
}
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
}
|
|
9659
|
+
},
|
|
9660
|
+
deletedAt: null
|
|
9661
|
+
},
|
|
9662
|
+
{
|
|
9663
|
+
$inc: { overallPoints: reward.rewardValue },
|
|
9664
|
+
$push: { "affiliateResources.$.rewards": reward }
|
|
9665
|
+
}
|
|
9666
|
+
).exec();
|
|
9667
|
+
if (updateResult.modifiedCount === 0) {
|
|
9668
|
+
return "skipped";
|
|
9669
|
+
}
|
|
9670
|
+
const affiliateOwnerUserId = affiliate.owner?.userId;
|
|
9671
|
+
if (affiliateOwnerUserId) {
|
|
9672
|
+
await notifyAffiliateOwnerOfSubscriptionReward({
|
|
9673
|
+
affiliateId: affiliate._id,
|
|
9674
|
+
affiliateOwnerUserId,
|
|
9675
|
+
resourceName: resource.resourceName || vendor.name || "vendor",
|
|
9676
|
+
rewardValue: reward.rewardValue
|
|
9677
|
+
});
|
|
9678
|
+
}
|
|
9679
|
+
return "awarded";
|
|
9680
|
+
}
|
|
9681
|
+
async function processAffiliateVendorReferral({
|
|
9682
|
+
affiliate,
|
|
9683
|
+
affiliateCode,
|
|
9684
|
+
createdAt,
|
|
9685
|
+
now,
|
|
9686
|
+
period,
|
|
9687
|
+
resource
|
|
9688
|
+
}) {
|
|
9689
|
+
const vendor = await findEligibleReferredVendor(
|
|
9690
|
+
resource.resourceId,
|
|
9691
|
+
affiliateCode
|
|
9692
|
+
);
|
|
9693
|
+
if (!vendor?.owner?.userId) {
|
|
9694
|
+
return "skipped";
|
|
9695
|
+
}
|
|
9696
|
+
const rewardType = await resolveSubscriptionRewardTypeForVendorOwner(
|
|
9697
|
+
vendor.owner.userId,
|
|
9698
|
+
now
|
|
9699
|
+
);
|
|
9700
|
+
if (!rewardType) {
|
|
9701
|
+
return "skipped";
|
|
9702
|
+
}
|
|
9703
|
+
return tryAwardSubscriptionReward({
|
|
9704
|
+
affiliate,
|
|
9705
|
+
createdAt,
|
|
9706
|
+
period,
|
|
9707
|
+
resource,
|
|
9708
|
+
rewardType,
|
|
9709
|
+
vendor
|
|
9710
|
+
});
|
|
9711
|
+
}
|
|
9712
|
+
async function awardAffiliateVendorSubscriptionRewards(now = /* @__PURE__ */ new Date()) {
|
|
9713
|
+
const period = getSubscriptionRewardPeriodBounds(now);
|
|
9714
|
+
const createdAt = now;
|
|
9715
|
+
const affiliates = await findAffiliatesWithActiveVendorReferrals();
|
|
9716
|
+
let awarded = 0;
|
|
9717
|
+
let skipped = 0;
|
|
9718
|
+
const seenPairs = /* @__PURE__ */ new Set();
|
|
9719
|
+
for (const affiliate of affiliates) {
|
|
9720
|
+
const affiliateCode = normalizePromoCode(affiliate.affiliateCode);
|
|
9721
|
+
if (!affiliateCode) {
|
|
9722
|
+
continue;
|
|
9723
|
+
}
|
|
9724
|
+
for (const resource of affiliate.affiliateResources) {
|
|
9725
|
+
if (!isEligibleVendorResource(resource)) {
|
|
9726
|
+
continue;
|
|
9727
|
+
}
|
|
9728
|
+
const pairKey = `${String(affiliate._id)}:${String(resource.resourceId)}`;
|
|
9729
|
+
if (seenPairs.has(pairKey)) {
|
|
9730
|
+
continue;
|
|
9731
|
+
}
|
|
9732
|
+
seenPairs.add(pairKey);
|
|
9733
|
+
const outcome = await processAffiliateVendorReferral({
|
|
9734
|
+
affiliate,
|
|
9735
|
+
affiliateCode,
|
|
9736
|
+
createdAt,
|
|
9737
|
+
now,
|
|
9738
|
+
period,
|
|
9739
|
+
resource
|
|
9740
|
+
});
|
|
9741
|
+
if (outcome === "awarded") {
|
|
9742
|
+
awarded += 1;
|
|
9743
|
+
} else {
|
|
9744
|
+
skipped += 1;
|
|
9745
|
+
}
|
|
9746
|
+
}
|
|
9747
|
+
}
|
|
9748
|
+
return { awarded, skipped };
|
|
9749
|
+
}
|
|
9750
|
+
|
|
9751
|
+
// src/service/affiliate/findAffiliateByPromoCode.ts
|
|
9752
|
+
async function findAffiliateByPromoCode(promoCode) {
|
|
9753
|
+
return AffiliateModel.findOne({
|
|
9754
|
+
affiliateCode: promoCode,
|
|
9755
|
+
deletedAt: null
|
|
9756
|
+
}).exec();
|
|
9757
|
+
}
|
|
9758
|
+
|
|
9759
|
+
// src/service/affiliate/normalizeAffiliatePromoCodes.ts
|
|
9760
|
+
function normalizeAffiliatePromoCodes(promoCodes) {
|
|
9761
|
+
const normalized = (promoCodes ?? []).map((code) => normalizePromoCode(code)).filter((code) => code !== null);
|
|
9762
|
+
return [...new Set(normalized)];
|
|
9763
|
+
}
|
|
9764
|
+
|
|
9765
|
+
// src/service/database.ts
|
|
9766
|
+
var import_mongoose29 = __toESM(require("mongoose"));
|
|
9767
|
+
var connectToDatabase = async ({
|
|
9768
|
+
appName,
|
|
9769
|
+
dbName,
|
|
9770
|
+
dbPassword,
|
|
9771
|
+
dbUser,
|
|
9772
|
+
mongodbUri
|
|
9773
|
+
}) => {
|
|
9774
|
+
try {
|
|
9775
|
+
const mongoUri = mongodbUri ? mongodbUri : (
|
|
9776
|
+
// Fallback to MongoDB Atlas connection string
|
|
9777
|
+
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
9778
|
+
);
|
|
9779
|
+
await import_mongoose29.default.connect(mongoUri);
|
|
9780
|
+
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
9781
|
+
console.log(
|
|
9782
|
+
`${connectionType} connected from server/src/service/database.ts`
|
|
9783
|
+
);
|
|
9784
|
+
} catch (err) {
|
|
9785
|
+
console.error("Error connecting to MongoDB:", err);
|
|
9786
|
+
throw err;
|
|
9787
|
+
}
|
|
9788
|
+
};
|
|
9504
9789
|
|
|
9505
9790
|
// src/service/updateAdStatus.ts
|
|
9506
9791
|
async function updateAdStatuses() {
|
|
@@ -9538,9 +9823,9 @@ async function updateAdStatuses() {
|
|
|
9538
9823
|
}
|
|
9539
9824
|
|
|
9540
9825
|
// src/service/associate.ts
|
|
9541
|
-
var
|
|
9826
|
+
var import_mongoose31 = __toESM(require("mongoose"));
|
|
9542
9827
|
function normalizeObjectId(id) {
|
|
9543
|
-
return typeof id === "string" ? new
|
|
9828
|
+
return typeof id === "string" ? new import_mongoose31.default.Types.ObjectId(id) : id;
|
|
9544
9829
|
}
|
|
9545
9830
|
async function getAssociateEmailsForResource({
|
|
9546
9831
|
normalizedResourceId,
|
|
@@ -9692,12 +9977,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
9692
9977
|
}
|
|
9693
9978
|
|
|
9694
9979
|
// src/service/objectIdToString.ts
|
|
9695
|
-
var
|
|
9980
|
+
var import_mongoose34 = __toESM(require("mongoose"));
|
|
9696
9981
|
function convertObjectIdsToStrings(obj) {
|
|
9697
9982
|
if (obj === null || obj === void 0) {
|
|
9698
9983
|
return obj;
|
|
9699
9984
|
}
|
|
9700
|
-
if (obj instanceof
|
|
9985
|
+
if (obj instanceof import_mongoose34.default.Types.ObjectId) {
|
|
9701
9986
|
return obj.toString();
|
|
9702
9987
|
}
|
|
9703
9988
|
if (obj instanceof Date) {
|
|
@@ -9880,10 +10165,20 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
9880
10165
|
}
|
|
9881
10166
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9882
10167
|
0 && (module.exports = {
|
|
10168
|
+
ACTIVE_NOT_DELETED_FILTER,
|
|
10169
|
+
AFFILIATE_REWARDS,
|
|
10170
|
+
activeAffiliateCodeExists,
|
|
10171
|
+
awardAffiliateVendorSubscriptionRewards,
|
|
9883
10172
|
connectToDatabase,
|
|
9884
10173
|
convertObjectIdsToStrings,
|
|
10174
|
+
createAffiliateReward,
|
|
9885
10175
|
didRemoveAnyEventDates,
|
|
10176
|
+
findAffiliateByPromoCode,
|
|
9886
10177
|
findEventOrImportedMarketById,
|
|
10178
|
+
getSubscriptionRewardPeriodBounds,
|
|
10179
|
+
mapVendorLicenceToSubscriptionRewardType,
|
|
10180
|
+
normalizeAffiliatePromoCodes,
|
|
10181
|
+
normalizePromoCode,
|
|
9887
10182
|
saveNotificationsInDb,
|
|
9888
10183
|
sendPushNotifications,
|
|
9889
10184
|
updateAdStatuses,
|