@timardex/cluemart-server-shared 2.5.1 → 3.0.0
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-YMDOR6W2.mjs} +107 -78
- package/dist/chunk-YMDOR6W2.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 +114 -84
- 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 +113 -84
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +107 -77
- 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 +111 -83
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
2
2
|
import { OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, RelationType, RelationDate, StripeSubscription, EnumBillingPeriod, EnumUserLicence, UserActivityEvent, UserType, AffiliateType, AffiliateResourceType, AffiliateRewardType } from '@timardex/cluemart-shared';
|
|
3
3
|
import mongoose__default from 'mongoose';
|
|
4
|
-
import { O as ObjectId } from './index-
|
|
4
|
+
import { O as ObjectId } from './index-BptxBl9x.mjs';
|
|
5
5
|
|
|
6
6
|
type SchemaRelatedPostType = Omit<RelatedPostType, "postId"> & {
|
|
7
7
|
postId: ObjectId;
|
|
@@ -352,6 +352,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "coupon" | "events" | "partner"
|
|
|
352
352
|
events: ObjectId[];
|
|
353
353
|
game: ObjectId;
|
|
354
354
|
partner: ObjectId;
|
|
355
|
+
/** Server-only hashed refresh tokens; never exposed to clients. */
|
|
356
|
+
refreshTokenAdmin?: string | null;
|
|
357
|
+
refreshTokenMobile?: string | null;
|
|
355
358
|
school: ObjectId;
|
|
356
359
|
stripe?: SchemaStripeSubscription;
|
|
357
360
|
vendor: ObjectId;
|
|
@@ -393,6 +396,9 @@ declare const UserModel: mongoose__default.Model<SchemaUserType, {}, {}, {}, mon
|
|
|
393
396
|
events: ObjectId[];
|
|
394
397
|
game: ObjectId;
|
|
395
398
|
partner: ObjectId;
|
|
399
|
+
/** Server-only hashed refresh tokens; never exposed to clients. */
|
|
400
|
+
refreshTokenAdmin?: string | null;
|
|
401
|
+
refreshTokenMobile?: string | null;
|
|
396
402
|
school: ObjectId;
|
|
397
403
|
stripe?: SchemaStripeSubscription;
|
|
398
404
|
vendor: ObjectId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
2
2
|
import { OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, RelationType, RelationDate, StripeSubscription, EnumBillingPeriod, EnumUserLicence, UserActivityEvent, UserType, AffiliateType, AffiliateResourceType, AffiliateRewardType } from '@timardex/cluemart-shared';
|
|
3
3
|
import mongoose__default from 'mongoose';
|
|
4
|
-
import { O as ObjectId } from './index-
|
|
4
|
+
import { O as ObjectId } from './index-BptxBl9x.js';
|
|
5
5
|
|
|
6
6
|
type SchemaRelatedPostType = Omit<RelatedPostType, "postId"> & {
|
|
7
7
|
postId: ObjectId;
|
|
@@ -352,6 +352,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "coupon" | "events" | "partner"
|
|
|
352
352
|
events: ObjectId[];
|
|
353
353
|
game: ObjectId;
|
|
354
354
|
partner: ObjectId;
|
|
355
|
+
/** Server-only hashed refresh tokens; never exposed to clients. */
|
|
356
|
+
refreshTokenAdmin?: string | null;
|
|
357
|
+
refreshTokenMobile?: string | null;
|
|
355
358
|
school: ObjectId;
|
|
356
359
|
stripe?: SchemaStripeSubscription;
|
|
357
360
|
vendor: ObjectId;
|
|
@@ -393,6 +396,9 @@ declare const UserModel: mongoose__default.Model<SchemaUserType, {}, {}, {}, mon
|
|
|
393
396
|
events: ObjectId[];
|
|
394
397
|
game: ObjectId;
|
|
395
398
|
partner: ObjectId;
|
|
399
|
+
/** Server-only hashed refresh tokens; never exposed to clients. */
|
|
400
|
+
refreshTokenAdmin?: string | null;
|
|
401
|
+
refreshTokenMobile?: string | null;
|
|
396
402
|
school: ObjectId;
|
|
397
403
|
stripe?: SchemaStripeSubscription;
|
|
398
404
|
vendor: ObjectId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts"],"sourcesContent":["import { EnumUserRole } from \"@timardex/cluemart-shared\";\nimport { NotificationCount } from \"@timardex/cluemart-shared/types\";\nimport express from \"express\";\nimport mongoose from \"mongoose\";\n\nimport { SchemaChatType } from \"../mongoose/chat/Chat\";\nimport { SchemaNotificationType } from \"../mongoose/Notification\";\n\n// chnage to export type ObjectId = mongoose.Types.ObjectId;\n// chnage in server when setting decideGameType\nexport type ObjectId = mongoose.Types.ObjectId;\n\nexport enum EnumPubSubEvents {\n GET_CHAT_MESSAGE = \"GET_CHAT_MESSAGE\",\n GET_NOTIFICATIONS = \"GET_NOTIFICATIONS\",\n GET_NOTIFICATIONS_COUNT = \"GET_NOTIFICATIONS_COUNT\",\n USER_TYPING = \"USER_TYPING\",\n}\n\n/** Clients that own their own refresh-token slot on the user document. */\nexport type AuthTokenClient = \"mobile\" | \"admin\";\n\nexport interface AuthUser {\n email: string;\n roles: EnumUserRole[];\n userId: ObjectId;\n /**\n * Which client slot this token belongs to. Absent only on tokens issued\n * before the per-client rollout; those can no longer refresh.\n */\n client?: AuthTokenClient;\n /** Set when this token represents an impersonation session. */\n impersonationSessionId?: string;\n /** The SUPER_ADMIN who started the impersonation session. */\n impersonatorUserId?: ObjectId;\n}\n\nexport interface SubscriptionPayload {\n getChatMessage?: SchemaChatType;\n userTyping?: SchemaChatType; // NOT USED\n getNotifications?: SchemaNotificationType[];\n // Used only for filtering; not part of the GraphQL schema output\n getNotificationsUserId?: ObjectId;\n getNotificationsCount?: NotificationCount & { userId: ObjectId };\n}\n\nexport interface GraphQLContext {\n appVersion: string | null;\n user: AuthUser | null;\n pubsub: {\n publish: (\n eventName: EnumPubSubEvents,\n payload: SubscriptionPayload,\n ) => void;\n subscribe: (eventName: EnumPubSubEvents) => AsyncIterable<any>;\n };\n request: express.Request;\n response: express.Response;\n}\n\nexport { mongoose, express };\n"],"mappings":";AAEA,OAAO,aAAa;AACpB,OAAO,cAAc;AASd,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,sBAAmB;AACnB,EAAAA,kBAAA,uBAAoB;AACpB,EAAAA,kBAAA,6BAA0B;AAC1B,EAAAA,kBAAA,iBAAc;AAJJ,SAAAA;AAAA,GAAA;","names":["EnumPubSubEvents"]}
|
|
@@ -903,15 +903,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
903
903
|
}
|
|
904
904
|
return null;
|
|
905
905
|
}
|
|
906
|
-
function searchNamePlugin(
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
906
|
+
function searchNamePlugin(schema25) {
|
|
907
|
+
schema25.add({ searchName: { default: "", required: false, type: String } });
|
|
908
|
+
schema25.index({ searchName: 1 });
|
|
909
|
+
schema25.pre("save", function syncSearchNameOnSave(next) {
|
|
910
910
|
const doc = this;
|
|
911
911
|
doc.searchName = deriveSearchName(doc.name);
|
|
912
912
|
next();
|
|
913
913
|
});
|
|
914
|
-
|
|
914
|
+
schema25.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
915
915
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
916
916
|
for (const doc of list) {
|
|
917
917
|
if (doc && typeof doc.name === "string") {
|
|
@@ -920,7 +920,7 @@ function searchNamePlugin(schema24) {
|
|
|
920
920
|
}
|
|
921
921
|
next();
|
|
922
922
|
});
|
|
923
|
-
|
|
923
|
+
schema25.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
924
924
|
for (const op of ops) {
|
|
925
925
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
926
926
|
if (doc && typeof doc.name === "string") {
|
|
@@ -946,7 +946,7 @@ function searchNamePlugin(schema24) {
|
|
|
946
946
|
}
|
|
947
947
|
next();
|
|
948
948
|
};
|
|
949
|
-
|
|
949
|
+
schema25.pre(
|
|
950
950
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
951
951
|
syncSearchNameOnUpdate
|
|
952
952
|
);
|
|
@@ -1558,7 +1558,15 @@ var schema11 = new MongooseSchema12(
|
|
|
1558
1558
|
required: false,
|
|
1559
1559
|
type: [redeemedRewardSchema]
|
|
1560
1560
|
},
|
|
1561
|
-
|
|
1561
|
+
// Per-client slots: a mobile session and an in-app WebView admin session
|
|
1562
|
+
// coexist without rotating each other out.
|
|
1563
|
+
refreshTokenAdmin: {
|
|
1564
|
+
default: null,
|
|
1565
|
+
required: false,
|
|
1566
|
+
type: String
|
|
1567
|
+
},
|
|
1568
|
+
refreshTokenMobile: {
|
|
1569
|
+
default: null,
|
|
1562
1570
|
required: false,
|
|
1563
1571
|
type: String
|
|
1564
1572
|
},
|
|
@@ -2057,20 +2065,40 @@ var AppSettingSchema = new MongooseSchema20(
|
|
|
2057
2065
|
);
|
|
2058
2066
|
var AppSettingModel = mongoose24.models.AppSetting || mongoose24.model("AppSetting", AppSettingSchema);
|
|
2059
2067
|
|
|
2068
|
+
// src/mongoose/AuthHandoffToken.ts
|
|
2069
|
+
import mongoose25 from "mongoose";
|
|
2070
|
+
var MongooseSchema21 = mongoose25.Schema;
|
|
2071
|
+
var schema20 = new MongooseSchema21(
|
|
2072
|
+
{
|
|
2073
|
+
expiresAt: { required: true, type: Date },
|
|
2074
|
+
jti: { index: true, required: true, type: String, unique: true },
|
|
2075
|
+
usedAt: { default: null, required: false, type: Date },
|
|
2076
|
+
userId: {
|
|
2077
|
+
index: true,
|
|
2078
|
+
ref: "User",
|
|
2079
|
+
required: true,
|
|
2080
|
+
type: mongoose25.Schema.Types.ObjectId
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
{ timestamps: true }
|
|
2084
|
+
);
|
|
2085
|
+
schema20.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2086
|
+
var AuthHandoffTokenModel = mongoose25.models.AuthHandoffToken || mongoose25.model("AuthHandoffToken", schema20);
|
|
2087
|
+
|
|
2060
2088
|
// src/mongoose/game/Game.ts
|
|
2061
2089
|
import {
|
|
2062
2090
|
EnumGameStatus,
|
|
2063
2091
|
EnumGameType
|
|
2064
2092
|
} from "@timardex/cluemart-shared";
|
|
2065
|
-
import
|
|
2093
|
+
import mongoose29 from "mongoose";
|
|
2066
2094
|
|
|
2067
2095
|
// src/mongoose/game/DailyClue.ts
|
|
2068
|
-
import
|
|
2096
|
+
import mongoose27 from "mongoose";
|
|
2069
2097
|
|
|
2070
2098
|
// src/mongoose/game/utils.ts
|
|
2071
|
-
import
|
|
2072
|
-
var
|
|
2073
|
-
var schemaGameDate = new
|
|
2099
|
+
import mongoose26 from "mongoose";
|
|
2100
|
+
var MongooseSchema22 = mongoose26.Schema;
|
|
2101
|
+
var schemaGameDate = new MongooseSchema22(
|
|
2074
2102
|
{
|
|
2075
2103
|
endDate: { required: true, type: Date },
|
|
2076
2104
|
startDate: { required: true, type: Date }
|
|
@@ -2079,8 +2107,8 @@ var schemaGameDate = new MongooseSchema21(
|
|
|
2079
2107
|
);
|
|
2080
2108
|
|
|
2081
2109
|
// src/mongoose/game/DailyClue.ts
|
|
2082
|
-
var
|
|
2083
|
-
var schemaLetters = new
|
|
2110
|
+
var MongooseSchema23 = mongoose27.Schema;
|
|
2111
|
+
var schemaLetters = new MongooseSchema23(
|
|
2084
2112
|
{
|
|
2085
2113
|
collected: { required: false, type: [String] },
|
|
2086
2114
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2088,14 +2116,14 @@ var schemaLetters = new MongooseSchema22(
|
|
|
2088
2116
|
},
|
|
2089
2117
|
{ _id: false }
|
|
2090
2118
|
);
|
|
2091
|
-
var schemaDailyClueBaseGame = new
|
|
2119
|
+
var schemaDailyClueBaseGame = new MongooseSchema23(
|
|
2092
2120
|
{
|
|
2093
2121
|
gameDate: { required: true, type: schemaGameDate },
|
|
2094
2122
|
gameSolution: { required: true, type: String }
|
|
2095
2123
|
},
|
|
2096
2124
|
{ _id: false }
|
|
2097
2125
|
);
|
|
2098
|
-
var schemaDailyClueGameData = new
|
|
2126
|
+
var schemaDailyClueGameData = new MongooseSchema23(
|
|
2099
2127
|
{
|
|
2100
2128
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2101
2129
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2110,9 +2138,9 @@ var schemaDailyClueGameData = new MongooseSchema22(
|
|
|
2110
2138
|
);
|
|
2111
2139
|
|
|
2112
2140
|
// src/mongoose/game/PuzzleGame.ts
|
|
2113
|
-
import
|
|
2114
|
-
var
|
|
2115
|
-
var schemaPuzzleAnswer = new
|
|
2141
|
+
import mongoose28 from "mongoose";
|
|
2142
|
+
var MongooseSchema24 = mongoose28.Schema;
|
|
2143
|
+
var schemaPuzzleAnswer = new MongooseSchema24(
|
|
2116
2144
|
{
|
|
2117
2145
|
answer: { required: true, type: String },
|
|
2118
2146
|
answerId: { required: true, type: String },
|
|
@@ -2120,7 +2148,7 @@ var schemaPuzzleAnswer = new MongooseSchema23(
|
|
|
2120
2148
|
},
|
|
2121
2149
|
{ _id: false }
|
|
2122
2150
|
);
|
|
2123
|
-
var schemaPuzzleQuestion = new
|
|
2151
|
+
var schemaPuzzleQuestion = new MongooseSchema24(
|
|
2124
2152
|
{
|
|
2125
2153
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2126
2154
|
question: { required: true, type: String },
|
|
@@ -2128,20 +2156,20 @@ var schemaPuzzleQuestion = new MongooseSchema23(
|
|
|
2128
2156
|
},
|
|
2129
2157
|
{ _id: false }
|
|
2130
2158
|
);
|
|
2131
|
-
var schemaPuzzleBaseGame = new
|
|
2159
|
+
var schemaPuzzleBaseGame = new MongooseSchema24(
|
|
2132
2160
|
{
|
|
2133
2161
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2134
2162
|
},
|
|
2135
2163
|
{ _id: false }
|
|
2136
2164
|
);
|
|
2137
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2165
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema24(
|
|
2138
2166
|
{
|
|
2139
2167
|
questionId: { required: true, type: String },
|
|
2140
2168
|
selectedAnswerId: { required: true, type: String }
|
|
2141
2169
|
},
|
|
2142
2170
|
{ _id: false }
|
|
2143
2171
|
);
|
|
2144
|
-
var schemaPuzzleGameData = new
|
|
2172
|
+
var schemaPuzzleGameData = new MongooseSchema24(
|
|
2145
2173
|
{
|
|
2146
2174
|
answeredQuestions: {
|
|
2147
2175
|
default: null,
|
|
@@ -2156,19 +2184,19 @@ var schemaPuzzleGameData = new MongooseSchema23(
|
|
|
2156
2184
|
);
|
|
2157
2185
|
|
|
2158
2186
|
// src/mongoose/game/Game.ts
|
|
2159
|
-
var
|
|
2187
|
+
var MongooseSchema25 = mongoose29.Schema;
|
|
2160
2188
|
var gameDataSchemas = {
|
|
2161
2189
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2162
2190
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2163
2191
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2164
2192
|
};
|
|
2165
2193
|
var gameDataDefinition = Object.fromEntries(
|
|
2166
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2194
|
+
Object.entries(gameDataSchemas).map(([key, schema25]) => [
|
|
2167
2195
|
key,
|
|
2168
|
-
{ default: null, required: false, type:
|
|
2196
|
+
{ default: null, required: false, type: schema25 }
|
|
2169
2197
|
])
|
|
2170
2198
|
);
|
|
2171
|
-
var gameHistorySchema = new
|
|
2199
|
+
var gameHistorySchema = new MongooseSchema25(
|
|
2172
2200
|
{
|
|
2173
2201
|
createdAt: { required: true, type: Date },
|
|
2174
2202
|
gameDate: { required: true, type: schemaGameDate },
|
|
@@ -2188,7 +2216,7 @@ var gameHistorySchema = new MongooseSchema24(
|
|
|
2188
2216
|
},
|
|
2189
2217
|
{ _id: false }
|
|
2190
2218
|
);
|
|
2191
|
-
var gameTypeSchema = new
|
|
2219
|
+
var gameTypeSchema = new MongooseSchema25(
|
|
2192
2220
|
{
|
|
2193
2221
|
active: { default: true, required: true, type: Boolean },
|
|
2194
2222
|
gameData: gameDataDefinition,
|
|
@@ -2206,7 +2234,7 @@ var gameTypeSchema = new MongooseSchema24(
|
|
|
2206
2234
|
},
|
|
2207
2235
|
{ timestamps: true }
|
|
2208
2236
|
);
|
|
2209
|
-
var
|
|
2237
|
+
var schema21 = new MongooseSchema25(
|
|
2210
2238
|
{
|
|
2211
2239
|
active: { default: false, required: true, type: Boolean },
|
|
2212
2240
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2219,12 +2247,12 @@ var schema20 = new MongooseSchema24(
|
|
|
2219
2247
|
},
|
|
2220
2248
|
{ timestamps: true }
|
|
2221
2249
|
);
|
|
2222
|
-
var GameModel =
|
|
2250
|
+
var GameModel = mongoose29.models.Game || mongoose29.model("Game", schema21);
|
|
2223
2251
|
|
|
2224
2252
|
// src/mongoose/School.ts
|
|
2225
|
-
import
|
|
2226
|
-
var
|
|
2227
|
-
var campaignsSchema = new
|
|
2253
|
+
import mongoose30 from "mongoose";
|
|
2254
|
+
var MongooseSchema26 = mongoose30.Schema;
|
|
2255
|
+
var campaignsSchema = new MongooseSchema26(
|
|
2228
2256
|
{
|
|
2229
2257
|
endDate: { required: true, type: Date },
|
|
2230
2258
|
name: { required: true, type: String },
|
|
@@ -2232,7 +2260,7 @@ var campaignsSchema = new MongooseSchema25(
|
|
|
2232
2260
|
},
|
|
2233
2261
|
{ _id: false }
|
|
2234
2262
|
);
|
|
2235
|
-
var
|
|
2263
|
+
var schema22 = new MongooseSchema26(
|
|
2236
2264
|
{
|
|
2237
2265
|
// New schools are active by default
|
|
2238
2266
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2259,14 +2287,14 @@ var schema21 = new MongooseSchema25(
|
|
|
2259
2287
|
},
|
|
2260
2288
|
{ timestamps: true }
|
|
2261
2289
|
);
|
|
2262
|
-
|
|
2290
|
+
schema22.index(
|
|
2263
2291
|
{ schoolCode: 1 },
|
|
2264
2292
|
{
|
|
2265
2293
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2266
2294
|
unique: true
|
|
2267
2295
|
}
|
|
2268
2296
|
);
|
|
2269
|
-
var SchoolModel =
|
|
2297
|
+
var SchoolModel = mongoose30.models.School || mongoose30.model("School", schema22);
|
|
2270
2298
|
|
|
2271
2299
|
// src/mongoose/Affiliate.ts
|
|
2272
2300
|
import {
|
|
@@ -2274,9 +2302,9 @@ import {
|
|
|
2274
2302
|
EnumAffiliateRewardType,
|
|
2275
2303
|
EnumResourceType as EnumResourceType6
|
|
2276
2304
|
} from "@timardex/cluemart-shared";
|
|
2277
|
-
import
|
|
2278
|
-
var
|
|
2279
|
-
var affiliateRewardSchema = new
|
|
2305
|
+
import mongoose31 from "mongoose";
|
|
2306
|
+
var MongooseSchema27 = mongoose31.Schema;
|
|
2307
|
+
var affiliateRewardSchema = new MongooseSchema27(
|
|
2280
2308
|
{
|
|
2281
2309
|
createdAt: { required: true, type: Date },
|
|
2282
2310
|
redeemedAt: { default: null, required: false, type: Date },
|
|
@@ -2290,13 +2318,13 @@ var affiliateRewardSchema = new MongooseSchema26(
|
|
|
2290
2318
|
},
|
|
2291
2319
|
{ _id: false }
|
|
2292
2320
|
);
|
|
2293
|
-
var affiliateResourceSchema = new
|
|
2321
|
+
var affiliateResourceSchema = new MongooseSchema27(
|
|
2294
2322
|
{
|
|
2295
2323
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2296
2324
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2297
2325
|
resourceId: {
|
|
2298
2326
|
required: true,
|
|
2299
|
-
type:
|
|
2327
|
+
type: mongoose31.Schema.Types.ObjectId
|
|
2300
2328
|
},
|
|
2301
2329
|
resourceName: { required: true, type: String },
|
|
2302
2330
|
resourceOwner: {
|
|
@@ -2316,20 +2344,20 @@ var affiliateResourceSchema = new MongooseSchema26(
|
|
|
2316
2344
|
},
|
|
2317
2345
|
{ _id: false }
|
|
2318
2346
|
);
|
|
2319
|
-
var affiliateContactDetailsSchema = new
|
|
2347
|
+
var affiliateContactDetailsSchema = new MongooseSchema27(
|
|
2320
2348
|
{
|
|
2321
2349
|
mobilePhone: { required: true, type: String }
|
|
2322
2350
|
},
|
|
2323
2351
|
{ _id: false }
|
|
2324
2352
|
);
|
|
2325
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2353
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema27(
|
|
2326
2354
|
{
|
|
2327
2355
|
accountHolderName: { required: true, type: String },
|
|
2328
2356
|
accountNumber: { required: true, type: String }
|
|
2329
2357
|
},
|
|
2330
2358
|
{ _id: false }
|
|
2331
2359
|
);
|
|
2332
|
-
var affiliateDetailsSchema = new
|
|
2360
|
+
var affiliateDetailsSchema = new MongooseSchema27(
|
|
2333
2361
|
{
|
|
2334
2362
|
bankAccountDetails: {
|
|
2335
2363
|
required: true,
|
|
@@ -2351,7 +2379,7 @@ var affiliateDetailsSchema = new MongooseSchema26(
|
|
|
2351
2379
|
},
|
|
2352
2380
|
{ _id: false }
|
|
2353
2381
|
);
|
|
2354
|
-
var redeemHistorySchema = new
|
|
2382
|
+
var redeemHistorySchema = new MongooseSchema27(
|
|
2355
2383
|
{
|
|
2356
2384
|
paidAt: { default: null, required: false, type: Date },
|
|
2357
2385
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2359,7 +2387,7 @@ var redeemHistorySchema = new MongooseSchema26(
|
|
|
2359
2387
|
},
|
|
2360
2388
|
{ _id: false }
|
|
2361
2389
|
);
|
|
2362
|
-
var
|
|
2390
|
+
var schema23 = new MongooseSchema27(
|
|
2363
2391
|
{
|
|
2364
2392
|
active: { default: false, required: true, type: Boolean },
|
|
2365
2393
|
affiliateBonusRewards: {
|
|
@@ -2389,23 +2417,23 @@ var schema22 = new MongooseSchema26(
|
|
|
2389
2417
|
},
|
|
2390
2418
|
{ timestamps: true }
|
|
2391
2419
|
);
|
|
2392
|
-
|
|
2420
|
+
schema23.index(
|
|
2393
2421
|
{ affiliateCode: 1 },
|
|
2394
2422
|
{
|
|
2395
2423
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2396
2424
|
unique: true
|
|
2397
2425
|
}
|
|
2398
2426
|
);
|
|
2399
|
-
var AffiliateModel =
|
|
2427
|
+
var AffiliateModel = mongoose31.models.Affiliate || mongoose31.model("Affiliate", schema23);
|
|
2400
2428
|
|
|
2401
2429
|
// src/mongoose/Coupon.ts
|
|
2402
2430
|
import {
|
|
2403
2431
|
EnumCouponQualificationType,
|
|
2404
2432
|
EnumResourceType as EnumResourceType7
|
|
2405
2433
|
} from "@timardex/cluemart-shared";
|
|
2406
|
-
import
|
|
2407
|
-
var
|
|
2408
|
-
var couponOptionSchema = new
|
|
2434
|
+
import mongoose32 from "mongoose";
|
|
2435
|
+
var MongooseSchema28 = mongoose32.Schema;
|
|
2436
|
+
var couponOptionSchema = new MongooseSchema28(
|
|
2409
2437
|
{
|
|
2410
2438
|
buy: { required: false, type: Number },
|
|
2411
2439
|
get: { required: false, type: Number },
|
|
@@ -2420,29 +2448,29 @@ var couponOptionSchema = new MongooseSchema27(
|
|
|
2420
2448
|
},
|
|
2421
2449
|
{ _id: false }
|
|
2422
2450
|
);
|
|
2423
|
-
var couponVendorProductSchema = new
|
|
2451
|
+
var couponVendorProductSchema = new MongooseSchema28(
|
|
2424
2452
|
{
|
|
2425
2453
|
couponId: {
|
|
2426
2454
|
required: true,
|
|
2427
|
-
type:
|
|
2455
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2428
2456
|
},
|
|
2429
2457
|
productId: {
|
|
2430
2458
|
required: true,
|
|
2431
|
-
type:
|
|
2459
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2432
2460
|
},
|
|
2433
2461
|
vendorCouponId: {
|
|
2434
2462
|
required: false,
|
|
2435
|
-
type:
|
|
2463
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2436
2464
|
},
|
|
2437
2465
|
vendorId: {
|
|
2438
2466
|
ref: "Vendor",
|
|
2439
2467
|
required: true,
|
|
2440
|
-
type:
|
|
2468
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2441
2469
|
}
|
|
2442
2470
|
},
|
|
2443
2471
|
{ _id: false }
|
|
2444
2472
|
);
|
|
2445
|
-
var couponCodeSchema = new
|
|
2473
|
+
var couponCodeSchema = new MongooseSchema28(
|
|
2446
2474
|
{
|
|
2447
2475
|
code: { required: true, type: String },
|
|
2448
2476
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2450,7 +2478,7 @@ var couponCodeSchema = new MongooseSchema27(
|
|
|
2450
2478
|
},
|
|
2451
2479
|
{ _id: false }
|
|
2452
2480
|
);
|
|
2453
|
-
var couponParticipantUserSchema = new
|
|
2481
|
+
var couponParticipantUserSchema = new MongooseSchema28(
|
|
2454
2482
|
{
|
|
2455
2483
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2456
2484
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2459,12 +2487,12 @@ var couponParticipantUserSchema = new MongooseSchema27(
|
|
|
2459
2487
|
userId: {
|
|
2460
2488
|
ref: "User",
|
|
2461
2489
|
required: true,
|
|
2462
|
-
type:
|
|
2490
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2463
2491
|
}
|
|
2464
2492
|
},
|
|
2465
2493
|
{ timestamps: true }
|
|
2466
2494
|
);
|
|
2467
|
-
var couponDataSchema = new
|
|
2495
|
+
var couponDataSchema = new MongooseSchema28(
|
|
2468
2496
|
{
|
|
2469
2497
|
active: { default: true, required: true, type: Boolean },
|
|
2470
2498
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2491,7 +2519,7 @@ var couponDataSchema = new MongooseSchema27(
|
|
|
2491
2519
|
},
|
|
2492
2520
|
{ timestamps: true }
|
|
2493
2521
|
);
|
|
2494
|
-
var
|
|
2522
|
+
var schema24 = new MongooseSchema28(
|
|
2495
2523
|
{
|
|
2496
2524
|
active: { default: true, required: true, type: Boolean },
|
|
2497
2525
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2503,62 +2531,62 @@ var schema23 = new MongooseSchema27(
|
|
|
2503
2531
|
},
|
|
2504
2532
|
{ timestamps: true }
|
|
2505
2533
|
);
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
var CouponModel =
|
|
2534
|
+
schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2535
|
+
schema24.index({ "couponData.participantUsers.userId": 1 });
|
|
2536
|
+
var CouponModel = mongoose32.models.Coupon || mongoose32.model("Coupon", schema24);
|
|
2509
2537
|
|
|
2510
2538
|
// src/mongoose/Impersonation.ts
|
|
2511
2539
|
import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
|
|
2512
|
-
import
|
|
2513
|
-
var
|
|
2514
|
-
var impersonationSessionSchema = new
|
|
2540
|
+
import mongoose33 from "mongoose";
|
|
2541
|
+
var MongooseSchema29 = mongoose33.Schema;
|
|
2542
|
+
var impersonationSessionSchema = new MongooseSchema29(
|
|
2515
2543
|
{
|
|
2516
2544
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2517
2545
|
impersonatedUserId: {
|
|
2518
2546
|
index: true,
|
|
2519
2547
|
ref: "User",
|
|
2520
2548
|
required: true,
|
|
2521
|
-
type:
|
|
2549
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2522
2550
|
},
|
|
2523
2551
|
impersonatorUserId: {
|
|
2524
2552
|
index: true,
|
|
2525
2553
|
ref: "User",
|
|
2526
2554
|
required: true,
|
|
2527
|
-
type:
|
|
2555
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2528
2556
|
},
|
|
2529
2557
|
refreshToken: { required: true, type: String }
|
|
2530
2558
|
},
|
|
2531
2559
|
{ timestamps: true }
|
|
2532
2560
|
);
|
|
2533
|
-
var ImpersonationSessionModel =
|
|
2561
|
+
var ImpersonationSessionModel = mongoose33.models.ImpersonationSession || mongoose33.model(
|
|
2534
2562
|
"ImpersonationSession",
|
|
2535
2563
|
impersonationSessionSchema
|
|
2536
2564
|
);
|
|
2537
|
-
var impersonationAuditSchema = new
|
|
2565
|
+
var impersonationAuditSchema = new MongooseSchema29(
|
|
2538
2566
|
{
|
|
2539
2567
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2540
2568
|
endReason: { type: String },
|
|
2541
2569
|
impersonatedUserId: {
|
|
2542
2570
|
ref: "User",
|
|
2543
2571
|
required: true,
|
|
2544
|
-
type:
|
|
2572
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2545
2573
|
},
|
|
2546
2574
|
impersonatorUserId: {
|
|
2547
2575
|
ref: "User",
|
|
2548
2576
|
required: true,
|
|
2549
|
-
type:
|
|
2577
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2550
2578
|
},
|
|
2551
|
-
resourceId: { type:
|
|
2579
|
+
resourceId: { type: mongoose33.Schema.Types.ObjectId },
|
|
2552
2580
|
resourceType: { enum: Object.values(EnumResourceType8), type: String },
|
|
2553
2581
|
sessionId: {
|
|
2554
2582
|
ref: "ImpersonationSession",
|
|
2555
2583
|
required: true,
|
|
2556
|
-
type:
|
|
2584
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2557
2585
|
}
|
|
2558
2586
|
},
|
|
2559
2587
|
{ timestamps: true }
|
|
2560
2588
|
);
|
|
2561
|
-
var ImpersonationAuditModel =
|
|
2589
|
+
var ImpersonationAuditModel = mongoose33.models.ImpersonationAudit || mongoose33.model(
|
|
2562
2590
|
"ImpersonationAudit",
|
|
2563
2591
|
impersonationAuditSchema
|
|
2564
2592
|
);
|
|
@@ -2611,6 +2639,7 @@ export {
|
|
|
2611
2639
|
PostModel,
|
|
2612
2640
|
APP_SETTINGS_ID,
|
|
2613
2641
|
AppSettingModel,
|
|
2642
|
+
AuthHandoffTokenModel,
|
|
2614
2643
|
GameModel,
|
|
2615
2644
|
SchoolModel,
|
|
2616
2645
|
AffiliateModel,
|
|
@@ -2618,4 +2647,4 @@ export {
|
|
|
2618
2647
|
ImpersonationSessionModel,
|
|
2619
2648
|
ImpersonationAuditModel
|
|
2620
2649
|
};
|
|
2621
|
-
//# sourceMappingURL=chunk-
|
|
2650
|
+
//# sourceMappingURL=chunk-YMDOR6W2.mjs.map
|