@timardex/cluemart-server-shared 2.5.1 → 3.0.1
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-zioeZDyH.d.ts → Affiliate-CpoM9_Bb.d.mts} +7 -1
- package/dist/{Affiliate-DIAzxxfs.d.mts → Affiliate-YoKkDGxN.d.ts} +7 -1
- package/dist/{chunk-TMPPPLIW.mjs → chunk-F54NB7VH.mjs} +1 -1
- package/dist/chunk-F54NB7VH.mjs.map +1 -0
- package/dist/{chunk-X76LYIOC.mjs → chunk-GDXPPYDN.mjs} +125 -81
- package/dist/chunk-GDXPPYDN.mjs.map +1 -0
- package/dist/{index-CmtBYjpi.d.mts → index-BptxBl9x.d.mts} +8 -1
- package/dist/{index-CmtBYjpi.d.ts → index-BptxBl9x.d.ts} +8 -1
- package/dist/index.cjs +132 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.mjs +131 -87
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +125 -80
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +27 -5
- package/dist/mongoose/index.d.ts +27 -5
- package/dist/mongoose/index.mjs +3 -1
- package/dist/service/index.cjs +129 -86
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +2 -2
- package/dist/service/index.d.ts +2 -2
- package/dist/service/index.mjs +2 -2
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-TMPPPLIW.mjs.map +0 -1
- package/dist/chunk-X76LYIOC.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -287,9 +287,8 @@ import {
|
|
|
287
287
|
isUtcMidnight as isUtcMidnight3
|
|
288
288
|
} from "@timardex/cluemart-shared";
|
|
289
289
|
import mongoose4 from "mongoose";
|
|
290
|
-
var
|
|
290
|
+
var ResourceMetricsSchema = new mongoose4.Schema(
|
|
291
291
|
{
|
|
292
|
-
adId: { ref: "Ad", required: true, type: String },
|
|
293
292
|
clicks: { default: 0, required: true, type: Number },
|
|
294
293
|
date: {
|
|
295
294
|
immutable: true,
|
|
@@ -314,9 +313,25 @@ var schema4 = new mongoose4.Schema(
|
|
|
314
313
|
type: String
|
|
315
314
|
}
|
|
316
315
|
},
|
|
316
|
+
{ _id: false }
|
|
317
|
+
);
|
|
318
|
+
var schema4 = new mongoose4.Schema(
|
|
319
|
+
{
|
|
320
|
+
adId: { ref: "Ad", required: true, type: String },
|
|
321
|
+
resource: { default: [], type: [ResourceMetricsSchema] }
|
|
322
|
+
},
|
|
317
323
|
{ timestamps: true }
|
|
318
324
|
);
|
|
319
|
-
schema4.index({ adId: 1
|
|
325
|
+
schema4.index({ adId: 1 }, { unique: true });
|
|
326
|
+
schema4.index(
|
|
327
|
+
{
|
|
328
|
+
adId: 1,
|
|
329
|
+
"resource.date": 1,
|
|
330
|
+
"resource.placement": 1,
|
|
331
|
+
"resource.platform": 1
|
|
332
|
+
},
|
|
333
|
+
{ unique: true }
|
|
334
|
+
);
|
|
320
335
|
var AdMetricsModel = mongoose4.models.AdMetrics || mongoose4.model("AdMetrics", schema4);
|
|
321
336
|
|
|
322
337
|
// src/mongoose/BillingCatalog.ts
|
|
@@ -903,15 +918,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
903
918
|
}
|
|
904
919
|
return null;
|
|
905
920
|
}
|
|
906
|
-
function searchNamePlugin(
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
921
|
+
function searchNamePlugin(schema25) {
|
|
922
|
+
schema25.add({ searchName: { default: "", required: false, type: String } });
|
|
923
|
+
schema25.index({ searchName: 1 });
|
|
924
|
+
schema25.pre("save", function syncSearchNameOnSave(next) {
|
|
910
925
|
const doc = this;
|
|
911
926
|
doc.searchName = deriveSearchName(doc.name);
|
|
912
927
|
next();
|
|
913
928
|
});
|
|
914
|
-
|
|
929
|
+
schema25.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
915
930
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
916
931
|
for (const doc of list) {
|
|
917
932
|
if (doc && typeof doc.name === "string") {
|
|
@@ -920,7 +935,7 @@ function searchNamePlugin(schema24) {
|
|
|
920
935
|
}
|
|
921
936
|
next();
|
|
922
937
|
});
|
|
923
|
-
|
|
938
|
+
schema25.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
924
939
|
for (const op of ops) {
|
|
925
940
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
926
941
|
if (doc && typeof doc.name === "string") {
|
|
@@ -946,7 +961,7 @@ function searchNamePlugin(schema24) {
|
|
|
946
961
|
}
|
|
947
962
|
next();
|
|
948
963
|
};
|
|
949
|
-
|
|
964
|
+
schema25.pre(
|
|
950
965
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
951
966
|
syncSearchNameOnUpdate
|
|
952
967
|
);
|
|
@@ -1558,7 +1573,15 @@ var schema11 = new MongooseSchema12(
|
|
|
1558
1573
|
required: false,
|
|
1559
1574
|
type: [redeemedRewardSchema]
|
|
1560
1575
|
},
|
|
1561
|
-
|
|
1576
|
+
// Per-client slots: a mobile session and an in-app WebView admin session
|
|
1577
|
+
// coexist without rotating each other out.
|
|
1578
|
+
refreshTokenAdmin: {
|
|
1579
|
+
default: null,
|
|
1580
|
+
required: false,
|
|
1581
|
+
type: String
|
|
1582
|
+
},
|
|
1583
|
+
refreshTokenMobile: {
|
|
1584
|
+
default: null,
|
|
1562
1585
|
required: false,
|
|
1563
1586
|
type: String
|
|
1564
1587
|
},
|
|
@@ -2057,20 +2080,40 @@ var AppSettingSchema = new MongooseSchema20(
|
|
|
2057
2080
|
);
|
|
2058
2081
|
var AppSettingModel = mongoose24.models.AppSetting || mongoose24.model("AppSetting", AppSettingSchema);
|
|
2059
2082
|
|
|
2083
|
+
// src/mongoose/AuthHandoffToken.ts
|
|
2084
|
+
import mongoose25 from "mongoose";
|
|
2085
|
+
var MongooseSchema21 = mongoose25.Schema;
|
|
2086
|
+
var schema20 = new MongooseSchema21(
|
|
2087
|
+
{
|
|
2088
|
+
expiresAt: { required: true, type: Date },
|
|
2089
|
+
jti: { index: true, required: true, type: String, unique: true },
|
|
2090
|
+
usedAt: { default: null, required: false, type: Date },
|
|
2091
|
+
userId: {
|
|
2092
|
+
index: true,
|
|
2093
|
+
ref: "User",
|
|
2094
|
+
required: true,
|
|
2095
|
+
type: mongoose25.Schema.Types.ObjectId
|
|
2096
|
+
}
|
|
2097
|
+
},
|
|
2098
|
+
{ timestamps: true }
|
|
2099
|
+
);
|
|
2100
|
+
schema20.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2101
|
+
var AuthHandoffTokenModel = mongoose25.models.AuthHandoffToken || mongoose25.model("AuthHandoffToken", schema20);
|
|
2102
|
+
|
|
2060
2103
|
// src/mongoose/game/Game.ts
|
|
2061
2104
|
import {
|
|
2062
2105
|
EnumGameStatus,
|
|
2063
2106
|
EnumGameType
|
|
2064
2107
|
} from "@timardex/cluemart-shared";
|
|
2065
|
-
import
|
|
2108
|
+
import mongoose29 from "mongoose";
|
|
2066
2109
|
|
|
2067
2110
|
// src/mongoose/game/DailyClue.ts
|
|
2068
|
-
import
|
|
2111
|
+
import mongoose27 from "mongoose";
|
|
2069
2112
|
|
|
2070
2113
|
// src/mongoose/game/utils.ts
|
|
2071
|
-
import
|
|
2072
|
-
var
|
|
2073
|
-
var schemaGameDate = new
|
|
2114
|
+
import mongoose26 from "mongoose";
|
|
2115
|
+
var MongooseSchema22 = mongoose26.Schema;
|
|
2116
|
+
var schemaGameDate = new MongooseSchema22(
|
|
2074
2117
|
{
|
|
2075
2118
|
endDate: { required: true, type: Date },
|
|
2076
2119
|
startDate: { required: true, type: Date }
|
|
@@ -2079,8 +2122,8 @@ var schemaGameDate = new MongooseSchema21(
|
|
|
2079
2122
|
);
|
|
2080
2123
|
|
|
2081
2124
|
// src/mongoose/game/DailyClue.ts
|
|
2082
|
-
var
|
|
2083
|
-
var schemaLetters = new
|
|
2125
|
+
var MongooseSchema23 = mongoose27.Schema;
|
|
2126
|
+
var schemaLetters = new MongooseSchema23(
|
|
2084
2127
|
{
|
|
2085
2128
|
collected: { required: false, type: [String] },
|
|
2086
2129
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2088,14 +2131,14 @@ var schemaLetters = new MongooseSchema22(
|
|
|
2088
2131
|
},
|
|
2089
2132
|
{ _id: false }
|
|
2090
2133
|
);
|
|
2091
|
-
var schemaDailyClueBaseGame = new
|
|
2134
|
+
var schemaDailyClueBaseGame = new MongooseSchema23(
|
|
2092
2135
|
{
|
|
2093
2136
|
gameDate: { required: true, type: schemaGameDate },
|
|
2094
2137
|
gameSolution: { required: true, type: String }
|
|
2095
2138
|
},
|
|
2096
2139
|
{ _id: false }
|
|
2097
2140
|
);
|
|
2098
|
-
var schemaDailyClueGameData = new
|
|
2141
|
+
var schemaDailyClueGameData = new MongooseSchema23(
|
|
2099
2142
|
{
|
|
2100
2143
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2101
2144
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2110,9 +2153,9 @@ var schemaDailyClueGameData = new MongooseSchema22(
|
|
|
2110
2153
|
);
|
|
2111
2154
|
|
|
2112
2155
|
// src/mongoose/game/PuzzleGame.ts
|
|
2113
|
-
import
|
|
2114
|
-
var
|
|
2115
|
-
var schemaPuzzleAnswer = new
|
|
2156
|
+
import mongoose28 from "mongoose";
|
|
2157
|
+
var MongooseSchema24 = mongoose28.Schema;
|
|
2158
|
+
var schemaPuzzleAnswer = new MongooseSchema24(
|
|
2116
2159
|
{
|
|
2117
2160
|
answer: { required: true, type: String },
|
|
2118
2161
|
answerId: { required: true, type: String },
|
|
@@ -2120,7 +2163,7 @@ var schemaPuzzleAnswer = new MongooseSchema23(
|
|
|
2120
2163
|
},
|
|
2121
2164
|
{ _id: false }
|
|
2122
2165
|
);
|
|
2123
|
-
var schemaPuzzleQuestion = new
|
|
2166
|
+
var schemaPuzzleQuestion = new MongooseSchema24(
|
|
2124
2167
|
{
|
|
2125
2168
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2126
2169
|
question: { required: true, type: String },
|
|
@@ -2128,20 +2171,20 @@ var schemaPuzzleQuestion = new MongooseSchema23(
|
|
|
2128
2171
|
},
|
|
2129
2172
|
{ _id: false }
|
|
2130
2173
|
);
|
|
2131
|
-
var schemaPuzzleBaseGame = new
|
|
2174
|
+
var schemaPuzzleBaseGame = new MongooseSchema24(
|
|
2132
2175
|
{
|
|
2133
2176
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2134
2177
|
},
|
|
2135
2178
|
{ _id: false }
|
|
2136
2179
|
);
|
|
2137
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2180
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema24(
|
|
2138
2181
|
{
|
|
2139
2182
|
questionId: { required: true, type: String },
|
|
2140
2183
|
selectedAnswerId: { required: true, type: String }
|
|
2141
2184
|
},
|
|
2142
2185
|
{ _id: false }
|
|
2143
2186
|
);
|
|
2144
|
-
var schemaPuzzleGameData = new
|
|
2187
|
+
var schemaPuzzleGameData = new MongooseSchema24(
|
|
2145
2188
|
{
|
|
2146
2189
|
answeredQuestions: {
|
|
2147
2190
|
default: null,
|
|
@@ -2156,19 +2199,19 @@ var schemaPuzzleGameData = new MongooseSchema23(
|
|
|
2156
2199
|
);
|
|
2157
2200
|
|
|
2158
2201
|
// src/mongoose/game/Game.ts
|
|
2159
|
-
var
|
|
2202
|
+
var MongooseSchema25 = mongoose29.Schema;
|
|
2160
2203
|
var gameDataSchemas = {
|
|
2161
2204
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2162
2205
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2163
2206
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2164
2207
|
};
|
|
2165
2208
|
var gameDataDefinition = Object.fromEntries(
|
|
2166
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2209
|
+
Object.entries(gameDataSchemas).map(([key, schema25]) => [
|
|
2167
2210
|
key,
|
|
2168
|
-
{ default: null, required: false, type:
|
|
2211
|
+
{ default: null, required: false, type: schema25 }
|
|
2169
2212
|
])
|
|
2170
2213
|
);
|
|
2171
|
-
var gameHistorySchema = new
|
|
2214
|
+
var gameHistorySchema = new MongooseSchema25(
|
|
2172
2215
|
{
|
|
2173
2216
|
createdAt: { required: true, type: Date },
|
|
2174
2217
|
gameDate: { required: true, type: schemaGameDate },
|
|
@@ -2188,7 +2231,7 @@ var gameHistorySchema = new MongooseSchema24(
|
|
|
2188
2231
|
},
|
|
2189
2232
|
{ _id: false }
|
|
2190
2233
|
);
|
|
2191
|
-
var gameTypeSchema = new
|
|
2234
|
+
var gameTypeSchema = new MongooseSchema25(
|
|
2192
2235
|
{
|
|
2193
2236
|
active: { default: true, required: true, type: Boolean },
|
|
2194
2237
|
gameData: gameDataDefinition,
|
|
@@ -2206,7 +2249,7 @@ var gameTypeSchema = new MongooseSchema24(
|
|
|
2206
2249
|
},
|
|
2207
2250
|
{ timestamps: true }
|
|
2208
2251
|
);
|
|
2209
|
-
var
|
|
2252
|
+
var schema21 = new MongooseSchema25(
|
|
2210
2253
|
{
|
|
2211
2254
|
active: { default: false, required: true, type: Boolean },
|
|
2212
2255
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2219,12 +2262,12 @@ var schema20 = new MongooseSchema24(
|
|
|
2219
2262
|
},
|
|
2220
2263
|
{ timestamps: true }
|
|
2221
2264
|
);
|
|
2222
|
-
var GameModel =
|
|
2265
|
+
var GameModel = mongoose29.models.Game || mongoose29.model("Game", schema21);
|
|
2223
2266
|
|
|
2224
2267
|
// src/mongoose/School.ts
|
|
2225
|
-
import
|
|
2226
|
-
var
|
|
2227
|
-
var campaignsSchema = new
|
|
2268
|
+
import mongoose30 from "mongoose";
|
|
2269
|
+
var MongooseSchema26 = mongoose30.Schema;
|
|
2270
|
+
var campaignsSchema = new MongooseSchema26(
|
|
2228
2271
|
{
|
|
2229
2272
|
endDate: { required: true, type: Date },
|
|
2230
2273
|
name: { required: true, type: String },
|
|
@@ -2232,7 +2275,7 @@ var campaignsSchema = new MongooseSchema25(
|
|
|
2232
2275
|
},
|
|
2233
2276
|
{ _id: false }
|
|
2234
2277
|
);
|
|
2235
|
-
var
|
|
2278
|
+
var schema22 = new MongooseSchema26(
|
|
2236
2279
|
{
|
|
2237
2280
|
// New schools are active by default
|
|
2238
2281
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2259,14 +2302,14 @@ var schema21 = new MongooseSchema25(
|
|
|
2259
2302
|
},
|
|
2260
2303
|
{ timestamps: true }
|
|
2261
2304
|
);
|
|
2262
|
-
|
|
2305
|
+
schema22.index(
|
|
2263
2306
|
{ schoolCode: 1 },
|
|
2264
2307
|
{
|
|
2265
2308
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2266
2309
|
unique: true
|
|
2267
2310
|
}
|
|
2268
2311
|
);
|
|
2269
|
-
var SchoolModel =
|
|
2312
|
+
var SchoolModel = mongoose30.models.School || mongoose30.model("School", schema22);
|
|
2270
2313
|
|
|
2271
2314
|
// src/mongoose/Affiliate.ts
|
|
2272
2315
|
import {
|
|
@@ -2274,9 +2317,9 @@ import {
|
|
|
2274
2317
|
EnumAffiliateRewardType,
|
|
2275
2318
|
EnumResourceType as EnumResourceType6
|
|
2276
2319
|
} from "@timardex/cluemart-shared";
|
|
2277
|
-
import
|
|
2278
|
-
var
|
|
2279
|
-
var affiliateRewardSchema = new
|
|
2320
|
+
import mongoose31 from "mongoose";
|
|
2321
|
+
var MongooseSchema27 = mongoose31.Schema;
|
|
2322
|
+
var affiliateRewardSchema = new MongooseSchema27(
|
|
2280
2323
|
{
|
|
2281
2324
|
createdAt: { required: true, type: Date },
|
|
2282
2325
|
redeemedAt: { default: null, required: false, type: Date },
|
|
@@ -2290,13 +2333,13 @@ var affiliateRewardSchema = new MongooseSchema26(
|
|
|
2290
2333
|
},
|
|
2291
2334
|
{ _id: false }
|
|
2292
2335
|
);
|
|
2293
|
-
var affiliateResourceSchema = new
|
|
2336
|
+
var affiliateResourceSchema = new MongooseSchema27(
|
|
2294
2337
|
{
|
|
2295
2338
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2296
2339
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2297
2340
|
resourceId: {
|
|
2298
2341
|
required: true,
|
|
2299
|
-
type:
|
|
2342
|
+
type: mongoose31.Schema.Types.ObjectId
|
|
2300
2343
|
},
|
|
2301
2344
|
resourceName: { required: true, type: String },
|
|
2302
2345
|
resourceOwner: {
|
|
@@ -2316,20 +2359,20 @@ var affiliateResourceSchema = new MongooseSchema26(
|
|
|
2316
2359
|
},
|
|
2317
2360
|
{ _id: false }
|
|
2318
2361
|
);
|
|
2319
|
-
var affiliateContactDetailsSchema = new
|
|
2362
|
+
var affiliateContactDetailsSchema = new MongooseSchema27(
|
|
2320
2363
|
{
|
|
2321
2364
|
mobilePhone: { required: true, type: String }
|
|
2322
2365
|
},
|
|
2323
2366
|
{ _id: false }
|
|
2324
2367
|
);
|
|
2325
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2368
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema27(
|
|
2326
2369
|
{
|
|
2327
2370
|
accountHolderName: { required: true, type: String },
|
|
2328
2371
|
accountNumber: { required: true, type: String }
|
|
2329
2372
|
},
|
|
2330
2373
|
{ _id: false }
|
|
2331
2374
|
);
|
|
2332
|
-
var affiliateDetailsSchema = new
|
|
2375
|
+
var affiliateDetailsSchema = new MongooseSchema27(
|
|
2333
2376
|
{
|
|
2334
2377
|
bankAccountDetails: {
|
|
2335
2378
|
required: true,
|
|
@@ -2351,7 +2394,7 @@ var affiliateDetailsSchema = new MongooseSchema26(
|
|
|
2351
2394
|
},
|
|
2352
2395
|
{ _id: false }
|
|
2353
2396
|
);
|
|
2354
|
-
var redeemHistorySchema = new
|
|
2397
|
+
var redeemHistorySchema = new MongooseSchema27(
|
|
2355
2398
|
{
|
|
2356
2399
|
paidAt: { default: null, required: false, type: Date },
|
|
2357
2400
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2359,7 +2402,7 @@ var redeemHistorySchema = new MongooseSchema26(
|
|
|
2359
2402
|
},
|
|
2360
2403
|
{ _id: false }
|
|
2361
2404
|
);
|
|
2362
|
-
var
|
|
2405
|
+
var schema23 = new MongooseSchema27(
|
|
2363
2406
|
{
|
|
2364
2407
|
active: { default: false, required: true, type: Boolean },
|
|
2365
2408
|
affiliateBonusRewards: {
|
|
@@ -2389,23 +2432,23 @@ var schema22 = new MongooseSchema26(
|
|
|
2389
2432
|
},
|
|
2390
2433
|
{ timestamps: true }
|
|
2391
2434
|
);
|
|
2392
|
-
|
|
2435
|
+
schema23.index(
|
|
2393
2436
|
{ affiliateCode: 1 },
|
|
2394
2437
|
{
|
|
2395
2438
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2396
2439
|
unique: true
|
|
2397
2440
|
}
|
|
2398
2441
|
);
|
|
2399
|
-
var AffiliateModel =
|
|
2442
|
+
var AffiliateModel = mongoose31.models.Affiliate || mongoose31.model("Affiliate", schema23);
|
|
2400
2443
|
|
|
2401
2444
|
// src/mongoose/Coupon.ts
|
|
2402
2445
|
import {
|
|
2403
2446
|
EnumCouponQualificationType,
|
|
2404
2447
|
EnumResourceType as EnumResourceType7
|
|
2405
2448
|
} from "@timardex/cluemart-shared";
|
|
2406
|
-
import
|
|
2407
|
-
var
|
|
2408
|
-
var couponOptionSchema = new
|
|
2449
|
+
import mongoose32 from "mongoose";
|
|
2450
|
+
var MongooseSchema28 = mongoose32.Schema;
|
|
2451
|
+
var couponOptionSchema = new MongooseSchema28(
|
|
2409
2452
|
{
|
|
2410
2453
|
buy: { required: false, type: Number },
|
|
2411
2454
|
get: { required: false, type: Number },
|
|
@@ -2420,29 +2463,29 @@ var couponOptionSchema = new MongooseSchema27(
|
|
|
2420
2463
|
},
|
|
2421
2464
|
{ _id: false }
|
|
2422
2465
|
);
|
|
2423
|
-
var couponVendorProductSchema = new
|
|
2466
|
+
var couponVendorProductSchema = new MongooseSchema28(
|
|
2424
2467
|
{
|
|
2425
2468
|
couponId: {
|
|
2426
2469
|
required: true,
|
|
2427
|
-
type:
|
|
2470
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2428
2471
|
},
|
|
2429
2472
|
productId: {
|
|
2430
2473
|
required: true,
|
|
2431
|
-
type:
|
|
2474
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2432
2475
|
},
|
|
2433
2476
|
vendorCouponId: {
|
|
2434
2477
|
required: false,
|
|
2435
|
-
type:
|
|
2478
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2436
2479
|
},
|
|
2437
2480
|
vendorId: {
|
|
2438
2481
|
ref: "Vendor",
|
|
2439
2482
|
required: true,
|
|
2440
|
-
type:
|
|
2483
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2441
2484
|
}
|
|
2442
2485
|
},
|
|
2443
2486
|
{ _id: false }
|
|
2444
2487
|
);
|
|
2445
|
-
var couponCodeSchema = new
|
|
2488
|
+
var couponCodeSchema = new MongooseSchema28(
|
|
2446
2489
|
{
|
|
2447
2490
|
code: { required: true, type: String },
|
|
2448
2491
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2450,7 +2493,7 @@ var couponCodeSchema = new MongooseSchema27(
|
|
|
2450
2493
|
},
|
|
2451
2494
|
{ _id: false }
|
|
2452
2495
|
);
|
|
2453
|
-
var couponParticipantUserSchema = new
|
|
2496
|
+
var couponParticipantUserSchema = new MongooseSchema28(
|
|
2454
2497
|
{
|
|
2455
2498
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2456
2499
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2459,12 +2502,12 @@ var couponParticipantUserSchema = new MongooseSchema27(
|
|
|
2459
2502
|
userId: {
|
|
2460
2503
|
ref: "User",
|
|
2461
2504
|
required: true,
|
|
2462
|
-
type:
|
|
2505
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2463
2506
|
}
|
|
2464
2507
|
},
|
|
2465
2508
|
{ timestamps: true }
|
|
2466
2509
|
);
|
|
2467
|
-
var couponDataSchema = new
|
|
2510
|
+
var couponDataSchema = new MongooseSchema28(
|
|
2468
2511
|
{
|
|
2469
2512
|
active: { default: true, required: true, type: Boolean },
|
|
2470
2513
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2491,7 +2534,7 @@ var couponDataSchema = new MongooseSchema27(
|
|
|
2491
2534
|
},
|
|
2492
2535
|
{ timestamps: true }
|
|
2493
2536
|
);
|
|
2494
|
-
var
|
|
2537
|
+
var schema24 = new MongooseSchema28(
|
|
2495
2538
|
{
|
|
2496
2539
|
active: { default: true, required: true, type: Boolean },
|
|
2497
2540
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2503,62 +2546,62 @@ var schema23 = new MongooseSchema27(
|
|
|
2503
2546
|
},
|
|
2504
2547
|
{ timestamps: true }
|
|
2505
2548
|
);
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
var CouponModel =
|
|
2549
|
+
schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2550
|
+
schema24.index({ "couponData.participantUsers.userId": 1 });
|
|
2551
|
+
var CouponModel = mongoose32.models.Coupon || mongoose32.model("Coupon", schema24);
|
|
2509
2552
|
|
|
2510
2553
|
// src/mongoose/Impersonation.ts
|
|
2511
2554
|
import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
|
|
2512
|
-
import
|
|
2513
|
-
var
|
|
2514
|
-
var impersonationSessionSchema = new
|
|
2555
|
+
import mongoose33 from "mongoose";
|
|
2556
|
+
var MongooseSchema29 = mongoose33.Schema;
|
|
2557
|
+
var impersonationSessionSchema = new MongooseSchema29(
|
|
2515
2558
|
{
|
|
2516
2559
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2517
2560
|
impersonatedUserId: {
|
|
2518
2561
|
index: true,
|
|
2519
2562
|
ref: "User",
|
|
2520
2563
|
required: true,
|
|
2521
|
-
type:
|
|
2564
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2522
2565
|
},
|
|
2523
2566
|
impersonatorUserId: {
|
|
2524
2567
|
index: true,
|
|
2525
2568
|
ref: "User",
|
|
2526
2569
|
required: true,
|
|
2527
|
-
type:
|
|
2570
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2528
2571
|
},
|
|
2529
2572
|
refreshToken: { required: true, type: String }
|
|
2530
2573
|
},
|
|
2531
2574
|
{ timestamps: true }
|
|
2532
2575
|
);
|
|
2533
|
-
var ImpersonationSessionModel =
|
|
2576
|
+
var ImpersonationSessionModel = mongoose33.models.ImpersonationSession || mongoose33.model(
|
|
2534
2577
|
"ImpersonationSession",
|
|
2535
2578
|
impersonationSessionSchema
|
|
2536
2579
|
);
|
|
2537
|
-
var impersonationAuditSchema = new
|
|
2580
|
+
var impersonationAuditSchema = new MongooseSchema29(
|
|
2538
2581
|
{
|
|
2539
2582
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2540
2583
|
endReason: { type: String },
|
|
2541
2584
|
impersonatedUserId: {
|
|
2542
2585
|
ref: "User",
|
|
2543
2586
|
required: true,
|
|
2544
|
-
type:
|
|
2587
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2545
2588
|
},
|
|
2546
2589
|
impersonatorUserId: {
|
|
2547
2590
|
ref: "User",
|
|
2548
2591
|
required: true,
|
|
2549
|
-
type:
|
|
2592
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2550
2593
|
},
|
|
2551
|
-
resourceId: { type:
|
|
2594
|
+
resourceId: { type: mongoose33.Schema.Types.ObjectId },
|
|
2552
2595
|
resourceType: { enum: Object.values(EnumResourceType8), type: String },
|
|
2553
2596
|
sessionId: {
|
|
2554
2597
|
ref: "ImpersonationSession",
|
|
2555
2598
|
required: true,
|
|
2556
|
-
type:
|
|
2599
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2557
2600
|
}
|
|
2558
2601
|
},
|
|
2559
2602
|
{ timestamps: true }
|
|
2560
2603
|
);
|
|
2561
|
-
var ImpersonationAuditModel =
|
|
2604
|
+
var ImpersonationAuditModel = mongoose33.models.ImpersonationAudit || mongoose33.model(
|
|
2562
2605
|
"ImpersonationAudit",
|
|
2563
2606
|
impersonationAuditSchema
|
|
2564
2607
|
);
|
|
@@ -3002,7 +3045,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3002
3045
|
}
|
|
3003
3046
|
|
|
3004
3047
|
// src/service/database.ts
|
|
3005
|
-
import
|
|
3048
|
+
import mongoose34 from "mongoose";
|
|
3006
3049
|
var connectToDatabase = async ({
|
|
3007
3050
|
appName,
|
|
3008
3051
|
dbName,
|
|
@@ -3015,7 +3058,7 @@ var connectToDatabase = async ({
|
|
|
3015
3058
|
// Fallback to MongoDB Atlas connection string
|
|
3016
3059
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3017
3060
|
);
|
|
3018
|
-
await
|
|
3061
|
+
await mongoose34.connect(mongoUri);
|
|
3019
3062
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3020
3063
|
console.log(
|
|
3021
3064
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3028,7 +3071,7 @@ var connectToDatabase = async ({
|
|
|
3028
3071
|
|
|
3029
3072
|
// src/types/index.ts
|
|
3030
3073
|
import express from "express";
|
|
3031
|
-
import
|
|
3074
|
+
import mongoose35 from "mongoose";
|
|
3032
3075
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
3033
3076
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
3034
3077
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3150,15 +3193,15 @@ async function updateAdStatuses() {
|
|
|
3150
3193
|
}
|
|
3151
3194
|
|
|
3152
3195
|
// src/service/objectIdToString.ts
|
|
3153
|
-
import
|
|
3196
|
+
import mongoose36 from "mongoose";
|
|
3154
3197
|
function isValidObjectId(value) {
|
|
3155
|
-
return
|
|
3198
|
+
return mongoose36.Types.ObjectId.isValid(value);
|
|
3156
3199
|
}
|
|
3157
3200
|
function convertObjectIdsToStrings(obj) {
|
|
3158
3201
|
if (obj === null || obj === void 0) {
|
|
3159
3202
|
return obj;
|
|
3160
3203
|
}
|
|
3161
|
-
if (obj instanceof
|
|
3204
|
+
if (obj instanceof mongoose36.Types.ObjectId) {
|
|
3162
3205
|
return obj.toString();
|
|
3163
3206
|
}
|
|
3164
3207
|
if (obj instanceof Date) {
|
|
@@ -4799,6 +4842,7 @@ export {
|
|
|
4799
4842
|
AdModel,
|
|
4800
4843
|
AffiliateModel,
|
|
4801
4844
|
AppSettingModel,
|
|
4845
|
+
AuthHandoffTokenModel,
|
|
4802
4846
|
BILLING_CATALOG_COLLECTION_NAME,
|
|
4803
4847
|
BillingCatalogModel,
|
|
4804
4848
|
CategorySchema,
|
|
@@ -4882,7 +4926,7 @@ export {
|
|
|
4882
4926
|
locationGeoSchema,
|
|
4883
4927
|
locationsSchema,
|
|
4884
4928
|
mapVendorLicenceToSubscriptionRewardType,
|
|
4885
|
-
|
|
4929
|
+
mongoose35 as mongoose,
|
|
4886
4930
|
normalizeAffiliatePromoCodes,
|
|
4887
4931
|
normalizePromoCode,
|
|
4888
4932
|
notifyUsers,
|