@timardex/cluemart-server-shared 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-IICIHY26.mjs +2258 -0
- package/dist/chunk-IICIHY26.mjs.map +1 -0
- package/dist/index.cjs +2032 -10039
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.mjs +1989 -9918
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +214 -6896
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -2
- package/dist/service/index.cjs +2033 -10002
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +5 -2
- package/dist/service/index.d.ts +5 -2
- package/dist/service/index.mjs +146 -1346
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.mjs +0 -1
- package/package.json +5 -2
- package/dist/chunk-3QS3WKRC.mjs +0 -31
- package/dist/chunk-3QS3WKRC.mjs.map +0 -1
- package/dist/chunk-EGUFWI7R.mjs +0 -9005
- package/dist/chunk-EGUFWI7R.mjs.map +0 -1
|
@@ -0,0 +1,2258 @@
|
|
|
1
|
+
// src/mongoose/Ad.ts
|
|
2
|
+
import {
|
|
3
|
+
EnumAdShowOn,
|
|
4
|
+
EnumAdStatus,
|
|
5
|
+
EnumAdStyle,
|
|
6
|
+
EnumAdType,
|
|
7
|
+
EnumResourceType
|
|
8
|
+
} from "@timardex/cluemart-shared";
|
|
9
|
+
import mongoose from "mongoose";
|
|
10
|
+
var MongooseSchema = mongoose.Schema;
|
|
11
|
+
var schemaAdresource = new MongooseSchema({
|
|
12
|
+
adDescription: { required: true, type: String },
|
|
13
|
+
adImage: { required: true, type: String },
|
|
14
|
+
adStyle: {
|
|
15
|
+
default: EnumAdStyle.BLOOM,
|
|
16
|
+
enum: Object.values(EnumAdStyle),
|
|
17
|
+
required: true,
|
|
18
|
+
type: String
|
|
19
|
+
},
|
|
20
|
+
adTitle: { required: true, type: String },
|
|
21
|
+
adType: {
|
|
22
|
+
default: EnumAdType.SPONSORED,
|
|
23
|
+
enum: Object.values(EnumAdType),
|
|
24
|
+
required: true,
|
|
25
|
+
type: String
|
|
26
|
+
},
|
|
27
|
+
resourceId: { required: true, type: String },
|
|
28
|
+
resourceName: { required: true, type: String },
|
|
29
|
+
resourceRegion: { required: true, type: String },
|
|
30
|
+
resourceSlug: { required: true, type: String },
|
|
31
|
+
resourceType: {
|
|
32
|
+
enum: Object.values(EnumResourceType),
|
|
33
|
+
required: true,
|
|
34
|
+
type: String
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var schema = new MongooseSchema(
|
|
38
|
+
{
|
|
39
|
+
active: { default: true, type: Boolean },
|
|
40
|
+
clicks: { default: 0, required: true, type: Number },
|
|
41
|
+
end: { required: true, type: Date },
|
|
42
|
+
impressions: { default: 0, required: true, type: Number },
|
|
43
|
+
resource: { required: true, type: schemaAdresource },
|
|
44
|
+
showOn: {
|
|
45
|
+
default: [EnumAdShowOn.FRONT_PAGE],
|
|
46
|
+
enum: Object.values(EnumAdShowOn),
|
|
47
|
+
required: true,
|
|
48
|
+
type: [String]
|
|
49
|
+
},
|
|
50
|
+
start: { required: true, type: Date },
|
|
51
|
+
status: {
|
|
52
|
+
default: EnumAdStatus.ACTIVE,
|
|
53
|
+
enum: Object.values(EnumAdStatus),
|
|
54
|
+
required: true,
|
|
55
|
+
type: String
|
|
56
|
+
},
|
|
57
|
+
targetRegion: { required: false, type: [String] }
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
timestamps: true
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
schema.index({
|
|
64
|
+
end: 1,
|
|
65
|
+
start: 1,
|
|
66
|
+
status: 1
|
|
67
|
+
});
|
|
68
|
+
schema.index({
|
|
69
|
+
status: 1,
|
|
70
|
+
targetRegion: 1,
|
|
71
|
+
// eslint-disable-next-line sort-keys
|
|
72
|
+
start: -1
|
|
73
|
+
});
|
|
74
|
+
var AdModel = mongoose.models.Ad || mongoose.model("Ad", schema);
|
|
75
|
+
|
|
76
|
+
// src/mongoose/BillingCatalog.ts
|
|
77
|
+
import {
|
|
78
|
+
BILLING_CATALOG_CURRENCY,
|
|
79
|
+
BILLING_CATALOG_DEFINITIONS,
|
|
80
|
+
BILLING_CATALOG_KEYS,
|
|
81
|
+
billingCatalogDefinitionMatches,
|
|
82
|
+
EnumBillingPeriod,
|
|
83
|
+
EnumUserLicence,
|
|
84
|
+
INITIAL_BILLING_CATALOG
|
|
85
|
+
} from "@timardex/cluemart-shared";
|
|
86
|
+
import mongoose2 from "mongoose";
|
|
87
|
+
var MongooseSchema2 = mongoose2.Schema;
|
|
88
|
+
var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
|
|
89
|
+
var paidVendorLicences = [
|
|
90
|
+
EnumUserLicence.PRO_VENDOR,
|
|
91
|
+
EnumUserLicence.PRO_PLUS_VENDOR
|
|
92
|
+
];
|
|
93
|
+
var supportedBillingPeriods = [
|
|
94
|
+
EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,
|
|
95
|
+
EnumBillingPeriod.YEARLY_ANNUAL_BILLED
|
|
96
|
+
];
|
|
97
|
+
var unitAmountField = {
|
|
98
|
+
min: 1,
|
|
99
|
+
required: true,
|
|
100
|
+
type: Number,
|
|
101
|
+
validate: {
|
|
102
|
+
message: "Billing catalogue price must be a positive integer.",
|
|
103
|
+
validator: Number.isInteger
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var currencyField = {
|
|
107
|
+
default: BILLING_CATALOG_CURRENCY,
|
|
108
|
+
enum: [BILLING_CATALOG_CURRENCY],
|
|
109
|
+
immutable: true,
|
|
110
|
+
lowercase: true,
|
|
111
|
+
required: true,
|
|
112
|
+
trim: true,
|
|
113
|
+
type: String
|
|
114
|
+
};
|
|
115
|
+
var stripePriceIdField = {
|
|
116
|
+
default: null,
|
|
117
|
+
required: false,
|
|
118
|
+
trim: true,
|
|
119
|
+
type: String
|
|
120
|
+
};
|
|
121
|
+
var stripeProductIdField = {
|
|
122
|
+
default: null,
|
|
123
|
+
required: false,
|
|
124
|
+
trim: true,
|
|
125
|
+
type: String
|
|
126
|
+
};
|
|
127
|
+
var priceHistorySchema = new MongooseSchema2(
|
|
128
|
+
{
|
|
129
|
+
changedAt: { required: true, type: Date },
|
|
130
|
+
changedBy: {
|
|
131
|
+
default: null,
|
|
132
|
+
ref: "User",
|
|
133
|
+
required: false,
|
|
134
|
+
type: mongoose2.Schema.Types.ObjectId
|
|
135
|
+
},
|
|
136
|
+
currency: currencyField,
|
|
137
|
+
effectiveFrom: { required: true, type: Date },
|
|
138
|
+
effectiveTo: { required: true, type: Date },
|
|
139
|
+
stripePriceId: stripePriceIdField,
|
|
140
|
+
stripeProductId: stripeProductIdField,
|
|
141
|
+
unitAmount: unitAmountField
|
|
142
|
+
},
|
|
143
|
+
{ _id: false }
|
|
144
|
+
);
|
|
145
|
+
var schema2 = new MongooseSchema2(
|
|
146
|
+
{
|
|
147
|
+
active: { default: true, required: true, type: Boolean },
|
|
148
|
+
billingPeriod: {
|
|
149
|
+
enum: supportedBillingPeriods,
|
|
150
|
+
immutable: true,
|
|
151
|
+
required: true,
|
|
152
|
+
type: String
|
|
153
|
+
},
|
|
154
|
+
currency: currencyField,
|
|
155
|
+
effectiveFrom: { default: Date.now, required: true, type: Date },
|
|
156
|
+
key: {
|
|
157
|
+
enum: BILLING_CATALOG_KEYS,
|
|
158
|
+
immutable: true,
|
|
159
|
+
required: true,
|
|
160
|
+
type: String,
|
|
161
|
+
unique: true
|
|
162
|
+
},
|
|
163
|
+
licenceType: {
|
|
164
|
+
enum: paidVendorLicences,
|
|
165
|
+
immutable: true,
|
|
166
|
+
required: true,
|
|
167
|
+
type: String
|
|
168
|
+
},
|
|
169
|
+
priceHistory: {
|
|
170
|
+
default: [],
|
|
171
|
+
required: true,
|
|
172
|
+
type: [priceHistorySchema]
|
|
173
|
+
},
|
|
174
|
+
revision: {
|
|
175
|
+
default: 1,
|
|
176
|
+
min: 1,
|
|
177
|
+
required: true,
|
|
178
|
+
type: Number,
|
|
179
|
+
validate: {
|
|
180
|
+
message: "Billing catalogue revision must be a positive integer.",
|
|
181
|
+
validator: Number.isInteger
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
stripePriceId: stripePriceIdField,
|
|
185
|
+
stripeProductId: stripeProductIdField,
|
|
186
|
+
taxInclusive: {
|
|
187
|
+
default: true,
|
|
188
|
+
immutable: true,
|
|
189
|
+
required: true,
|
|
190
|
+
type: Boolean,
|
|
191
|
+
validate: {
|
|
192
|
+
message: "Billing catalogue prices must include GST.",
|
|
193
|
+
validator: (value) => value === true
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
unitAmount: unitAmountField,
|
|
197
|
+
updatedBy: {
|
|
198
|
+
default: null,
|
|
199
|
+
ref: "User",
|
|
200
|
+
required: false,
|
|
201
|
+
type: mongoose2.Schema.Types.ObjectId
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
collection: BILLING_CATALOG_COLLECTION_NAME,
|
|
206
|
+
strict: true,
|
|
207
|
+
timestamps: true
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
schema2.pre("validate", function validateDefinition() {
|
|
211
|
+
if (!billingCatalogDefinitionMatches(this)) {
|
|
212
|
+
this.invalidate(
|
|
213
|
+
"key",
|
|
214
|
+
"Billing catalogue key does not match its licence and billing period."
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
schema2.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
|
|
219
|
+
schema2.index({ active: 1, licenceType: 1 });
|
|
220
|
+
schema2.index(
|
|
221
|
+
{ stripePriceId: 1 },
|
|
222
|
+
{
|
|
223
|
+
partialFilterExpression: { stripePriceId: { $type: "string" } },
|
|
224
|
+
unique: true
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
var BillingCatalogModel = mongoose2.models.BillingCatalogEntry || mongoose2.model(
|
|
228
|
+
"BillingCatalogEntry",
|
|
229
|
+
schema2,
|
|
230
|
+
BILLING_CATALOG_COLLECTION_NAME
|
|
231
|
+
);
|
|
232
|
+
function buildInitialBillingCatalogEntries(now = /* @__PURE__ */ new Date()) {
|
|
233
|
+
return INITIAL_BILLING_CATALOG.map((entry) => ({
|
|
234
|
+
active: entry.active,
|
|
235
|
+
billingPeriod: entry.billingPeriod,
|
|
236
|
+
currency: entry.currency,
|
|
237
|
+
effectiveFrom: new Date(now.getTime()),
|
|
238
|
+
key: entry.key,
|
|
239
|
+
licenceType: entry.licenceType,
|
|
240
|
+
priceHistory: [],
|
|
241
|
+
revision: 1,
|
|
242
|
+
stripePriceId: null,
|
|
243
|
+
stripeProductId: null,
|
|
244
|
+
taxInclusive: entry.taxInclusive,
|
|
245
|
+
unitAmount: entry.unitAmount,
|
|
246
|
+
updatedBy: null
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
function getBillingCatalogDefinition(key) {
|
|
250
|
+
return BILLING_CATALOG_DEFINITIONS[key];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// src/mongoose/chat/Chat.ts
|
|
254
|
+
import {
|
|
255
|
+
EnumChatType
|
|
256
|
+
} from "@timardex/cluemart-shared";
|
|
257
|
+
import mongoose3 from "mongoose";
|
|
258
|
+
var MongooseSchema3 = mongoose3.Schema;
|
|
259
|
+
var MessageReplyPreviewSchema = new MongooseSchema3(
|
|
260
|
+
{
|
|
261
|
+
contentPreview: { required: true, type: String },
|
|
262
|
+
senderId: {
|
|
263
|
+
ref: "User",
|
|
264
|
+
required: true,
|
|
265
|
+
type: mongoose3.Schema.Types.ObjectId
|
|
266
|
+
},
|
|
267
|
+
senderName: { required: true, type: String }
|
|
268
|
+
},
|
|
269
|
+
{ _id: false }
|
|
270
|
+
);
|
|
271
|
+
var MessageReactionSchema = new MongooseSchema3(
|
|
272
|
+
{
|
|
273
|
+
createdAt: { required: true, type: Date },
|
|
274
|
+
userId: {
|
|
275
|
+
ref: "User",
|
|
276
|
+
required: true,
|
|
277
|
+
type: mongoose3.Schema.Types.ObjectId
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{ _id: false }
|
|
281
|
+
);
|
|
282
|
+
var MessageSeenSchema = new MongooseSchema3(
|
|
283
|
+
{
|
|
284
|
+
seenAt: { required: true, type: Date },
|
|
285
|
+
userId: {
|
|
286
|
+
ref: "User",
|
|
287
|
+
required: true,
|
|
288
|
+
type: mongoose3.Schema.Types.ObjectId
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{ _id: false }
|
|
292
|
+
);
|
|
293
|
+
var MessageSchema = new MongooseSchema3(
|
|
294
|
+
{
|
|
295
|
+
content: { required: true, type: String },
|
|
296
|
+
likedBy: { default: [], required: false, type: [MessageReactionSchema] },
|
|
297
|
+
replyPreview: {
|
|
298
|
+
required: false,
|
|
299
|
+
type: MessageReplyPreviewSchema
|
|
300
|
+
},
|
|
301
|
+
replyToMessageId: {
|
|
302
|
+
ref: "Chat.messages",
|
|
303
|
+
required: false,
|
|
304
|
+
type: mongoose3.Schema.Types.ObjectId
|
|
305
|
+
},
|
|
306
|
+
seenBy: { default: [], required: false, type: [MessageSeenSchema] },
|
|
307
|
+
senderId: {
|
|
308
|
+
ref: "User",
|
|
309
|
+
required: true,
|
|
310
|
+
type: mongoose3.Schema.Types.ObjectId
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{ timestamps: true }
|
|
314
|
+
);
|
|
315
|
+
var ParticipantSchema = new MongooseSchema3(
|
|
316
|
+
{
|
|
317
|
+
active: { default: true, required: true, type: Boolean },
|
|
318
|
+
userAvatar: { required: false, type: String },
|
|
319
|
+
userEmail: { required: true, type: String },
|
|
320
|
+
userId: {
|
|
321
|
+
ref: "User",
|
|
322
|
+
required: true,
|
|
323
|
+
type: mongoose3.Schema.Types.ObjectId
|
|
324
|
+
},
|
|
325
|
+
userName: { required: true, type: String }
|
|
326
|
+
},
|
|
327
|
+
{ _id: false }
|
|
328
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
329
|
+
);
|
|
330
|
+
var ChatSchema = new MongooseSchema3(
|
|
331
|
+
{
|
|
332
|
+
active: { default: true, required: true, type: Boolean },
|
|
333
|
+
chatDescription: { required: false, type: String },
|
|
334
|
+
chatName: { required: true, type: String },
|
|
335
|
+
chatType: {
|
|
336
|
+
enum: Object.values(EnumChatType),
|
|
337
|
+
required: true,
|
|
338
|
+
type: String
|
|
339
|
+
},
|
|
340
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
341
|
+
messages: [MessageSchema],
|
|
342
|
+
participants: [ParticipantSchema],
|
|
343
|
+
region: { default: null, required: false, type: String }
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
timestamps: true
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
ChatSchema.index({
|
|
350
|
+
"participants.active": 1,
|
|
351
|
+
"participants.userId": 1,
|
|
352
|
+
updatedAt: -1
|
|
353
|
+
});
|
|
354
|
+
var ChatModel = mongoose3.models.Chat || mongoose3.model("Chat", ChatSchema);
|
|
355
|
+
|
|
356
|
+
// src/mongoose/chat/ChatReport.ts
|
|
357
|
+
import {
|
|
358
|
+
EnumChatReportReason
|
|
359
|
+
} from "@timardex/cluemart-shared";
|
|
360
|
+
import mongoose4 from "mongoose";
|
|
361
|
+
var MongooseSchema4 = mongoose4.Schema;
|
|
362
|
+
var ReasonSchema = new MongooseSchema4(
|
|
363
|
+
{
|
|
364
|
+
details: { default: null, required: false, type: String },
|
|
365
|
+
reasonType: {
|
|
366
|
+
enum: Object.values(EnumChatReportReason),
|
|
367
|
+
required: true,
|
|
368
|
+
type: String
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
{ _id: false }
|
|
372
|
+
);
|
|
373
|
+
var ChatReportSchema = new MongooseSchema4(
|
|
374
|
+
{
|
|
375
|
+
chatId: {
|
|
376
|
+
ref: "Chat",
|
|
377
|
+
required: true,
|
|
378
|
+
type: mongoose4.Schema.Types.ObjectId
|
|
379
|
+
},
|
|
380
|
+
reason: { required: true, type: ReasonSchema },
|
|
381
|
+
reportedUserId: {
|
|
382
|
+
ref: "User",
|
|
383
|
+
required: true,
|
|
384
|
+
type: mongoose4.Schema.Types.ObjectId
|
|
385
|
+
},
|
|
386
|
+
reporterUserId: {
|
|
387
|
+
ref: "User",
|
|
388
|
+
required: true,
|
|
389
|
+
type: mongoose4.Schema.Types.ObjectId
|
|
390
|
+
},
|
|
391
|
+
resolved: { default: false, required: true, type: Boolean }
|
|
392
|
+
},
|
|
393
|
+
{ timestamps: true }
|
|
394
|
+
);
|
|
395
|
+
ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
|
|
396
|
+
ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
|
|
397
|
+
var ChatReportModel = mongoose4.models.ChatReport || mongoose4.model("ChatReport", ChatReportSchema);
|
|
398
|
+
|
|
399
|
+
// src/mongoose/global.ts
|
|
400
|
+
import {
|
|
401
|
+
EnumEventDateStatus as EnumEventDateStatus3,
|
|
402
|
+
EnumPostType,
|
|
403
|
+
EnumUserLicence as EnumUserLicence2
|
|
404
|
+
} from "@timardex/cluemart-shared";
|
|
405
|
+
import mongoose7 from "mongoose";
|
|
406
|
+
|
|
407
|
+
// src/mongoose/Relation.ts
|
|
408
|
+
import {
|
|
409
|
+
EnumEventDateStatus as EnumEventDateStatus2,
|
|
410
|
+
EnumInviteStatus,
|
|
411
|
+
EnumRelationResource,
|
|
412
|
+
EnumResourceType as EnumResourceType2
|
|
413
|
+
} from "@timardex/cluemart-shared";
|
|
414
|
+
import mongoose6 from "mongoose";
|
|
415
|
+
|
|
416
|
+
// src/mongoose/event/EventInfo.ts
|
|
417
|
+
import {
|
|
418
|
+
EnumEventDateStatus,
|
|
419
|
+
EnumPaymentMethod
|
|
420
|
+
} from "@timardex/cluemart-shared";
|
|
421
|
+
import mongoose5 from "mongoose";
|
|
422
|
+
var MongooseSchema5 = mongoose5.Schema;
|
|
423
|
+
var StallTypeSchema = new MongooseSchema5(
|
|
424
|
+
{
|
|
425
|
+
label: { required: false, type: String },
|
|
426
|
+
price: { required: false, type: Number },
|
|
427
|
+
stallCapacity: { required: false, type: Number }
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
_id: false
|
|
431
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
var dateTimeSchema = new MongooseSchema5(
|
|
435
|
+
{
|
|
436
|
+
dateStatus: {
|
|
437
|
+
enum: Object.values(EnumEventDateStatus),
|
|
438
|
+
required: false,
|
|
439
|
+
type: String
|
|
440
|
+
},
|
|
441
|
+
endDate: { required: true, type: String },
|
|
442
|
+
endTime: { required: true, type: String },
|
|
443
|
+
stallTypes: [StallTypeSchema],
|
|
444
|
+
startDate: { required: true, type: String },
|
|
445
|
+
startTime: { required: true, type: String }
|
|
446
|
+
},
|
|
447
|
+
{ _id: false }
|
|
448
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
449
|
+
);
|
|
450
|
+
var paymentInfoSchema = new MongooseSchema5(
|
|
451
|
+
{
|
|
452
|
+
accountHolderName: { required: false, type: String },
|
|
453
|
+
accountNumber: { required: false, type: String },
|
|
454
|
+
link: { required: false, type: String },
|
|
455
|
+
paymentMethod: {
|
|
456
|
+
enum: Object.values(EnumPaymentMethod),
|
|
457
|
+
required: true,
|
|
458
|
+
type: String
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
{ _id: false }
|
|
462
|
+
// Prevents Mongoose from creating an additional _id field
|
|
463
|
+
);
|
|
464
|
+
var requirementsSchema = new MongooseSchema5(
|
|
465
|
+
{
|
|
466
|
+
category: { required: true, type: String },
|
|
467
|
+
label: { required: true, type: String },
|
|
468
|
+
value: { required: true, type: Boolean }
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
_id: false
|
|
472
|
+
// Prevents Mongoose from creating an additional _id field for
|
|
473
|
+
}
|
|
474
|
+
);
|
|
475
|
+
var refundPolicySchema = new MongooseSchema5(
|
|
476
|
+
{
|
|
477
|
+
category: { required: true, type: String },
|
|
478
|
+
label: { required: true, type: String },
|
|
479
|
+
value: { required: true, type: Boolean }
|
|
480
|
+
},
|
|
481
|
+
{ _id: false }
|
|
482
|
+
);
|
|
483
|
+
var schema3 = new MongooseSchema5(
|
|
484
|
+
{
|
|
485
|
+
active: { default: true, type: Boolean },
|
|
486
|
+
applicationDeadlineHours: { required: true, type: Number },
|
|
487
|
+
dateTime: { required: true, type: [dateTimeSchema] },
|
|
488
|
+
eventId: {
|
|
489
|
+
ref: "Event",
|
|
490
|
+
required: true,
|
|
491
|
+
type: mongoose5.Schema.Types.ObjectId
|
|
492
|
+
},
|
|
493
|
+
packInTime: { required: true, type: Number },
|
|
494
|
+
paymentDueHours: { required: true, type: Number },
|
|
495
|
+
paymentInfo: { required: true, type: [paymentInfoSchema] },
|
|
496
|
+
refundPolicy: { required: true, type: [refundPolicySchema] },
|
|
497
|
+
requirements: { required: false, type: [requirementsSchema] }
|
|
498
|
+
},
|
|
499
|
+
{ timestamps: true }
|
|
500
|
+
);
|
|
501
|
+
schema3.index({ eventId: 1 });
|
|
502
|
+
var EventInfoModel = mongoose5.models.EventInfo || mongoose5.model("EventInfo", schema3);
|
|
503
|
+
|
|
504
|
+
// src/mongoose/Relation.ts
|
|
505
|
+
var MongooseSchema6 = mongoose6.Schema;
|
|
506
|
+
var relationDateTimeSchema = new MongooseSchema6(
|
|
507
|
+
{
|
|
508
|
+
dateStatus: {
|
|
509
|
+
enum: Object.values(EnumEventDateStatus2),
|
|
510
|
+
required: true,
|
|
511
|
+
type: String
|
|
512
|
+
},
|
|
513
|
+
endDate: { required: true, type: String },
|
|
514
|
+
endTime: { required: true, type: String },
|
|
515
|
+
stallType: StallTypeSchema,
|
|
516
|
+
startDate: { required: true, type: String },
|
|
517
|
+
startTime: { required: true, type: String }
|
|
518
|
+
},
|
|
519
|
+
{ _id: false }
|
|
520
|
+
);
|
|
521
|
+
var relationDatesSchema = new MongooseSchema6(
|
|
522
|
+
{
|
|
523
|
+
dateTime: {
|
|
524
|
+
required: true,
|
|
525
|
+
type: relationDateTimeSchema
|
|
526
|
+
},
|
|
527
|
+
lastUpdateBy: {
|
|
528
|
+
resourceId: { required: false, type: String },
|
|
529
|
+
userEmail: { required: false, type: String }
|
|
530
|
+
},
|
|
531
|
+
paymentReference: { required: false, type: String },
|
|
532
|
+
status: {
|
|
533
|
+
enum: Object.values(EnumInviteStatus),
|
|
534
|
+
required: false,
|
|
535
|
+
type: String
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
{ _id: false }
|
|
539
|
+
);
|
|
540
|
+
var RelationTypeSchema = new MongooseSchema6(
|
|
541
|
+
{
|
|
542
|
+
active: { default: true, required: true, type: Boolean },
|
|
543
|
+
chatId: {
|
|
544
|
+
ref: "Chat",
|
|
545
|
+
required: true,
|
|
546
|
+
type: mongoose6.Schema.Types.ObjectId
|
|
547
|
+
},
|
|
548
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
549
|
+
eventId: {
|
|
550
|
+
ref: "Event",
|
|
551
|
+
required: true,
|
|
552
|
+
type: mongoose6.Schema.Types.ObjectId
|
|
553
|
+
},
|
|
554
|
+
lastUpdateBy: {
|
|
555
|
+
enum: Object.values(EnumResourceType2),
|
|
556
|
+
required: true,
|
|
557
|
+
type: String
|
|
558
|
+
},
|
|
559
|
+
relationDates: [relationDatesSchema],
|
|
560
|
+
relationType: {
|
|
561
|
+
enum: Object.values(EnumRelationResource),
|
|
562
|
+
required: true,
|
|
563
|
+
type: String
|
|
564
|
+
},
|
|
565
|
+
vendorId: {
|
|
566
|
+
ref: "Vendor",
|
|
567
|
+
required: true,
|
|
568
|
+
type: mongoose6.Schema.Types.ObjectId
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
{ timestamps: true }
|
|
572
|
+
);
|
|
573
|
+
RelationTypeSchema.index({
|
|
574
|
+
eventId: 1,
|
|
575
|
+
"relationDates.startDate": 1,
|
|
576
|
+
"relationDates.startTime": 1,
|
|
577
|
+
"relationDates.status": 1,
|
|
578
|
+
vendorId: 1
|
|
579
|
+
});
|
|
580
|
+
var RelationModel = mongoose6.models.Relation || mongoose6.model("Relation", RelationTypeSchema);
|
|
581
|
+
|
|
582
|
+
// src/mongoose/global.ts
|
|
583
|
+
var MongooseSchema7 = mongoose7.Schema;
|
|
584
|
+
var OwnerTypeSchema = new MongooseSchema7(
|
|
585
|
+
{
|
|
586
|
+
email: { required: true, type: String },
|
|
587
|
+
userId: {
|
|
588
|
+
ref: "User",
|
|
589
|
+
required: true,
|
|
590
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
{ _id: false }
|
|
594
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
595
|
+
);
|
|
596
|
+
var SocialMediaTypeSchema = new MongooseSchema7(
|
|
597
|
+
{
|
|
598
|
+
link: { required: true, type: String },
|
|
599
|
+
name: { required: true, type: String }
|
|
600
|
+
},
|
|
601
|
+
{ _id: false }
|
|
602
|
+
// Prevents Mongoose from creating an additional _id field
|
|
603
|
+
);
|
|
604
|
+
var ResourceImageTypeSchema = new MongooseSchema7(
|
|
605
|
+
{
|
|
606
|
+
active: { default: true, required: true, type: Boolean },
|
|
607
|
+
source: { required: false, type: String },
|
|
608
|
+
title: { required: false, type: String }
|
|
609
|
+
},
|
|
610
|
+
{ _id: false }
|
|
611
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
612
|
+
);
|
|
613
|
+
var SubCategorySchema = new MongooseSchema7(
|
|
614
|
+
{
|
|
615
|
+
id: { required: false, type: String },
|
|
616
|
+
items: [
|
|
617
|
+
{
|
|
618
|
+
id: { required: false, type: String },
|
|
619
|
+
name: { required: false, type: String }
|
|
620
|
+
}
|
|
621
|
+
],
|
|
622
|
+
name: { required: false, type: String }
|
|
623
|
+
},
|
|
624
|
+
{ _id: false }
|
|
625
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
626
|
+
);
|
|
627
|
+
var CategorySchema = new MongooseSchema7(
|
|
628
|
+
{
|
|
629
|
+
id: { required: true, type: String },
|
|
630
|
+
name: { required: true, type: String },
|
|
631
|
+
subcategories: [SubCategorySchema]
|
|
632
|
+
},
|
|
633
|
+
{ _id: false }
|
|
634
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
635
|
+
);
|
|
636
|
+
var PosterUsageTypeSchema = new MongooseSchema7(
|
|
637
|
+
{
|
|
638
|
+
count: { default: 0, required: false, type: Number },
|
|
639
|
+
month: { required: false, type: String }
|
|
640
|
+
},
|
|
641
|
+
{ _id: false }
|
|
642
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
643
|
+
);
|
|
644
|
+
var userLicenseSchema = new MongooseSchema7(
|
|
645
|
+
{
|
|
646
|
+
expiryDate: { required: true, type: Date },
|
|
647
|
+
issuedDate: { required: true, type: Date },
|
|
648
|
+
licenceType: {
|
|
649
|
+
enum: Object.values(EnumUserLicence2),
|
|
650
|
+
required: true,
|
|
651
|
+
type: String
|
|
652
|
+
},
|
|
653
|
+
prevLicenceType: {
|
|
654
|
+
enum: Object.values(EnumUserLicence2),
|
|
655
|
+
required: false,
|
|
656
|
+
type: String
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
{ _id: false, timestamps: false }
|
|
660
|
+
);
|
|
661
|
+
var ContactDetailsSchema = new MongooseSchema7(
|
|
662
|
+
{
|
|
663
|
+
email: { required: false, type: String },
|
|
664
|
+
landlinePhone: { required: false, type: String },
|
|
665
|
+
mobilePhone: { required: false, type: String }
|
|
666
|
+
},
|
|
667
|
+
{ _id: false }
|
|
668
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
669
|
+
);
|
|
670
|
+
var termsAgreementSchema = new MongooseSchema7(
|
|
671
|
+
{
|
|
672
|
+
appBuildNumber: { required: true, type: String },
|
|
673
|
+
appId: { required: true, type: String },
|
|
674
|
+
appVersion: { required: true, type: String },
|
|
675
|
+
brand: { required: true, type: String },
|
|
676
|
+
deviceName: { required: true, type: String },
|
|
677
|
+
installationId: { required: true, type: String },
|
|
678
|
+
manufacturer: { required: true, type: String },
|
|
679
|
+
modelName: { required: true, type: String },
|
|
680
|
+
osName: { required: true, type: String },
|
|
681
|
+
osVersion: { required: true, type: String },
|
|
682
|
+
termVersion: { required: true, type: String },
|
|
683
|
+
timestamp: { required: true, type: Date }
|
|
684
|
+
},
|
|
685
|
+
{ _id: false }
|
|
686
|
+
);
|
|
687
|
+
var resourceRelationsSchema = new MongooseSchema7(
|
|
688
|
+
{
|
|
689
|
+
relationDates: {
|
|
690
|
+
default: [],
|
|
691
|
+
required: false,
|
|
692
|
+
type: [relationDatesSchema]
|
|
693
|
+
},
|
|
694
|
+
relationId: {
|
|
695
|
+
ref: "Relation",
|
|
696
|
+
required: false,
|
|
697
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
{ _id: false }
|
|
701
|
+
);
|
|
702
|
+
var dateTimeSchema2 = new MongooseSchema7(
|
|
703
|
+
{
|
|
704
|
+
dateStatus: {
|
|
705
|
+
enum: Object.values(EnumEventDateStatus3),
|
|
706
|
+
required: false,
|
|
707
|
+
type: String
|
|
708
|
+
},
|
|
709
|
+
endDate: { required: true, type: String },
|
|
710
|
+
endTime: { required: true, type: String },
|
|
711
|
+
startDate: { required: true, type: String },
|
|
712
|
+
startTime: { required: true, type: String }
|
|
713
|
+
},
|
|
714
|
+
{ _id: false }
|
|
715
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
716
|
+
);
|
|
717
|
+
var locationGeoSchema = new MongooseSchema7(
|
|
718
|
+
{
|
|
719
|
+
coordinates: { required: true, type: [Number] },
|
|
720
|
+
// [longitude, latitude]
|
|
721
|
+
type: { default: "Point", enum: ["Point"], required: true, type: String }
|
|
722
|
+
},
|
|
723
|
+
{ _id: false }
|
|
724
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
725
|
+
);
|
|
726
|
+
var locationsSchema = new MongooseSchema7(
|
|
727
|
+
{
|
|
728
|
+
city: { required: true, type: String },
|
|
729
|
+
country: { required: true, type: String },
|
|
730
|
+
fullAddress: { required: true, type: String },
|
|
731
|
+
geo: {
|
|
732
|
+
required: true,
|
|
733
|
+
type: locationGeoSchema
|
|
734
|
+
},
|
|
735
|
+
latitude: { required: true, type: Number },
|
|
736
|
+
longitude: { required: true, type: Number },
|
|
737
|
+
region: { required: true, type: String }
|
|
738
|
+
},
|
|
739
|
+
{ _id: false }
|
|
740
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
741
|
+
);
|
|
742
|
+
var relatedPostSchema = new MongooseSchema7(
|
|
743
|
+
{
|
|
744
|
+
postActive: { default: true, required: true, type: Boolean },
|
|
745
|
+
postId: {
|
|
746
|
+
ref: "Post",
|
|
747
|
+
required: true,
|
|
748
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
749
|
+
},
|
|
750
|
+
postSlug: { required: true, type: String },
|
|
751
|
+
postType: {
|
|
752
|
+
enum: Object.values(EnumPostType),
|
|
753
|
+
required: true,
|
|
754
|
+
type: String
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
{ _id: false }
|
|
758
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
759
|
+
);
|
|
760
|
+
var socialShareResourceSchema = new MongooseSchema7(
|
|
761
|
+
{
|
|
762
|
+
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
763
|
+
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
764
|
+
},
|
|
765
|
+
{ _id: false }
|
|
766
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
767
|
+
);
|
|
768
|
+
var baseResourceFields = {
|
|
769
|
+
active: { default: false, required: true, type: Boolean },
|
|
770
|
+
adIds: {
|
|
771
|
+
ref: "Ad",
|
|
772
|
+
required: false,
|
|
773
|
+
type: [mongoose7.Schema.Types.ObjectId]
|
|
774
|
+
},
|
|
775
|
+
approvedAt: { default: null, required: false, type: Date },
|
|
776
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
777
|
+
cover: {
|
|
778
|
+
required: true,
|
|
779
|
+
type: ResourceImageTypeSchema
|
|
780
|
+
},
|
|
781
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
782
|
+
description: { required: true, type: String },
|
|
783
|
+
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
784
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
785
|
+
name: { required: true, type: String },
|
|
786
|
+
owner: {
|
|
787
|
+
required: true,
|
|
788
|
+
type: OwnerTypeSchema
|
|
789
|
+
},
|
|
790
|
+
posterUsage: { required: false, type: PosterUsageTypeSchema },
|
|
791
|
+
promoCodes: { required: false, type: [String] },
|
|
792
|
+
rating: { required: false, type: Number },
|
|
793
|
+
region: { required: true, type: String },
|
|
794
|
+
relatedPost: { required: false, type: relatedPostSchema },
|
|
795
|
+
reviewCount: { required: false, type: Number },
|
|
796
|
+
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
797
|
+
slug: { required: true, type: String },
|
|
798
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
799
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
// src/mongoose/GoogleImportedMarket.ts
|
|
803
|
+
import {
|
|
804
|
+
EnumEventType
|
|
805
|
+
} from "@timardex/cluemart-shared";
|
|
806
|
+
import mongoose8 from "mongoose";
|
|
807
|
+
|
|
808
|
+
// src/mongoose/searchNamePlugin.ts
|
|
809
|
+
function deriveSearchName(name) {
|
|
810
|
+
return typeof name === "string" ? name.trim().toLowerCase() : "";
|
|
811
|
+
}
|
|
812
|
+
function syncSearchNameInUpdate(update) {
|
|
813
|
+
if (Array.isArray(update)) {
|
|
814
|
+
let changed = false;
|
|
815
|
+
const next = update.map((stage) => {
|
|
816
|
+
if (!stage || typeof stage !== "object") {
|
|
817
|
+
return stage;
|
|
818
|
+
}
|
|
819
|
+
const $set2 = stage.$set;
|
|
820
|
+
const name = $set2 && typeof $set2.name === "string" ? $set2.name : null;
|
|
821
|
+
if (!name || name.startsWith("$")) {
|
|
822
|
+
return stage;
|
|
823
|
+
}
|
|
824
|
+
changed = true;
|
|
825
|
+
return {
|
|
826
|
+
...stage,
|
|
827
|
+
$set: { ...$set2, searchName: deriveSearchName(name) }
|
|
828
|
+
};
|
|
829
|
+
});
|
|
830
|
+
return changed ? next : null;
|
|
831
|
+
}
|
|
832
|
+
if (!update || typeof update !== "object") {
|
|
833
|
+
return null;
|
|
834
|
+
}
|
|
835
|
+
const obj = update;
|
|
836
|
+
const $set = obj.$set;
|
|
837
|
+
if ($set && typeof $set === "object" && !Array.isArray($set)) {
|
|
838
|
+
const setObj = $set;
|
|
839
|
+
if (typeof setObj.name === "string") {
|
|
840
|
+
return {
|
|
841
|
+
...obj,
|
|
842
|
+
$set: { ...setObj, searchName: deriveSearchName(setObj.name) }
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
if (typeof obj.name === "string") {
|
|
848
|
+
return { ...obj, searchName: deriveSearchName(obj.name) };
|
|
849
|
+
}
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
function searchNamePlugin(schema20) {
|
|
853
|
+
schema20.add({ searchName: { default: "", required: false, type: String } });
|
|
854
|
+
schema20.index({ searchName: 1 });
|
|
855
|
+
schema20.pre("save", function syncSearchNameOnSave(next) {
|
|
856
|
+
const doc = this;
|
|
857
|
+
doc.searchName = deriveSearchName(doc.name);
|
|
858
|
+
next();
|
|
859
|
+
});
|
|
860
|
+
schema20.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
861
|
+
const list = Array.isArray(docs) ? docs : [docs];
|
|
862
|
+
for (const doc of list) {
|
|
863
|
+
if (doc && typeof doc.name === "string") {
|
|
864
|
+
doc.searchName = deriveSearchName(doc.name);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
next();
|
|
868
|
+
});
|
|
869
|
+
schema20.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
870
|
+
for (const op of ops) {
|
|
871
|
+
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
872
|
+
if (doc && typeof doc.name === "string") {
|
|
873
|
+
doc.searchName = deriveSearchName(doc.name);
|
|
874
|
+
}
|
|
875
|
+
for (const key of ["updateOne", "updateMany"]) {
|
|
876
|
+
const update = op[key]?.update;
|
|
877
|
+
if (update === void 0) {
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
const synced = syncSearchNameInUpdate(update);
|
|
881
|
+
if (synced !== null) {
|
|
882
|
+
op[key].update = synced;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
next();
|
|
887
|
+
});
|
|
888
|
+
const syncSearchNameOnUpdate = function(next) {
|
|
889
|
+
const synced = syncSearchNameInUpdate(this.getUpdate());
|
|
890
|
+
if (synced !== null) {
|
|
891
|
+
this.setUpdate(synced);
|
|
892
|
+
}
|
|
893
|
+
next();
|
|
894
|
+
};
|
|
895
|
+
schema20.pre(
|
|
896
|
+
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
897
|
+
syncSearchNameOnUpdate
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// src/mongoose/GoogleImportedMarket.ts
|
|
902
|
+
var MongooseSchema8 = mongoose8.Schema;
|
|
903
|
+
var addressComponentSchema = new MongooseSchema8(
|
|
904
|
+
{
|
|
905
|
+
longName: { required: false, type: String },
|
|
906
|
+
shortName: { required: false, type: String },
|
|
907
|
+
types: { required: false, type: [String] }
|
|
908
|
+
},
|
|
909
|
+
{ _id: false }
|
|
910
|
+
);
|
|
911
|
+
var schema4 = new MongooseSchema8(
|
|
912
|
+
{
|
|
913
|
+
active: { default: false, required: true, type: Boolean },
|
|
914
|
+
address: { required: true, type: String },
|
|
915
|
+
addressComponents: { required: false, type: [addressComponentSchema] },
|
|
916
|
+
approvedAt: { default: null, required: false, type: Date },
|
|
917
|
+
businessStatus: { required: false, type: String },
|
|
918
|
+
claimed: { default: false, required: true, type: Boolean },
|
|
919
|
+
claimedAt: { default: null, required: false, type: Date },
|
|
920
|
+
claimedByUserId: {
|
|
921
|
+
ref: "User",
|
|
922
|
+
required: false,
|
|
923
|
+
type: mongoose8.Schema.Types.ObjectId
|
|
924
|
+
},
|
|
925
|
+
cover: {
|
|
926
|
+
required: false,
|
|
927
|
+
type: ResourceImageTypeSchema
|
|
928
|
+
},
|
|
929
|
+
dateTime: [dateTimeSchema2],
|
|
930
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
931
|
+
description: { required: true, type: String },
|
|
932
|
+
eventId: {
|
|
933
|
+
ref: "Event",
|
|
934
|
+
required: false,
|
|
935
|
+
type: mongoose8.Schema.Types.ObjectId
|
|
936
|
+
},
|
|
937
|
+
eventType: {
|
|
938
|
+
enum: Object.values(EnumEventType),
|
|
939
|
+
required: true,
|
|
940
|
+
type: String
|
|
941
|
+
},
|
|
942
|
+
googleMapsUrl: { required: false, type: String },
|
|
943
|
+
googlePlaceId: {
|
|
944
|
+
required: true,
|
|
945
|
+
type: String,
|
|
946
|
+
unique: true
|
|
947
|
+
// unique, indexed
|
|
948
|
+
},
|
|
949
|
+
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
950
|
+
// array of photo_reference
|
|
951
|
+
importedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
|
|
952
|
+
location: {
|
|
953
|
+
required: true,
|
|
954
|
+
// optional because lat/lng may expire after 30 days
|
|
955
|
+
type: locationsSchema
|
|
956
|
+
},
|
|
957
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
958
|
+
name: { required: true, type: String },
|
|
959
|
+
openingHours: { required: false, type: [String] },
|
|
960
|
+
rainOrShine: { required: true, type: Boolean },
|
|
961
|
+
rating: { required: false, type: Number },
|
|
962
|
+
region: { required: false, type: String },
|
|
963
|
+
relations: {
|
|
964
|
+
default: [],
|
|
965
|
+
required: false,
|
|
966
|
+
type: [resourceRelationsSchema]
|
|
967
|
+
},
|
|
968
|
+
reviewCount: { required: false, type: Number },
|
|
969
|
+
slug: { required: true, type: String },
|
|
970
|
+
website: { required: false, type: String }
|
|
971
|
+
},
|
|
972
|
+
{ timestamps: true }
|
|
973
|
+
);
|
|
974
|
+
schema4.index({ "location.geo": "2dsphere" });
|
|
975
|
+
schema4.index({ name: 1 });
|
|
976
|
+
schema4.index({ region: 1 });
|
|
977
|
+
schema4.index({ deletedAt: 1 });
|
|
978
|
+
schema4.index({ "dateTime.dateStatus": 1 });
|
|
979
|
+
schema4.index({ slug: 1 });
|
|
980
|
+
schema4.index({ name: "text", description: "text" });
|
|
981
|
+
schema4.plugin(searchNamePlugin);
|
|
982
|
+
var GoogleImportedMarketModel = mongoose8.models.GoogleImportedMarket || mongoose8.model("GoogleImportedMarket", schema4);
|
|
983
|
+
|
|
984
|
+
// src/mongoose/Notification.ts
|
|
985
|
+
import {
|
|
986
|
+
EnumNotificationResourceType,
|
|
987
|
+
EnumNotificationType
|
|
988
|
+
} from "@timardex/cluemart-shared";
|
|
989
|
+
import mongoose9 from "mongoose";
|
|
990
|
+
var MongooseSchema9 = mongoose9.Schema;
|
|
991
|
+
var schema5 = new MongooseSchema9(
|
|
992
|
+
{
|
|
993
|
+
data: {
|
|
994
|
+
resourceId: { required: true, type: String },
|
|
995
|
+
resourceName: { required: true, type: String },
|
|
996
|
+
resourceType: {
|
|
997
|
+
enum: Object.values(EnumNotificationResourceType),
|
|
998
|
+
required: true,
|
|
999
|
+
type: String
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
isRead: { default: false, index: true, required: true, type: Boolean },
|
|
1003
|
+
message: { required: true, type: String },
|
|
1004
|
+
title: { required: true, type: String },
|
|
1005
|
+
type: {
|
|
1006
|
+
default: EnumNotificationType.SYSTEM,
|
|
1007
|
+
enum: Object.values(EnumNotificationType),
|
|
1008
|
+
required: true,
|
|
1009
|
+
type: String
|
|
1010
|
+
},
|
|
1011
|
+
userId: {
|
|
1012
|
+
ref: "User",
|
|
1013
|
+
required: true,
|
|
1014
|
+
type: mongoose9.Schema.Types.ObjectId
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
{ timestamps: true }
|
|
1018
|
+
);
|
|
1019
|
+
schema5.index({ isRead: 1, userId: 1 });
|
|
1020
|
+
schema5.index({ createdAt: -1, userId: 1 });
|
|
1021
|
+
var NotificationModel = mongoose9.models.Notification || mongoose9.model("Notification", schema5);
|
|
1022
|
+
|
|
1023
|
+
// src/mongoose/PushToken.ts
|
|
1024
|
+
import { EnumOSPlatform } from "@timardex/cluemart-shared/enums";
|
|
1025
|
+
import mongoose10 from "mongoose";
|
|
1026
|
+
var MongooseSchema10 = mongoose10.Schema;
|
|
1027
|
+
var schema6 = new MongooseSchema10(
|
|
1028
|
+
{
|
|
1029
|
+
platform: {
|
|
1030
|
+
enum: Object.values(EnumOSPlatform),
|
|
1031
|
+
required: true,
|
|
1032
|
+
type: String
|
|
1033
|
+
},
|
|
1034
|
+
token: { required: true, type: String },
|
|
1035
|
+
userId: {
|
|
1036
|
+
ref: "User",
|
|
1037
|
+
required: true,
|
|
1038
|
+
type: mongoose10.Schema.Types.ObjectId
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
{ timestamps: true }
|
|
1042
|
+
);
|
|
1043
|
+
var PushTokenModel = mongoose10.models.PushToken || mongoose10.model("PushToken", schema6);
|
|
1044
|
+
|
|
1045
|
+
// src/mongoose/ResourceActivity.ts
|
|
1046
|
+
import {
|
|
1047
|
+
EnumActivity,
|
|
1048
|
+
EnumEventDateStatus as EnumEventDateStatus4,
|
|
1049
|
+
EnumOSPlatform as EnumOSPlatform2,
|
|
1050
|
+
EnumResourceType as EnumResourceType3
|
|
1051
|
+
} from "@timardex/cluemart-shared";
|
|
1052
|
+
import mongoose11 from "mongoose";
|
|
1053
|
+
var MongooseSchema11 = mongoose11.Schema;
|
|
1054
|
+
var ActivitySchema = new MongooseSchema11(
|
|
1055
|
+
{
|
|
1056
|
+
activityType: {
|
|
1057
|
+
enum: Object.values(EnumActivity),
|
|
1058
|
+
required: true,
|
|
1059
|
+
type: String
|
|
1060
|
+
},
|
|
1061
|
+
dateStatus: {
|
|
1062
|
+
enum: Object.values(EnumEventDateStatus4),
|
|
1063
|
+
required: false,
|
|
1064
|
+
type: String
|
|
1065
|
+
},
|
|
1066
|
+
location: {
|
|
1067
|
+
required: false,
|
|
1068
|
+
type: locationGeoSchema
|
|
1069
|
+
},
|
|
1070
|
+
startDate: { required: false, type: String },
|
|
1071
|
+
startTime: { required: false, type: String },
|
|
1072
|
+
timestamp: { default: Date.now, type: Date },
|
|
1073
|
+
userAgent: {
|
|
1074
|
+
enum: Object.values(EnumOSPlatform2),
|
|
1075
|
+
required: true,
|
|
1076
|
+
type: String
|
|
1077
|
+
},
|
|
1078
|
+
userId: { required: false, type: String }
|
|
1079
|
+
},
|
|
1080
|
+
{ _id: false }
|
|
1081
|
+
);
|
|
1082
|
+
var schema7 = new MongooseSchema11(
|
|
1083
|
+
{
|
|
1084
|
+
activity: { default: [], type: [ActivitySchema] },
|
|
1085
|
+
resourceId: { required: true, type: String },
|
|
1086
|
+
resourceType: {
|
|
1087
|
+
enum: Object.values(EnumResourceType3),
|
|
1088
|
+
required: true,
|
|
1089
|
+
type: String
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
{ timestamps: true }
|
|
1093
|
+
);
|
|
1094
|
+
schema7.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1095
|
+
schema7.index({ "views.location": "2dsphere" });
|
|
1096
|
+
var ResourceActivityModel = mongoose11.models.ResourceActivity || mongoose11.model("ResourceActivity", schema7);
|
|
1097
|
+
|
|
1098
|
+
// src/mongoose/User.ts
|
|
1099
|
+
import {
|
|
1100
|
+
EnumBillingPeriod as EnumBillingPeriod2,
|
|
1101
|
+
EnumNotificationResourceType as EnumNotificationResourceType2,
|
|
1102
|
+
EnumOSPlatform as EnumOSPlatform3,
|
|
1103
|
+
EnumResourceType as EnumResourceType4,
|
|
1104
|
+
EnumReward,
|
|
1105
|
+
EnumSubscriptionStatus,
|
|
1106
|
+
EnumUserLicence as EnumUserLicence3,
|
|
1107
|
+
EnumUserRole
|
|
1108
|
+
} from "@timardex/cluemart-shared";
|
|
1109
|
+
import mongoose12 from "mongoose";
|
|
1110
|
+
var MongooseSchema12 = mongoose12.Schema;
|
|
1111
|
+
var userActivityEventSchema = new MongooseSchema12(
|
|
1112
|
+
{
|
|
1113
|
+
dateTime: dateTimeSchema2,
|
|
1114
|
+
resourceId: {
|
|
1115
|
+
ref: "Event",
|
|
1116
|
+
required: false,
|
|
1117
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
{ _id: false }
|
|
1121
|
+
);
|
|
1122
|
+
var userActivityFavouritesSchema = new MongooseSchema12(
|
|
1123
|
+
{
|
|
1124
|
+
events: {
|
|
1125
|
+
ref: "Event",
|
|
1126
|
+
required: false,
|
|
1127
|
+
type: [mongoose12.Schema.Types.ObjectId]
|
|
1128
|
+
},
|
|
1129
|
+
partners: {
|
|
1130
|
+
ref: "Partner",
|
|
1131
|
+
required: false,
|
|
1132
|
+
type: [mongoose12.Schema.Types.ObjectId]
|
|
1133
|
+
},
|
|
1134
|
+
vendors: {
|
|
1135
|
+
ref: "Vendor",
|
|
1136
|
+
required: false,
|
|
1137
|
+
type: [mongoose12.Schema.Types.ObjectId]
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
{ _id: false }
|
|
1141
|
+
);
|
|
1142
|
+
var stripeSchema = new MongooseSchema12(
|
|
1143
|
+
{
|
|
1144
|
+
billingPeriod: {
|
|
1145
|
+
enum: Object.values(EnumBillingPeriod2),
|
|
1146
|
+
required: false,
|
|
1147
|
+
type: String
|
|
1148
|
+
},
|
|
1149
|
+
cancelAtPeriodEnd: {
|
|
1150
|
+
required: false,
|
|
1151
|
+
type: Boolean
|
|
1152
|
+
},
|
|
1153
|
+
currentPlan: {
|
|
1154
|
+
enum: Object.values(EnumUserLicence3),
|
|
1155
|
+
required: false,
|
|
1156
|
+
type: String
|
|
1157
|
+
},
|
|
1158
|
+
customerId: {
|
|
1159
|
+
required: false,
|
|
1160
|
+
type: String
|
|
1161
|
+
},
|
|
1162
|
+
endDate: {
|
|
1163
|
+
required: false,
|
|
1164
|
+
type: Date
|
|
1165
|
+
},
|
|
1166
|
+
pendingBillingPeriod: {
|
|
1167
|
+
enum: Object.values(EnumBillingPeriod2),
|
|
1168
|
+
required: false,
|
|
1169
|
+
type: String
|
|
1170
|
+
},
|
|
1171
|
+
pendingChangeEffectiveAt: {
|
|
1172
|
+
required: false,
|
|
1173
|
+
type: Date
|
|
1174
|
+
},
|
|
1175
|
+
pendingPlan: {
|
|
1176
|
+
enum: Object.values(EnumUserLicence3),
|
|
1177
|
+
required: false,
|
|
1178
|
+
type: String
|
|
1179
|
+
},
|
|
1180
|
+
priceId: {
|
|
1181
|
+
required: false,
|
|
1182
|
+
type: String
|
|
1183
|
+
},
|
|
1184
|
+
scheduleId: {
|
|
1185
|
+
required: false,
|
|
1186
|
+
type: String
|
|
1187
|
+
},
|
|
1188
|
+
startDate: {
|
|
1189
|
+
required: false,
|
|
1190
|
+
type: Date
|
|
1191
|
+
},
|
|
1192
|
+
status: {
|
|
1193
|
+
enum: Object.values(EnumSubscriptionStatus),
|
|
1194
|
+
required: false,
|
|
1195
|
+
type: String
|
|
1196
|
+
},
|
|
1197
|
+
subscriptionId: {
|
|
1198
|
+
required: false,
|
|
1199
|
+
type: String
|
|
1200
|
+
},
|
|
1201
|
+
subscriptionMutationLockExpiresAt: {
|
|
1202
|
+
required: false,
|
|
1203
|
+
type: Date
|
|
1204
|
+
},
|
|
1205
|
+
subscriptionMutationLockId: {
|
|
1206
|
+
required: false,
|
|
1207
|
+
type: String
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
{ _id: false }
|
|
1211
|
+
);
|
|
1212
|
+
var redeemedRewardSchema = new MongooseSchema12(
|
|
1213
|
+
{
|
|
1214
|
+
name: {
|
|
1215
|
+
enum: Object.values(EnumReward),
|
|
1216
|
+
required: true,
|
|
1217
|
+
type: String
|
|
1218
|
+
},
|
|
1219
|
+
pointsUsed: { required: true, type: Number },
|
|
1220
|
+
redeemedAt: { required: true, type: Date }
|
|
1221
|
+
},
|
|
1222
|
+
{ _id: false }
|
|
1223
|
+
);
|
|
1224
|
+
var schema8 = new MongooseSchema12(
|
|
1225
|
+
{
|
|
1226
|
+
active: { default: false, required: true, type: Boolean },
|
|
1227
|
+
affiliate: {
|
|
1228
|
+
ref: "Affiliate",
|
|
1229
|
+
required: false,
|
|
1230
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1231
|
+
},
|
|
1232
|
+
avatar: {
|
|
1233
|
+
required: false,
|
|
1234
|
+
type: ResourceImageTypeSchema
|
|
1235
|
+
},
|
|
1236
|
+
coupon: {
|
|
1237
|
+
ref: "Coupon",
|
|
1238
|
+
required: false,
|
|
1239
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1240
|
+
},
|
|
1241
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
1242
|
+
email: { required: true, type: String },
|
|
1243
|
+
emailSentFor: {
|
|
1244
|
+
enum: Object.values(EnumNotificationResourceType2),
|
|
1245
|
+
required: false,
|
|
1246
|
+
type: [String]
|
|
1247
|
+
},
|
|
1248
|
+
events: {
|
|
1249
|
+
ref: "Event",
|
|
1250
|
+
required: false,
|
|
1251
|
+
type: [mongoose12.Schema.Types.ObjectId]
|
|
1252
|
+
},
|
|
1253
|
+
firstName: { required: true, type: String },
|
|
1254
|
+
game: {
|
|
1255
|
+
ref: "Game",
|
|
1256
|
+
required: false,
|
|
1257
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1258
|
+
},
|
|
1259
|
+
interests: {
|
|
1260
|
+
enum: Object.values(EnumResourceType4),
|
|
1261
|
+
required: false,
|
|
1262
|
+
type: [String]
|
|
1263
|
+
},
|
|
1264
|
+
isTester: { default: false, required: true, type: Boolean },
|
|
1265
|
+
lastName: { required: true, type: String },
|
|
1266
|
+
licences: {
|
|
1267
|
+
required: false,
|
|
1268
|
+
type: [userLicenseSchema]
|
|
1269
|
+
},
|
|
1270
|
+
location: {
|
|
1271
|
+
required: false,
|
|
1272
|
+
type: locationsSchema
|
|
1273
|
+
},
|
|
1274
|
+
nickName: { required: false, type: String },
|
|
1275
|
+
overallPoints: { default: 0, required: false, type: Number },
|
|
1276
|
+
partner: {
|
|
1277
|
+
ref: "Partner",
|
|
1278
|
+
required: false,
|
|
1279
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1280
|
+
},
|
|
1281
|
+
password: { required: true, type: String },
|
|
1282
|
+
platform: {
|
|
1283
|
+
enum: Object.values(EnumOSPlatform3),
|
|
1284
|
+
required: false,
|
|
1285
|
+
type: String
|
|
1286
|
+
},
|
|
1287
|
+
preferredRegion: {
|
|
1288
|
+
required: true,
|
|
1289
|
+
type: String
|
|
1290
|
+
},
|
|
1291
|
+
promoCodes: {
|
|
1292
|
+
required: false,
|
|
1293
|
+
type: [String]
|
|
1294
|
+
},
|
|
1295
|
+
redeemedRewards: {
|
|
1296
|
+
required: false,
|
|
1297
|
+
type: [redeemedRewardSchema]
|
|
1298
|
+
},
|
|
1299
|
+
refreshToken: {
|
|
1300
|
+
required: false,
|
|
1301
|
+
type: String
|
|
1302
|
+
},
|
|
1303
|
+
roles: {
|
|
1304
|
+
default: [EnumUserRole.CUSTOMER],
|
|
1305
|
+
enum: Object.values(EnumUserRole),
|
|
1306
|
+
required: true,
|
|
1307
|
+
type: [String]
|
|
1308
|
+
},
|
|
1309
|
+
school: {
|
|
1310
|
+
ref: "School",
|
|
1311
|
+
required: false,
|
|
1312
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1313
|
+
},
|
|
1314
|
+
stripe: {
|
|
1315
|
+
required: false,
|
|
1316
|
+
type: stripeSchema
|
|
1317
|
+
},
|
|
1318
|
+
termsAgreement: termsAgreementSchema,
|
|
1319
|
+
userActivity: {
|
|
1320
|
+
favourites: {
|
|
1321
|
+
default: () => ({ events: [], vendors: [] }),
|
|
1322
|
+
type: userActivityFavouritesSchema
|
|
1323
|
+
},
|
|
1324
|
+
going: {
|
|
1325
|
+
events: [userActivityEventSchema]
|
|
1326
|
+
},
|
|
1327
|
+
interested: {
|
|
1328
|
+
events: [userActivityEventSchema]
|
|
1329
|
+
},
|
|
1330
|
+
present: {
|
|
1331
|
+
events: [userActivityEventSchema]
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
vendor: {
|
|
1335
|
+
ref: "Vendor",
|
|
1336
|
+
required: false,
|
|
1337
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
{ strict: false, timestamps: true }
|
|
1341
|
+
);
|
|
1342
|
+
schema8.index({ "licences.expiryDate": 1 });
|
|
1343
|
+
schema8.index({ "licences.licenceType": 1 });
|
|
1344
|
+
schema8.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1345
|
+
var UserModel = mongoose12.models.User || mongoose12.model("User", schema8);
|
|
1346
|
+
|
|
1347
|
+
// src/mongoose/VerificationToken.ts
|
|
1348
|
+
import mongoose13 from "mongoose";
|
|
1349
|
+
var MongooseSchema13 = mongoose13.Schema;
|
|
1350
|
+
var schema9 = new MongooseSchema13(
|
|
1351
|
+
{
|
|
1352
|
+
createdAt: {
|
|
1353
|
+
default: Date.now,
|
|
1354
|
+
expires: 24 * 60 * 60,
|
|
1355
|
+
// 24 hours in seconds (MongoDB TTL expects seconds)
|
|
1356
|
+
required: true,
|
|
1357
|
+
type: Date
|
|
1358
|
+
},
|
|
1359
|
+
// Token expires after 1 day
|
|
1360
|
+
email: { required: true, type: String },
|
|
1361
|
+
verificationToken: { required: true, type: String }
|
|
1362
|
+
},
|
|
1363
|
+
{ timestamps: true }
|
|
1364
|
+
);
|
|
1365
|
+
var VerificationTokenModel = mongoose13.models.VerificationToken || mongoose13.model("VerificationToken", schema9);
|
|
1366
|
+
|
|
1367
|
+
// src/mongoose/vendor/Vendor.ts
|
|
1368
|
+
import {
|
|
1369
|
+
EnumEventDateStatus as EnumEventDateStatus5,
|
|
1370
|
+
EnumVendorType
|
|
1371
|
+
} from "@timardex/cluemart-shared";
|
|
1372
|
+
import mongoose14 from "mongoose";
|
|
1373
|
+
var MongooseSchema14 = mongoose14.Schema;
|
|
1374
|
+
var vendorProductTypeSchema = new MongooseSchema14(
|
|
1375
|
+
{
|
|
1376
|
+
description: { required: false, type: String },
|
|
1377
|
+
name: { required: true, type: String },
|
|
1378
|
+
price: { required: true, type: Number },
|
|
1379
|
+
priceMax: { required: false, type: Number },
|
|
1380
|
+
priceUnit: { required: true, type: String },
|
|
1381
|
+
productGroups: { required: false, type: [String] }
|
|
1382
|
+
},
|
|
1383
|
+
{ timestamps: true }
|
|
1384
|
+
);
|
|
1385
|
+
var productWrapperSchema = new MongooseSchema14(
|
|
1386
|
+
{
|
|
1387
|
+
active: { default: false, required: false, type: Boolean },
|
|
1388
|
+
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
1389
|
+
},
|
|
1390
|
+
{ _id: false }
|
|
1391
|
+
);
|
|
1392
|
+
var calendarSchema = new MongooseSchema14(
|
|
1393
|
+
{
|
|
1394
|
+
dateTime: {
|
|
1395
|
+
dateStatus: {
|
|
1396
|
+
enum: Object.values(EnumEventDateStatus5),
|
|
1397
|
+
required: false,
|
|
1398
|
+
type: String
|
|
1399
|
+
},
|
|
1400
|
+
endDate: { required: false, type: String },
|
|
1401
|
+
endTime: { required: false, type: String },
|
|
1402
|
+
startDate: { required: false, type: String },
|
|
1403
|
+
startTime: { required: false, type: String }
|
|
1404
|
+
},
|
|
1405
|
+
description: { required: false, type: String },
|
|
1406
|
+
location: {
|
|
1407
|
+
required: false,
|
|
1408
|
+
type: locationsSchema
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
{ _id: false }
|
|
1412
|
+
);
|
|
1413
|
+
var calendarWrapperSchema = new MongooseSchema14(
|
|
1414
|
+
{
|
|
1415
|
+
active: { default: false, required: true, type: Boolean },
|
|
1416
|
+
calendarData: { required: false, type: [calendarSchema] }
|
|
1417
|
+
},
|
|
1418
|
+
{ _id: false }
|
|
1419
|
+
);
|
|
1420
|
+
var schema10 = new MongooseSchema14(
|
|
1421
|
+
{
|
|
1422
|
+
...baseResourceFields,
|
|
1423
|
+
// Importing base resource fields from global.ts
|
|
1424
|
+
availability: {
|
|
1425
|
+
corporate: { default: false, required: false, type: Boolean },
|
|
1426
|
+
private: { default: false, required: false, type: Boolean },
|
|
1427
|
+
school: { default: false, required: false, type: Boolean }
|
|
1428
|
+
},
|
|
1429
|
+
calendar: {
|
|
1430
|
+
required: false,
|
|
1431
|
+
type: calendarWrapperSchema
|
|
1432
|
+
},
|
|
1433
|
+
categories: { required: true, type: [CategorySchema] },
|
|
1434
|
+
categoriesNames: { default: [], required: false, type: [String] },
|
|
1435
|
+
claimed: { default: true, required: false, type: Boolean },
|
|
1436
|
+
foodTruck: { required: true, type: Boolean },
|
|
1437
|
+
products: { required: false, type: productWrapperSchema },
|
|
1438
|
+
relations: {
|
|
1439
|
+
default: [],
|
|
1440
|
+
required: false,
|
|
1441
|
+
type: [resourceRelationsSchema]
|
|
1442
|
+
},
|
|
1443
|
+
shareRelation: { required: false, type: socialShareResourceSchema },
|
|
1444
|
+
unregisteredVendorId: {
|
|
1445
|
+
ref: "UnregisteredVendor",
|
|
1446
|
+
required: false,
|
|
1447
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1448
|
+
},
|
|
1449
|
+
vendorInfoId: {
|
|
1450
|
+
ref: "VendorInfo",
|
|
1451
|
+
required: false,
|
|
1452
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1453
|
+
},
|
|
1454
|
+
vendorType: {
|
|
1455
|
+
enum: Object.values(EnumVendorType),
|
|
1456
|
+
required: true,
|
|
1457
|
+
type: String
|
|
1458
|
+
}
|
|
1459
|
+
},
|
|
1460
|
+
{ timestamps: true }
|
|
1461
|
+
);
|
|
1462
|
+
schema10.index({ name: 1 });
|
|
1463
|
+
schema10.index({ description: 1 });
|
|
1464
|
+
schema10.index({ region: 1 });
|
|
1465
|
+
schema10.index({ "categories.name": 1 });
|
|
1466
|
+
schema10.index({ slug: 1 });
|
|
1467
|
+
schema10.index({
|
|
1468
|
+
name: "text",
|
|
1469
|
+
description: "text",
|
|
1470
|
+
categoriesNames: "text"
|
|
1471
|
+
});
|
|
1472
|
+
schema10.index({ "owner.userId": 1, deletedAt: 1 });
|
|
1473
|
+
schema10.plugin(searchNamePlugin);
|
|
1474
|
+
var VendorModel = mongoose14.models.Vendor || mongoose14.model("Vendor", schema10);
|
|
1475
|
+
|
|
1476
|
+
// src/mongoose/vendor/VendorInfo.ts
|
|
1477
|
+
import {
|
|
1478
|
+
EnumFoodFlavor
|
|
1479
|
+
} from "@timardex/cluemart-shared";
|
|
1480
|
+
import mongoose15 from "mongoose";
|
|
1481
|
+
var MongooseSchema15 = mongoose15.Schema;
|
|
1482
|
+
var AttributesSchema = new MongooseSchema15(
|
|
1483
|
+
{
|
|
1484
|
+
details: { required: false, type: String },
|
|
1485
|
+
isRequired: { default: false, required: true, type: Boolean }
|
|
1486
|
+
},
|
|
1487
|
+
{ _id: false }
|
|
1488
|
+
);
|
|
1489
|
+
var schema11 = new MongooseSchema15(
|
|
1490
|
+
{
|
|
1491
|
+
active: { default: true, type: Boolean },
|
|
1492
|
+
compliance: {
|
|
1493
|
+
foodBeverageLicense: { default: false, required: false, type: Boolean },
|
|
1494
|
+
liabilityInsurance: { default: false, required: false, type: Boolean }
|
|
1495
|
+
},
|
|
1496
|
+
documents: [ResourceImageTypeSchema],
|
|
1497
|
+
product: {
|
|
1498
|
+
foodFlavors: {
|
|
1499
|
+
enum: Object.values(EnumFoodFlavor),
|
|
1500
|
+
required: true,
|
|
1501
|
+
type: [String]
|
|
1502
|
+
},
|
|
1503
|
+
packaging: { required: true, type: [String] },
|
|
1504
|
+
priceRange: {
|
|
1505
|
+
max: { required: true, type: String },
|
|
1506
|
+
min: { required: true, type: String }
|
|
1507
|
+
},
|
|
1508
|
+
producedIn: { required: true, type: [String] }
|
|
1509
|
+
},
|
|
1510
|
+
requirements: {
|
|
1511
|
+
electricity: AttributesSchema,
|
|
1512
|
+
gazebo: AttributesSchema,
|
|
1513
|
+
table: AttributesSchema
|
|
1514
|
+
},
|
|
1515
|
+
stallInfo: {
|
|
1516
|
+
size: {
|
|
1517
|
+
depth: { required: true, type: String },
|
|
1518
|
+
width: { required: true, type: String }
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
vendorId: {
|
|
1522
|
+
ref: "Vendor",
|
|
1523
|
+
required: true,
|
|
1524
|
+
type: mongoose15.Schema.Types.ObjectId
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
{ timestamps: true }
|
|
1528
|
+
);
|
|
1529
|
+
schema11.index({ vendorId: 1 });
|
|
1530
|
+
var VendorInfoModel = mongoose15.models.VendorInfo || mongoose15.model("VendorInfo", schema11);
|
|
1531
|
+
|
|
1532
|
+
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
1533
|
+
import mongoose16 from "mongoose";
|
|
1534
|
+
var MongooseSchema16 = mongoose16.Schema;
|
|
1535
|
+
var invitationSchema = new MongooseSchema16(
|
|
1536
|
+
{
|
|
1537
|
+
dateTime: { required: true, type: [dateTimeSchema2] },
|
|
1538
|
+
inviterId: {
|
|
1539
|
+
ref: "Event",
|
|
1540
|
+
required: true,
|
|
1541
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
{ _id: false }
|
|
1545
|
+
);
|
|
1546
|
+
var schema12 = new MongooseSchema16(
|
|
1547
|
+
{
|
|
1548
|
+
active: { default: true, required: true, type: Boolean },
|
|
1549
|
+
categoryIds: { required: true, type: [String] },
|
|
1550
|
+
claimed: { default: false, required: true, type: Boolean },
|
|
1551
|
+
claimedAt: { default: null, required: false, type: Date },
|
|
1552
|
+
claimedByUserId: {
|
|
1553
|
+
ref: "User",
|
|
1554
|
+
required: false,
|
|
1555
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1556
|
+
},
|
|
1557
|
+
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
1558
|
+
claimToken: { default: null, required: false, type: String },
|
|
1559
|
+
claimTokenExpiresAt: { default: null, required: false, type: Date },
|
|
1560
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
1561
|
+
email: { required: true, type: String },
|
|
1562
|
+
invitations: { required: true, type: [invitationSchema] },
|
|
1563
|
+
name: { required: true, type: String },
|
|
1564
|
+
region: { required: true, type: String }
|
|
1565
|
+
},
|
|
1566
|
+
{ timestamps: true }
|
|
1567
|
+
);
|
|
1568
|
+
schema12.index({ name: 1 });
|
|
1569
|
+
schema12.index({ email: 1 });
|
|
1570
|
+
var UnregisteredVendorModel = mongoose16.models.UnregisteredVendor || mongoose16.model("UnregisteredVendor", schema12);
|
|
1571
|
+
|
|
1572
|
+
// src/mongoose/event/Event.ts
|
|
1573
|
+
import { EnumEventType as EnumEventType2 } from "@timardex/cluemart-shared";
|
|
1574
|
+
import mongoose17 from "mongoose";
|
|
1575
|
+
var MongooseSchema17 = mongoose17.Schema;
|
|
1576
|
+
var schema13 = new MongooseSchema17(
|
|
1577
|
+
{
|
|
1578
|
+
...baseResourceFields,
|
|
1579
|
+
// Importing base resource fields from global.ts
|
|
1580
|
+
claimed: { default: true, required: false, type: Boolean },
|
|
1581
|
+
dateTime: { required: true, type: [dateTimeSchema2] },
|
|
1582
|
+
eventInfoId: {
|
|
1583
|
+
ref: "EventInfo",
|
|
1584
|
+
required: false,
|
|
1585
|
+
type: mongoose17.Schema.Types.ObjectId
|
|
1586
|
+
},
|
|
1587
|
+
eventType: {
|
|
1588
|
+
enum: Object.values(EnumEventType2),
|
|
1589
|
+
required: true,
|
|
1590
|
+
type: String
|
|
1591
|
+
},
|
|
1592
|
+
googlePlaceId: {
|
|
1593
|
+
default: null,
|
|
1594
|
+
required: false,
|
|
1595
|
+
type: String
|
|
1596
|
+
},
|
|
1597
|
+
location: {
|
|
1598
|
+
required: true,
|
|
1599
|
+
type: locationsSchema
|
|
1600
|
+
},
|
|
1601
|
+
nzbn: { required: true, type: String },
|
|
1602
|
+
provider: { required: false, type: String },
|
|
1603
|
+
rainOrShine: { required: true, type: Boolean },
|
|
1604
|
+
relations: {
|
|
1605
|
+
default: [],
|
|
1606
|
+
required: false,
|
|
1607
|
+
type: [resourceRelationsSchema]
|
|
1608
|
+
},
|
|
1609
|
+
shareRelation: { required: false, type: socialShareResourceSchema },
|
|
1610
|
+
tags: { required: true, type: [String] }
|
|
1611
|
+
},
|
|
1612
|
+
{ timestamps: true }
|
|
1613
|
+
);
|
|
1614
|
+
schema13.index({ name: 1 });
|
|
1615
|
+
schema13.index({ description: 1 });
|
|
1616
|
+
schema13.index({ region: 1 });
|
|
1617
|
+
schema13.index({ "location.geo": "2dsphere" });
|
|
1618
|
+
schema13.index({ tags: 1 });
|
|
1619
|
+
schema13.index({ deletedAt: 1 });
|
|
1620
|
+
schema13.index({ "dateTime.dateStatus": 1 });
|
|
1621
|
+
schema13.index({ slug: 1 });
|
|
1622
|
+
schema13.index({ name: "text", description: "text", tags: "text" });
|
|
1623
|
+
schema13.index({ "owner.userId": 1, deletedAt: 1 });
|
|
1624
|
+
schema13.plugin(searchNamePlugin);
|
|
1625
|
+
var EventModel = mongoose17.models.Event || mongoose17.model("Event", schema13);
|
|
1626
|
+
|
|
1627
|
+
// src/mongoose/Partner.ts
|
|
1628
|
+
import { EnumPartnerType } from "@timardex/cluemart-shared";
|
|
1629
|
+
import mongoose18 from "mongoose";
|
|
1630
|
+
var MongooseSchema18 = mongoose18.Schema;
|
|
1631
|
+
var schema14 = new MongooseSchema18(
|
|
1632
|
+
{
|
|
1633
|
+
...baseResourceFields,
|
|
1634
|
+
location: {
|
|
1635
|
+
required: true,
|
|
1636
|
+
type: locationsSchema
|
|
1637
|
+
},
|
|
1638
|
+
nzbn: { required: true, type: String },
|
|
1639
|
+
partnerType: {
|
|
1640
|
+
enum: Object.values(EnumPartnerType),
|
|
1641
|
+
required: true,
|
|
1642
|
+
type: String
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
{ timestamps: true }
|
|
1646
|
+
);
|
|
1647
|
+
schema14.index({ name: 1 });
|
|
1648
|
+
schema14.index({ description: 1 });
|
|
1649
|
+
schema14.index({ region: 1 });
|
|
1650
|
+
schema14.index({ "location.geo": "2dsphere" });
|
|
1651
|
+
schema14.index({ slug: 1 });
|
|
1652
|
+
schema14.index({ name: "text", description: "text" });
|
|
1653
|
+
schema14.index({ "owner.userId": 1, deletedAt: 1 });
|
|
1654
|
+
schema14.plugin(searchNamePlugin);
|
|
1655
|
+
var PartnerModel = mongoose18.models.Partner || mongoose18.model("Partner", schema14);
|
|
1656
|
+
|
|
1657
|
+
// src/mongoose/Post.ts
|
|
1658
|
+
import {
|
|
1659
|
+
EnumPostContentType,
|
|
1660
|
+
EnumPostType as EnumPostType2,
|
|
1661
|
+
EnumResourceType as EnumResourceType5
|
|
1662
|
+
} from "@timardex/cluemart-shared";
|
|
1663
|
+
import mongoose19, { Schema } from "mongoose";
|
|
1664
|
+
var MongooseSchema19 = mongoose19.Schema;
|
|
1665
|
+
var contentSchema = new MongooseSchema19(
|
|
1666
|
+
{
|
|
1667
|
+
contentData: Schema.Types.Mixed,
|
|
1668
|
+
contentOrder: { required: true, type: Number },
|
|
1669
|
+
contentType: {
|
|
1670
|
+
enum: Object.values(EnumPostContentType),
|
|
1671
|
+
required: true,
|
|
1672
|
+
type: String
|
|
1673
|
+
}
|
|
1674
|
+
},
|
|
1675
|
+
{ _id: false }
|
|
1676
|
+
);
|
|
1677
|
+
var resourceSchema = new MongooseSchema19(
|
|
1678
|
+
{
|
|
1679
|
+
resourceId: { required: true, type: String },
|
|
1680
|
+
resourceRegion: { required: true, type: String },
|
|
1681
|
+
resourceSlug: { required: true, type: String },
|
|
1682
|
+
resourceType: {
|
|
1683
|
+
enum: Object.values(EnumResourceType5),
|
|
1684
|
+
required: true,
|
|
1685
|
+
type: String
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1688
|
+
{ _id: false }
|
|
1689
|
+
);
|
|
1690
|
+
var schema15 = new MongooseSchema19(
|
|
1691
|
+
{
|
|
1692
|
+
active: { default: false, required: true, type: Boolean },
|
|
1693
|
+
approvedAt: { default: null, required: false, type: Date },
|
|
1694
|
+
caption: { required: true, type: String },
|
|
1695
|
+
content: {
|
|
1696
|
+
default: [],
|
|
1697
|
+
required: false,
|
|
1698
|
+
type: [contentSchema]
|
|
1699
|
+
},
|
|
1700
|
+
cover: {
|
|
1701
|
+
required: false,
|
|
1702
|
+
type: ResourceImageTypeSchema
|
|
1703
|
+
},
|
|
1704
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
1705
|
+
postType: {
|
|
1706
|
+
enum: Object.values(EnumPostType2),
|
|
1707
|
+
required: true,
|
|
1708
|
+
type: String
|
|
1709
|
+
},
|
|
1710
|
+
resource: {
|
|
1711
|
+
required: false,
|
|
1712
|
+
type: resourceSchema
|
|
1713
|
+
},
|
|
1714
|
+
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
1715
|
+
slug: { required: true, type: String },
|
|
1716
|
+
tags: { default: [], required: false, type: [String] },
|
|
1717
|
+
title: { required: true, type: String }
|
|
1718
|
+
},
|
|
1719
|
+
{ timestamps: true }
|
|
1720
|
+
);
|
|
1721
|
+
schema15.index({ title: 1 });
|
|
1722
|
+
schema15.index({ tags: 1 });
|
|
1723
|
+
schema15.index({ postType: 1, slug: 1 }, { unique: true });
|
|
1724
|
+
var PostModel = mongoose19.models.Post || mongoose19.model("Post", schema15);
|
|
1725
|
+
|
|
1726
|
+
// src/mongoose/AppSetting.ts
|
|
1727
|
+
import mongoose20 from "mongoose";
|
|
1728
|
+
var MongooseSchema20 = mongoose20.Schema;
|
|
1729
|
+
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
1730
|
+
var AppSettingSchema = new MongooseSchema20(
|
|
1731
|
+
{
|
|
1732
|
+
activeSchoolsStudentCountTotal: {
|
|
1733
|
+
default: 0,
|
|
1734
|
+
required: true,
|
|
1735
|
+
type: Number
|
|
1736
|
+
},
|
|
1737
|
+
activeSchoolsStudentCountUpdatedAt: {
|
|
1738
|
+
default: Date.now,
|
|
1739
|
+
required: true,
|
|
1740
|
+
type: Date
|
|
1741
|
+
},
|
|
1742
|
+
appVersion: { default: "1.0.1", required: true, type: String },
|
|
1743
|
+
isOfflineMode: { default: false, required: true, type: Boolean },
|
|
1744
|
+
key: {
|
|
1745
|
+
default: APP_SETTINGS_ID,
|
|
1746
|
+
immutable: true,
|
|
1747
|
+
// ✅ prevents changes after creation
|
|
1748
|
+
required: true,
|
|
1749
|
+
type: String,
|
|
1750
|
+
unique: true
|
|
1751
|
+
// ✅ allowed here
|
|
1752
|
+
},
|
|
1753
|
+
minimumRedeemableAffiliatePoints: {
|
|
1754
|
+
default: 500,
|
|
1755
|
+
required: true,
|
|
1756
|
+
type: Number
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
{ timestamps: true }
|
|
1760
|
+
);
|
|
1761
|
+
var AppSettingModel = mongoose20.models.AppSetting || mongoose20.model("AppSetting", AppSettingSchema);
|
|
1762
|
+
|
|
1763
|
+
// src/mongoose/game/Game.ts
|
|
1764
|
+
import {
|
|
1765
|
+
EnumGameStatus,
|
|
1766
|
+
EnumGameType
|
|
1767
|
+
} from "@timardex/cluemart-shared";
|
|
1768
|
+
import mongoose24 from "mongoose";
|
|
1769
|
+
|
|
1770
|
+
// src/mongoose/game/DailyClue.ts
|
|
1771
|
+
import mongoose22 from "mongoose";
|
|
1772
|
+
|
|
1773
|
+
// src/mongoose/game/utils.ts
|
|
1774
|
+
import mongoose21 from "mongoose";
|
|
1775
|
+
var MongooseSchema21 = mongoose21.Schema;
|
|
1776
|
+
var schemaGameDate = new MongooseSchema21(
|
|
1777
|
+
{
|
|
1778
|
+
endDate: { required: true, type: Date },
|
|
1779
|
+
startDate: { required: true, type: Date }
|
|
1780
|
+
},
|
|
1781
|
+
{ _id: false }
|
|
1782
|
+
);
|
|
1783
|
+
|
|
1784
|
+
// src/mongoose/game/DailyClue.ts
|
|
1785
|
+
var MongooseSchema22 = mongoose22.Schema;
|
|
1786
|
+
var schemaLetters = new MongooseSchema22(
|
|
1787
|
+
{
|
|
1788
|
+
collected: { required: false, type: [String] },
|
|
1789
|
+
solutionShuffled: { required: true, type: [String] }
|
|
1790
|
+
// todaysLetter and todaysPlacement is generated in the backend, so they are not required
|
|
1791
|
+
},
|
|
1792
|
+
{ _id: false }
|
|
1793
|
+
);
|
|
1794
|
+
var schemaDailyClueBaseGame = new MongooseSchema22(
|
|
1795
|
+
{
|
|
1796
|
+
gameDate: { required: true, type: schemaGameDate },
|
|
1797
|
+
gameSolution: { required: true, type: String }
|
|
1798
|
+
},
|
|
1799
|
+
{ _id: false }
|
|
1800
|
+
);
|
|
1801
|
+
var schemaDailyClueGameData = new MongooseSchema22(
|
|
1802
|
+
{
|
|
1803
|
+
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
1804
|
+
lastFoundDate: { default: null, required: false, type: Date },
|
|
1805
|
+
letterInfo: {
|
|
1806
|
+
required: true,
|
|
1807
|
+
type: schemaLetters
|
|
1808
|
+
},
|
|
1809
|
+
points: { default: 0, required: true, type: Number },
|
|
1810
|
+
streak: { default: 0, required: true, type: Number }
|
|
1811
|
+
},
|
|
1812
|
+
{ _id: false }
|
|
1813
|
+
);
|
|
1814
|
+
|
|
1815
|
+
// src/mongoose/game/PuzzleGame.ts
|
|
1816
|
+
import mongoose23 from "mongoose";
|
|
1817
|
+
var MongooseSchema23 = mongoose23.Schema;
|
|
1818
|
+
var schemaPuzzleAnswer = new MongooseSchema23(
|
|
1819
|
+
{
|
|
1820
|
+
answer: { required: true, type: String },
|
|
1821
|
+
answerId: { required: true, type: String },
|
|
1822
|
+
correct: { required: true, type: Boolean }
|
|
1823
|
+
},
|
|
1824
|
+
{ _id: false }
|
|
1825
|
+
);
|
|
1826
|
+
var schemaPuzzleQuestion = new MongooseSchema23(
|
|
1827
|
+
{
|
|
1828
|
+
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
1829
|
+
question: { required: true, type: String },
|
|
1830
|
+
questionId: { required: true, type: String }
|
|
1831
|
+
},
|
|
1832
|
+
{ _id: false }
|
|
1833
|
+
);
|
|
1834
|
+
var schemaPuzzleBaseGame = new MongooseSchema23(
|
|
1835
|
+
{
|
|
1836
|
+
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
1837
|
+
},
|
|
1838
|
+
{ _id: false }
|
|
1839
|
+
);
|
|
1840
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema23(
|
|
1841
|
+
{
|
|
1842
|
+
questionId: { required: true, type: String },
|
|
1843
|
+
selectedAnswerId: { required: true, type: String }
|
|
1844
|
+
},
|
|
1845
|
+
{ _id: false }
|
|
1846
|
+
);
|
|
1847
|
+
var schemaPuzzleGameData = new MongooseSchema23(
|
|
1848
|
+
{
|
|
1849
|
+
answeredQuestions: {
|
|
1850
|
+
default: null,
|
|
1851
|
+
required: false,
|
|
1852
|
+
type: [schemaPuzzleAnsweredQuestion]
|
|
1853
|
+
},
|
|
1854
|
+
gameFields: { required: true, type: schemaPuzzleBaseGame },
|
|
1855
|
+
points: { default: 0, required: true, type: Number },
|
|
1856
|
+
streak: { default: 0, required: true, type: Number }
|
|
1857
|
+
},
|
|
1858
|
+
{ _id: false }
|
|
1859
|
+
);
|
|
1860
|
+
|
|
1861
|
+
// src/mongoose/game/Game.ts
|
|
1862
|
+
var MongooseSchema24 = mongoose24.Schema;
|
|
1863
|
+
var gameDataSchemas = {
|
|
1864
|
+
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
1865
|
+
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
1866
|
+
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
1867
|
+
};
|
|
1868
|
+
var gameDataDefinition = Object.fromEntries(
|
|
1869
|
+
Object.entries(gameDataSchemas).map(([key, schema20]) => [
|
|
1870
|
+
key,
|
|
1871
|
+
{ default: null, required: false, type: schema20 }
|
|
1872
|
+
])
|
|
1873
|
+
);
|
|
1874
|
+
var gameHistorySchema = new MongooseSchema24(
|
|
1875
|
+
{
|
|
1876
|
+
createdAt: { required: true, type: Date },
|
|
1877
|
+
gameDate: { required: true, type: schemaGameDate },
|
|
1878
|
+
gameStatus: {
|
|
1879
|
+
enum: Object.values(EnumGameStatus),
|
|
1880
|
+
required: true,
|
|
1881
|
+
type: String
|
|
1882
|
+
},
|
|
1883
|
+
gameTitle: { required: true, type: String },
|
|
1884
|
+
gameType: {
|
|
1885
|
+
enum: Object.values(EnumGameType),
|
|
1886
|
+
required: true,
|
|
1887
|
+
type: String
|
|
1888
|
+
},
|
|
1889
|
+
gameTypeId: { required: true, type: String },
|
|
1890
|
+
pointsEarned: { default: 0, required: true, type: Number }
|
|
1891
|
+
},
|
|
1892
|
+
{ _id: false }
|
|
1893
|
+
);
|
|
1894
|
+
var gameTypeSchema = new MongooseSchema24(
|
|
1895
|
+
{
|
|
1896
|
+
active: { default: true, required: true, type: Boolean },
|
|
1897
|
+
gameData: gameDataDefinition,
|
|
1898
|
+
gameHistory: { default: [], required: true, type: [gameHistorySchema] },
|
|
1899
|
+
gameTitle: { required: true, type: String },
|
|
1900
|
+
gameType: {
|
|
1901
|
+
enum: Object.values(EnumGameType),
|
|
1902
|
+
required: true,
|
|
1903
|
+
type: String
|
|
1904
|
+
},
|
|
1905
|
+
gameTypeId: { required: true, type: String }
|
|
1906
|
+
},
|
|
1907
|
+
{ timestamps: true }
|
|
1908
|
+
);
|
|
1909
|
+
var schema16 = new MongooseSchema24(
|
|
1910
|
+
{
|
|
1911
|
+
active: { default: false, required: true, type: Boolean },
|
|
1912
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
1913
|
+
games: { default: [], required: false, type: [gameTypeSchema] },
|
|
1914
|
+
owner: {
|
|
1915
|
+
required: true,
|
|
1916
|
+
type: OwnerTypeSchema
|
|
1917
|
+
},
|
|
1918
|
+
points: { default: 0, required: true, type: Number }
|
|
1919
|
+
},
|
|
1920
|
+
{ timestamps: true }
|
|
1921
|
+
);
|
|
1922
|
+
var GameModel = mongoose24.models.Game || mongoose24.model("Game", schema16);
|
|
1923
|
+
|
|
1924
|
+
// src/mongoose/School.ts
|
|
1925
|
+
import mongoose25 from "mongoose";
|
|
1926
|
+
var MongooseSchema25 = mongoose25.Schema;
|
|
1927
|
+
var campaignsSchema = new MongooseSchema25(
|
|
1928
|
+
{
|
|
1929
|
+
endDate: { required: true, type: Date },
|
|
1930
|
+
name: { required: true, type: String },
|
|
1931
|
+
startDate: { required: true, type: Date }
|
|
1932
|
+
},
|
|
1933
|
+
{ _id: false }
|
|
1934
|
+
);
|
|
1935
|
+
var schema17 = new MongooseSchema25(
|
|
1936
|
+
{
|
|
1937
|
+
// New schools are active by default
|
|
1938
|
+
active: { default: false, required: true, type: Boolean },
|
|
1939
|
+
approvedAt: { default: null, required: false, type: Date },
|
|
1940
|
+
campaigns: { required: false, type: [campaignsSchema] },
|
|
1941
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
1942
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
1943
|
+
location: {
|
|
1944
|
+
required: true,
|
|
1945
|
+
type: locationsSchema
|
|
1946
|
+
},
|
|
1947
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
1948
|
+
name: { required: true, type: String },
|
|
1949
|
+
overallPoints: { default: 0, required: false, type: Number },
|
|
1950
|
+
owner: {
|
|
1951
|
+
required: true,
|
|
1952
|
+
type: OwnerTypeSchema
|
|
1953
|
+
},
|
|
1954
|
+
region: { required: true, type: String },
|
|
1955
|
+
schoolCode: { required: true, type: String },
|
|
1956
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
1957
|
+
studentCount: { default: 0, required: true, type: Number },
|
|
1958
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
1959
|
+
},
|
|
1960
|
+
{ timestamps: true }
|
|
1961
|
+
);
|
|
1962
|
+
schema17.index(
|
|
1963
|
+
{ schoolCode: 1 },
|
|
1964
|
+
{
|
|
1965
|
+
partialFilterExpression: { active: true, deletedAt: null },
|
|
1966
|
+
unique: true
|
|
1967
|
+
}
|
|
1968
|
+
);
|
|
1969
|
+
var SchoolModel = mongoose25.models.School || mongoose25.model("School", schema17);
|
|
1970
|
+
|
|
1971
|
+
// src/mongoose/Affiliate.ts
|
|
1972
|
+
import {
|
|
1973
|
+
EnumAffiliateParticipantType,
|
|
1974
|
+
EnumAffiliateRewardType,
|
|
1975
|
+
EnumResourceType as EnumResourceType6
|
|
1976
|
+
} from "@timardex/cluemart-shared";
|
|
1977
|
+
import mongoose26 from "mongoose";
|
|
1978
|
+
var MongooseSchema26 = mongoose26.Schema;
|
|
1979
|
+
var affiliateRewardSchema = new MongooseSchema26(
|
|
1980
|
+
{
|
|
1981
|
+
createdAt: { required: true, type: Date },
|
|
1982
|
+
redeemedAt: { default: null, required: false, type: Date },
|
|
1983
|
+
rewardDescription: { required: true, type: String },
|
|
1984
|
+
rewardType: {
|
|
1985
|
+
enum: Object.values(EnumAffiliateRewardType),
|
|
1986
|
+
required: true,
|
|
1987
|
+
type: String
|
|
1988
|
+
},
|
|
1989
|
+
rewardValue: { required: true, type: Number }
|
|
1990
|
+
},
|
|
1991
|
+
{ _id: false }
|
|
1992
|
+
);
|
|
1993
|
+
var affiliateResourceSchema = new MongooseSchema26(
|
|
1994
|
+
{
|
|
1995
|
+
resourceActive: { default: true, required: true, type: Boolean },
|
|
1996
|
+
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
1997
|
+
resourceId: {
|
|
1998
|
+
required: true,
|
|
1999
|
+
type: mongoose26.Schema.Types.ObjectId
|
|
2000
|
+
},
|
|
2001
|
+
resourceName: { required: true, type: String },
|
|
2002
|
+
resourceOwner: {
|
|
2003
|
+
required: true,
|
|
2004
|
+
type: OwnerTypeSchema
|
|
2005
|
+
},
|
|
2006
|
+
resourceType: {
|
|
2007
|
+
enum: Object.values(EnumResourceType6),
|
|
2008
|
+
required: true,
|
|
2009
|
+
type: String
|
|
2010
|
+
},
|
|
2011
|
+
rewards: {
|
|
2012
|
+
default: [],
|
|
2013
|
+
required: false,
|
|
2014
|
+
type: [affiliateRewardSchema]
|
|
2015
|
+
}
|
|
2016
|
+
},
|
|
2017
|
+
{ _id: false }
|
|
2018
|
+
);
|
|
2019
|
+
var affiliateContactDetailsSchema = new MongooseSchema26(
|
|
2020
|
+
{
|
|
2021
|
+
mobilePhone: { required: true, type: String }
|
|
2022
|
+
},
|
|
2023
|
+
{ _id: false }
|
|
2024
|
+
);
|
|
2025
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema26(
|
|
2026
|
+
{
|
|
2027
|
+
accountHolderName: { required: true, type: String },
|
|
2028
|
+
accountNumber: { required: true, type: String }
|
|
2029
|
+
},
|
|
2030
|
+
{ _id: false }
|
|
2031
|
+
);
|
|
2032
|
+
var affiliateDetailsSchema = new MongooseSchema26(
|
|
2033
|
+
{
|
|
2034
|
+
bankAccountDetails: {
|
|
2035
|
+
required: true,
|
|
2036
|
+
type: affiliateBankAccountDetailsSchema
|
|
2037
|
+
},
|
|
2038
|
+
contactDetails: { required: true, type: affiliateContactDetailsSchema },
|
|
2039
|
+
email: { required: true, type: String },
|
|
2040
|
+
firstName: { required: true, type: String },
|
|
2041
|
+
irdNumber: { required: true, type: String },
|
|
2042
|
+
lastName: { required: true, type: String },
|
|
2043
|
+
location: { required: true, type: locationsSchema },
|
|
2044
|
+
participantType: {
|
|
2045
|
+
enum: Object.values(EnumAffiliateParticipantType),
|
|
2046
|
+
required: true,
|
|
2047
|
+
type: String
|
|
2048
|
+
},
|
|
2049
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
2050
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
2051
|
+
},
|
|
2052
|
+
{ _id: false }
|
|
2053
|
+
);
|
|
2054
|
+
var redeemHistorySchema = new MongooseSchema26(
|
|
2055
|
+
{
|
|
2056
|
+
paidAt: { default: null, required: false, type: Date },
|
|
2057
|
+
redeemedAt: { required: true, type: Date },
|
|
2058
|
+
rewardValue: { required: true, type: Number }
|
|
2059
|
+
},
|
|
2060
|
+
{ _id: false }
|
|
2061
|
+
);
|
|
2062
|
+
var schema18 = new MongooseSchema26(
|
|
2063
|
+
{
|
|
2064
|
+
active: { default: false, required: true, type: Boolean },
|
|
2065
|
+
affiliateBonusRewards: {
|
|
2066
|
+
default: [],
|
|
2067
|
+
required: false,
|
|
2068
|
+
type: [affiliateRewardSchema]
|
|
2069
|
+
},
|
|
2070
|
+
affiliateCode: { default: null, required: false, type: String },
|
|
2071
|
+
affiliateDetails: { required: false, type: affiliateDetailsSchema },
|
|
2072
|
+
affiliateResources: {
|
|
2073
|
+
default: [],
|
|
2074
|
+
required: false,
|
|
2075
|
+
type: [affiliateResourceSchema]
|
|
2076
|
+
},
|
|
2077
|
+
approvedAt: { default: null, required: false, type: Date },
|
|
2078
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
2079
|
+
overallPoints: { default: 0, required: true, type: Number },
|
|
2080
|
+
owner: {
|
|
2081
|
+
required: true,
|
|
2082
|
+
type: OwnerTypeSchema
|
|
2083
|
+
},
|
|
2084
|
+
redeemHistory: {
|
|
2085
|
+
default: [],
|
|
2086
|
+
required: false,
|
|
2087
|
+
type: [redeemHistorySchema]
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
{ timestamps: true }
|
|
2091
|
+
);
|
|
2092
|
+
schema18.index(
|
|
2093
|
+
{ affiliateCode: 1 },
|
|
2094
|
+
{
|
|
2095
|
+
partialFilterExpression: { active: true, deletedAt: null },
|
|
2096
|
+
unique: true
|
|
2097
|
+
}
|
|
2098
|
+
);
|
|
2099
|
+
var AffiliateModel = mongoose26.models.Affiliate || mongoose26.model("Affiliate", schema18);
|
|
2100
|
+
|
|
2101
|
+
// src/mongoose/Coupon.ts
|
|
2102
|
+
import {
|
|
2103
|
+
EnumCouponQualificationType,
|
|
2104
|
+
EnumResourceType as EnumResourceType7
|
|
2105
|
+
} from "@timardex/cluemart-shared";
|
|
2106
|
+
import mongoose27 from "mongoose";
|
|
2107
|
+
var MongooseSchema27 = mongoose27.Schema;
|
|
2108
|
+
var couponOptionSchema = new MongooseSchema27(
|
|
2109
|
+
{
|
|
2110
|
+
buy: { required: false, type: Number },
|
|
2111
|
+
get: { required: false, type: Number },
|
|
2112
|
+
maxRewardCount: { required: false, type: Number },
|
|
2113
|
+
type: {
|
|
2114
|
+
enum: Object.values(EnumCouponQualificationType),
|
|
2115
|
+
required: true,
|
|
2116
|
+
type: String
|
|
2117
|
+
},
|
|
2118
|
+
unit: { required: false, type: String },
|
|
2119
|
+
visits: { required: false, type: Number }
|
|
2120
|
+
},
|
|
2121
|
+
{ _id: false }
|
|
2122
|
+
);
|
|
2123
|
+
var couponVendorProductSchema = new MongooseSchema27(
|
|
2124
|
+
{
|
|
2125
|
+
couponId: {
|
|
2126
|
+
required: true,
|
|
2127
|
+
type: mongoose27.Schema.Types.ObjectId
|
|
2128
|
+
},
|
|
2129
|
+
productId: {
|
|
2130
|
+
required: true,
|
|
2131
|
+
type: mongoose27.Schema.Types.ObjectId
|
|
2132
|
+
},
|
|
2133
|
+
vendorCouponId: {
|
|
2134
|
+
required: false,
|
|
2135
|
+
type: mongoose27.Schema.Types.ObjectId
|
|
2136
|
+
},
|
|
2137
|
+
vendorId: {
|
|
2138
|
+
ref: "Vendor",
|
|
2139
|
+
required: true,
|
|
2140
|
+
type: mongoose27.Schema.Types.ObjectId
|
|
2141
|
+
}
|
|
2142
|
+
},
|
|
2143
|
+
{ _id: false }
|
|
2144
|
+
);
|
|
2145
|
+
var couponCodeSchema = new MongooseSchema27(
|
|
2146
|
+
{
|
|
2147
|
+
code: { required: true, type: String },
|
|
2148
|
+
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
2149
|
+
shareableQrCode: { required: true, type: ResourceImageTypeSchema }
|
|
2150
|
+
},
|
|
2151
|
+
{ _id: false }
|
|
2152
|
+
);
|
|
2153
|
+
var couponParticipantUserSchema = new MongooseSchema27(
|
|
2154
|
+
{
|
|
2155
|
+
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2156
|
+
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
2157
|
+
couponRedeemedAt: { default: null, required: false, type: Date },
|
|
2158
|
+
couponRedeemedCount: { default: 0, required: true, type: Number },
|
|
2159
|
+
userId: {
|
|
2160
|
+
ref: "User",
|
|
2161
|
+
required: true,
|
|
2162
|
+
type: mongoose27.Schema.Types.ObjectId
|
|
2163
|
+
}
|
|
2164
|
+
},
|
|
2165
|
+
{ timestamps: true }
|
|
2166
|
+
);
|
|
2167
|
+
var couponDataSchema = new MongooseSchema27(
|
|
2168
|
+
{
|
|
2169
|
+
active: { default: true, required: true, type: Boolean },
|
|
2170
|
+
couponCode: { required: false, type: couponCodeSchema },
|
|
2171
|
+
couponDescription: { required: true, type: String },
|
|
2172
|
+
couponOption: { required: true, type: couponOptionSchema },
|
|
2173
|
+
couponVendorProducts: {
|
|
2174
|
+
required: false,
|
|
2175
|
+
type: [couponVendorProductSchema]
|
|
2176
|
+
},
|
|
2177
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
2178
|
+
endDate: { required: true, type: Date },
|
|
2179
|
+
participantUsers: {
|
|
2180
|
+
default: null,
|
|
2181
|
+
required: false,
|
|
2182
|
+
type: [couponParticipantUserSchema]
|
|
2183
|
+
},
|
|
2184
|
+
resourceId: { required: true, type: String },
|
|
2185
|
+
resourceType: {
|
|
2186
|
+
enum: Object.values(EnumResourceType7),
|
|
2187
|
+
required: true,
|
|
2188
|
+
type: String
|
|
2189
|
+
},
|
|
2190
|
+
startDate: { required: true, type: Date }
|
|
2191
|
+
},
|
|
2192
|
+
{ timestamps: true }
|
|
2193
|
+
);
|
|
2194
|
+
var schema19 = new MongooseSchema27(
|
|
2195
|
+
{
|
|
2196
|
+
active: { default: true, required: true, type: Boolean },
|
|
2197
|
+
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
2198
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
2199
|
+
owner: {
|
|
2200
|
+
required: true,
|
|
2201
|
+
type: OwnerTypeSchema
|
|
2202
|
+
}
|
|
2203
|
+
},
|
|
2204
|
+
{ timestamps: true }
|
|
2205
|
+
);
|
|
2206
|
+
schema19.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2207
|
+
schema19.index({ "couponData.participantUsers.userId": 1 });
|
|
2208
|
+
var CouponModel = mongoose27.models.Coupon || mongoose27.model("Coupon", schema19);
|
|
2209
|
+
|
|
2210
|
+
export {
|
|
2211
|
+
AdModel,
|
|
2212
|
+
BILLING_CATALOG_COLLECTION_NAME,
|
|
2213
|
+
BillingCatalogModel,
|
|
2214
|
+
buildInitialBillingCatalogEntries,
|
|
2215
|
+
getBillingCatalogDefinition,
|
|
2216
|
+
ChatModel,
|
|
2217
|
+
ChatReportModel,
|
|
2218
|
+
StallTypeSchema,
|
|
2219
|
+
refundPolicySchema,
|
|
2220
|
+
EventInfoModel,
|
|
2221
|
+
relationDatesSchema,
|
|
2222
|
+
RelationTypeSchema,
|
|
2223
|
+
RelationModel,
|
|
2224
|
+
OwnerTypeSchema,
|
|
2225
|
+
SocialMediaTypeSchema,
|
|
2226
|
+
ResourceImageTypeSchema,
|
|
2227
|
+
CategorySchema,
|
|
2228
|
+
userLicenseSchema,
|
|
2229
|
+
ContactDetailsSchema,
|
|
2230
|
+
termsAgreementSchema,
|
|
2231
|
+
resourceRelationsSchema,
|
|
2232
|
+
dateTimeSchema2 as dateTimeSchema,
|
|
2233
|
+
locationGeoSchema,
|
|
2234
|
+
locationsSchema,
|
|
2235
|
+
relatedPostSchema,
|
|
2236
|
+
socialShareResourceSchema,
|
|
2237
|
+
baseResourceFields,
|
|
2238
|
+
GoogleImportedMarketModel,
|
|
2239
|
+
NotificationModel,
|
|
2240
|
+
PushTokenModel,
|
|
2241
|
+
ResourceActivityModel,
|
|
2242
|
+
UserModel,
|
|
2243
|
+
VerificationTokenModel,
|
|
2244
|
+
vendorProductTypeSchema,
|
|
2245
|
+
VendorModel,
|
|
2246
|
+
VendorInfoModel,
|
|
2247
|
+
UnregisteredVendorModel,
|
|
2248
|
+
EventModel,
|
|
2249
|
+
PartnerModel,
|
|
2250
|
+
PostModel,
|
|
2251
|
+
APP_SETTINGS_ID,
|
|
2252
|
+
AppSettingModel,
|
|
2253
|
+
GameModel,
|
|
2254
|
+
SchoolModel,
|
|
2255
|
+
AffiliateModel,
|
|
2256
|
+
CouponModel
|
|
2257
|
+
};
|
|
2258
|
+
//# sourceMappingURL=chunk-IICIHY26.mjs.map
|