@timardex/cluemart-server-shared 2.2.0 → 2.2.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.
@@ -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-Bq-lT7a2.mjs';
4
+ import { O as ObjectId } from './index-CmtBYjpi.mjs';
5
5
 
6
6
  type SchemaRelatedPostType = Omit<RelatedPostType, "postId"> & {
7
7
  postId: 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-Bq-lT7a2.js';
4
+ import { O as ObjectId } from './index-CmtBYjpi.js';
5
5
 
6
6
  type SchemaRelatedPostType = Omit<RelatedPostType, "postId"> & {
7
7
  postId: ObjectId;
@@ -1083,16 +1083,24 @@ import {
1083
1083
  } from "@timardex/cluemart-shared";
1084
1084
  import mongoose11 from "mongoose";
1085
1085
  var MongooseSchema7 = mongoose11.Schema;
1086
+ var notificationDataSchema = new MongooseSchema7(
1087
+ {
1088
+ resourceId: { required: true, type: String },
1089
+ resourceName: { required: true, type: String },
1090
+ resourceType: {
1091
+ enum: Object.values(EnumNotificationResourceType),
1092
+ required: true,
1093
+ type: String
1094
+ }
1095
+ },
1096
+ { _id: false }
1097
+ );
1086
1098
  var schema8 = new MongooseSchema7(
1087
1099
  {
1088
1100
  data: {
1089
- resourceId: { required: true, type: String },
1090
- resourceName: { required: true, type: String },
1091
- resourceType: {
1092
- enum: Object.values(EnumNotificationResourceType),
1093
- required: true,
1094
- type: String
1095
- }
1101
+ default: null,
1102
+ required: false,
1103
+ type: notificationDataSchema
1096
1104
  },
1097
1105
  isRead: { default: false, index: true, required: true, type: Boolean },
1098
1106
  message: { required: true, type: String },
@@ -2513,6 +2521,62 @@ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2513
2521
  schema24.index({ "couponData.participantUsers.userId": 1 });
2514
2522
  var CouponModel = mongoose32.models.Coupon || mongoose32.model("Coupon", schema24);
2515
2523
 
2524
+ // src/mongoose/Impersonation.ts
2525
+ import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
2526
+ import mongoose33 from "mongoose";
2527
+ var MongooseSchema28 = mongoose33.Schema;
2528
+ var impersonationSessionSchema = new MongooseSchema28(
2529
+ {
2530
+ expiresAt: { expires: 0, required: true, type: Date },
2531
+ impersonatedUserId: {
2532
+ index: true,
2533
+ ref: "User",
2534
+ required: true,
2535
+ type: mongoose33.Schema.Types.ObjectId
2536
+ },
2537
+ impersonatorUserId: {
2538
+ index: true,
2539
+ ref: "User",
2540
+ required: true,
2541
+ type: mongoose33.Schema.Types.ObjectId
2542
+ },
2543
+ refreshToken: { required: true, type: String }
2544
+ },
2545
+ { timestamps: true }
2546
+ );
2547
+ var ImpersonationSessionModel = mongoose33.models.ImpersonationSession || mongoose33.model(
2548
+ "ImpersonationSession",
2549
+ impersonationSessionSchema
2550
+ );
2551
+ var impersonationAuditSchema = new MongooseSchema28(
2552
+ {
2553
+ action: { enum: ["start", "end"], required: true, type: String },
2554
+ endReason: { type: String },
2555
+ impersonatedUserId: {
2556
+ ref: "User",
2557
+ required: true,
2558
+ type: mongoose33.Schema.Types.ObjectId
2559
+ },
2560
+ impersonatorUserId: {
2561
+ ref: "User",
2562
+ required: true,
2563
+ type: mongoose33.Schema.Types.ObjectId
2564
+ },
2565
+ resourceId: { type: mongoose33.Schema.Types.ObjectId },
2566
+ resourceType: { enum: Object.values(EnumResourceType8), type: String },
2567
+ sessionId: {
2568
+ ref: "ImpersonationSession",
2569
+ required: true,
2570
+ type: mongoose33.Schema.Types.ObjectId
2571
+ }
2572
+ },
2573
+ { timestamps: true }
2574
+ );
2575
+ var ImpersonationAuditModel = mongoose33.models.ImpersonationAudit || mongoose33.model(
2576
+ "ImpersonationAudit",
2577
+ impersonationAuditSchema
2578
+ );
2579
+
2516
2580
  export {
2517
2581
  schemaAdresource,
2518
2582
  AdModel,
@@ -2566,6 +2630,8 @@ export {
2566
2630
  GameModel,
2567
2631
  SchoolModel,
2568
2632
  AffiliateModel,
2569
- CouponModel
2633
+ CouponModel,
2634
+ ImpersonationSessionModel,
2635
+ ImpersonationAuditModel
2570
2636
  };
2571
- //# sourceMappingURL=chunk-HLRUWJLN.mjs.map
2637
+ //# sourceMappingURL=chunk-TIGQ6F5T.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mongoose/ad/Ad.ts","../src/mongoose/ad/AdBillingCatalog.ts","../src/mongoose/ad/AdBooking.ts","../src/mongoose/ad/AdImpression.ts","../src/mongoose/ad/AdSettings.ts","../src/mongoose/BillingCatalog.ts","../src/mongoose/chat/Chat.ts","../src/mongoose/chat/ChatReport.ts","../src/mongoose/global.ts","../src/mongoose/GoogleImportedMarket.ts","../src/mongoose/searchNamePlugin.ts","../src/mongoose/Notification.ts","../src/mongoose/PushToken.ts","../src/mongoose/Relation.ts","../src/mongoose/event/EventInfo.ts","../src/mongoose/ResourceActivity.ts","../src/mongoose/User.ts","../src/mongoose/VerificationToken.ts","../src/mongoose/vendor/Vendor.ts","../src/mongoose/vendor/VendorInfo.ts","../src/mongoose/vendor/UnregisteredVendor.ts","../src/mongoose/event/Event.ts","../src/mongoose/event/EventDateArchive.ts","../src/mongoose/Partner.ts","../src/mongoose/Post.ts","../src/mongoose/AppSetting.ts","../src/mongoose/game/Game.ts","../src/mongoose/game/DailyClue.ts","../src/mongoose/game/utils.ts","../src/mongoose/game/PuzzleGame.ts","../src/mongoose/School.ts","../src/mongoose/Affiliate.ts","../src/mongoose/Coupon.ts","../src/mongoose/Impersonation.ts"],"sourcesContent":["import {\n EnumAdApprovalStatus,\n EnumAdBookingSlotKind,\n EnumAdPaymentStatus,\n AdType,\n EnumAdShowOn,\n EnumAdStatus,\n EnumAdStyle,\n EnumAdType,\n EnumResourceType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const schemaAdresource = new MongooseSchema<AdType[\"resource\"]>({\n adDescription: { required: true, type: String },\n adImage: { required: true, type: String },\n adStyle: {\n default: EnumAdStyle.BLOOM,\n enum: Object.values(EnumAdStyle),\n required: true,\n type: String,\n },\n adTitle: { required: true, type: String },\n adType: {\n default: EnumAdType.SPONSORED,\n enum: Object.values(EnumAdType),\n required: true,\n type: String,\n },\n resourceId: { required: true, type: String },\n resourceName: { required: true, type: String },\n resourceRegion: { required: true, type: String },\n resourceSlug: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n});\n\nconst schema = new MongooseSchema<AdType>(\n {\n active: { default: true, type: Boolean },\n adminManaged: { default: false, type: Boolean },\n approvalStatus: {\n enum: Object.values(EnumAdApprovalStatus),\n required: false,\n type: String,\n },\n bookingIds: {\n default: undefined,\n ref: \"AdBooking\",\n type: [mongoose.Schema.Types.ObjectId],\n },\n bookingKind: {\n enum: Object.values(EnumAdBookingSlotKind),\n required: false,\n type: String,\n },\n clicks: { default: 0, required: true, type: Number },\n end: { required: true, type: Date },\n impressions: { default: 0, required: true, type: Number },\n paymentStatus: {\n enum: Object.values(EnumAdPaymentStatus),\n required: false,\n type: String,\n },\n resource: { required: true, type: schemaAdresource },\n showOn: {\n default: [EnumAdShowOn.FRONT_PAGE],\n enum: Object.values(EnumAdShowOn),\n required: true,\n type: [String],\n },\n start: { required: true, type: Date },\n status: {\n default: EnumAdStatus.ACTIVE,\n enum: Object.values(EnumAdStatus),\n required: true,\n type: String,\n },\n targetRegion: { required: false, type: [String] },\n },\n {\n timestamps: true,\n },\n);\n\n// Background job queries (updateAdStatuses): filter on `end` first\n// (`expired`: end <= now, `active`: end > now && start <= now), so `end` must\n// lead, followed by the next range/equality keys in order of use.\nschema.index({\n end: 1,\n start: 1,\n status: 1,\n});\n\n// Hot read path (getAdsByRegion): `{ status, targetRegion: $in, active }`\n// sorted by `start` desc. Equality/$in keys must come before the sort key, so\n// `status` leads (most selective), then `targetRegion`, then `start` for the\n// sort. Order matters: with `start` leading, Mongo could only sort, not bound\n// the scan by status/region.\nschema.index({\n status: 1,\n targetRegion: 1,\n // eslint-disable-next-line sort-keys\n start: -1,\n});\n\nschema.index(\n { bookingIds: 1 },\n {\n partialFilterExpression: { bookingIds: { $exists: true } },\n unique: true,\n },\n);\n\nexport const AdModel =\n (mongoose.models.Ad as mongoose.Model<AdType>) ||\n mongoose.model<AdType>(\"Ad\", schema);\n","import { AdDailyPriceType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nexport const AD_BILLING_CATALOG_COLLECTION_NAME = \"adBillingCatalog\";\n\nconst schema = new mongoose.Schema<AdDailyPriceType>(\n {\n active: { default: true, required: true, type: Boolean },\n currency: {\n default: \"nzd\",\n enum: [\"nzd\"],\n immutable: true,\n required: true,\n type: String,\n },\n key: {\n enum: [\"front_page_day\", \"market_search_day\"],\n immutable: true,\n required: true,\n type: String,\n unique: true,\n },\n revision: { default: 1, min: 1, required: true, type: Number },\n unitAmount: {\n min: 1,\n required: true,\n type: Number,\n validate: {\n message: \"Daily ad price must be a positive integer amount of cents.\",\n validator: Number.isInteger,\n },\n },\n },\n { collection: AD_BILLING_CATALOG_COLLECTION_NAME, timestamps: true },\n);\n\nexport const AdBillingCatalogModel =\n (mongoose.models.AdBillingCatalog as mongoose.Model<AdDailyPriceType>) ||\n mongoose.model<AdDailyPriceType>(\n \"AdBillingCatalog\",\n schema,\n AD_BILLING_CATALOG_COLLECTION_NAME,\n );\n","import {\n AdBookingType,\n EnumAdApprovalStatus,\n EnumAdBookingSlotKind,\n EnumAdBookingState,\n EnumAdEntitlementSource,\n EnumAdShowOn,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { schemaAdresource } from \"./Ad\";\n\nconst liveStates = [\n EnumAdBookingState.HELD,\n EnumAdBookingState.PENDING_APPROVAL,\n EnumAdBookingState.APPROVED,\n];\n\nconst placementValues = [EnumAdShowOn.FRONT_PAGE, EnumAdShowOn.MARKET_SEARCH];\n\nconst schema = new mongoose.Schema<AdBookingType>(\n {\n adId: { default: null, ref: \"Ad\", type: String },\n approvalStatus: {\n default: EnumAdApprovalStatus.PENDING,\n enum: Object.values(EnumAdApprovalStatus),\n required: true,\n type: String,\n },\n checkoutAttemptId: { default: null, type: String },\n currency: { default: null, lowercase: true, type: String },\n dayKey: {\n immutable: true,\n match: /^\\d{4}-\\d{2}-\\d{2}$/,\n required: true,\n type: String,\n },\n entitlementClaimKey: { default: null, type: String },\n entitlementSource: {\n default: null,\n enum: Object.values(EnumAdEntitlementSource),\n type: String,\n },\n expiresAt: { default: null, type: Date },\n placement: {\n enum: placementValues,\n immutable: true,\n required: true,\n type: String,\n },\n purchaseKey: { default: null, immutable: true, type: String },\n region: {\n immutable: true,\n lowercase: true,\n required: true,\n trim: true,\n type: String,\n },\n resource: { required: true, type: schemaAdresource },\n slotKind: {\n enum: Object.values(EnumAdBookingSlotKind),\n immutable: true,\n required: true,\n type: String,\n },\n slotNumber: { immutable: true, min: 1, required: true, type: Number },\n state: {\n default: EnumAdBookingState.HELD,\n enum: Object.values(EnumAdBookingState),\n required: true,\n type: String,\n },\n stripeCheckoutSessionId: { default: null, type: String },\n stripePaymentIntentId: { default: null, type: String },\n unitAmount: { default: null, min: 1, type: Number },\n userId: { immutable: true, ref: \"User\", required: true, type: String },\n },\n { timestamps: true },\n);\n\nschema.pre(\n \"validate\",\n function validateSlot(this: mongoose.HydratedDocument<AdBookingType>) {\n if (!Number.isInteger(this.slotNumber)) {\n this.invalidate(\"slotNumber\", \"Ad booking slot must be an integer.\");\n return;\n }\n\n const maximum = this.slotKind === EnumAdBookingSlotKind.PAID ? 30 : 7;\n if (this.slotNumber < 1 || this.slotNumber > maximum) {\n this.invalidate(\n \"slotNumber\",\n `Ad booking slot must be between 1 and ${maximum}.`,\n );\n }\n\n if (\n this.slotKind === EnumAdBookingSlotKind.PAID &&\n this.state !== EnumAdBookingState.HELD &&\n this.state !== EnumAdBookingState.FAILED &&\n this.state !== EnumAdBookingState.CANCELLED &&\n (!this.unitAmount || !this.currency)\n ) {\n this.invalidate(\n \"unitAmount\",\n \"Paid ad booking must retain its checkout price.\",\n );\n }\n },\n);\n\n// A released slot can be reused while retaining failed/cancelled/rejected history.\n/* eslint-disable sort-keys -- Compound-index field order controls slot lookups. */\nschema.index(\n { region: 1, placement: 1, dayKey: 1, slotKind: 1, slotNumber: 1 },\n { unique: true, partialFilterExpression: { state: { $in: liveStates } } },\n);\nschema.index({ userId: 1, dayKey: -1 });\nschema.index(\n { checkoutAttemptId: 1 },\n {\n partialFilterExpression: { checkoutAttemptId: { $type: \"string\" } },\n unique: true,\n },\n);\nschema.index(\n { purchaseKey: 1 },\n {\n partialFilterExpression: {\n purchaseKey: { $type: \"string\" },\n state: { $in: liveStates },\n },\n unique: true,\n },\n);\nschema.index(\n { entitlementClaimKey: 1 },\n {\n partialFilterExpression: {\n entitlementClaimKey: { $type: \"string\" },\n state: { $in: liveStates },\n },\n unique: true,\n },\n);\nschema.index(\n { adId: 1, region: 1, placement: 1, dayKey: 1 },\n {\n partialFilterExpression: {\n entitlementSource: EnumAdEntitlementSource.ADMIN,\n state: { $in: liveStates },\n },\n unique: true,\n },\n);\n/* eslint-enable sort-keys */\nschema.index(\n { stripeCheckoutSessionId: 1 },\n {\n partialFilterExpression: { stripeCheckoutSessionId: { $type: \"string\" } },\n unique: true,\n },\n);\n\nexport const AdBookingModel =\n (mongoose.models.AdBooking as mongoose.Model<AdBookingType>) ||\n mongoose.model<AdBookingType>(\"AdBooking\", schema);\n","import { EnumAdShowOn } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nexport type AdImpressionEntry = {\n _id: string;\n adId: string;\n dayKey: string;\n placement: EnumAdShowOn.FRONT_PAGE | EnumAdShowOn.MARKET_SEARCH;\n recordedAt: Date;\n viewerSlotKey: string;\n};\n\nconst schema = new mongoose.Schema<AdImpressionEntry>(\n {\n _id: { required: true, type: String },\n adId: { required: true, type: String },\n dayKey: { match: /^\\d{4}-\\d{2}-\\d{2}$/, required: true, type: String },\n placement: {\n enum: [EnumAdShowOn.FRONT_PAGE, EnumAdShowOn.MARKET_SEARCH],\n required: true,\n type: String,\n },\n recordedAt: { default: Date.now, required: true, type: Date },\n viewerSlotKey: { required: true, type: String },\n },\n { collection: \"adImpressions\" },\n);\n\nschema.index({ adId: 1, recordedAt: 1 });\nschema.index({ adId: 1, placement: 1, viewerSlotKey: 1 }, { unique: true });\nschema.index({ recordedAt: 1 }, { expireAfterSeconds: 7 * 24 * 60 * 60 });\n/* eslint-disable-next-line sort-keys -- Compound index follows reporting query order. */\nschema.index({ dayKey: 1, placement: 1, adId: 1 });\n\nexport const AdImpressionModel =\n (mongoose.models.AdImpression as mongoose.Model<AdImpressionEntry>) ||\n mongoose.model<AdImpressionEntry>(\"AdImpression\", schema, \"adImpressions\");\n","import { AdSettingsType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nexport const DEFAULT_AD_SETTINGS: AdSettingsType = {\n _id: \"default\",\n approvalRequired: true,\n minAppearancesPerHour: 12,\n paidSlotsPerPlacement: 30,\n reservedSlotsPerPlacement: 7,\n rotationSeconds: 8,\n};\n\nconst schema = new mongoose.Schema<AdSettingsType>(\n {\n _id: { default: \"default\", enum: [\"default\"], type: String },\n approvalRequired: { default: true, required: true, type: Boolean },\n minAppearancesPerHour: {\n default: 12,\n min: 1,\n required: true,\n type: Number,\n validate: {\n message: \"Minimum appearances per hour must be a whole number.\",\n validator: Number.isInteger,\n },\n },\n paidSlotsPerPlacement: {\n default: 30,\n enum: [30],\n immutable: true,\n type: Number,\n },\n reservedSlotsPerPlacement: {\n default: 7,\n enum: [7],\n immutable: true,\n type: Number,\n },\n rotationSeconds: { default: 8, enum: [8], immutable: true, type: Number },\n },\n { collection: \"adSettings\", timestamps: true },\n);\n\nschema.pre(\"validate\", function validateRotationCapacity() {\n const availableRotationsPerHour = 3600 / this.rotationSeconds;\n if (\n this.minAppearancesPerHour *\n (this.paidSlotsPerPlacement + this.reservedSlotsPerPlacement) >\n availableRotationsPerHour\n ) {\n this.invalidate(\n \"minAppearancesPerHour\",\n \"The configured minimum exceeds the available rotation slots.\",\n );\n }\n});\n\nexport const AdSettingsModel =\n (mongoose.models.AdSettings as mongoose.Model<AdSettingsType>) ||\n mongoose.model<AdSettingsType>(\"AdSettings\", schema, \"adSettings\");\n","import {\n BILLING_CATALOG_CURRENCY,\n BILLING_CATALOG_DEFINITIONS,\n BILLING_CATALOG_KEYS,\n billingCatalogDefinitionMatches,\n BillingCatalogEntryType,\n BillingCatalogPriceHistoryEntry,\n EnumBillingPeriod,\n EnumUserLicence,\n INITIAL_BILLING_CATALOG,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const BILLING_CATALOG_COLLECTION_NAME = \"billingCatalog\";\n\nexport type SchemaBillingCatalogPriceHistoryEntry = Omit<\n BillingCatalogPriceHistoryEntry,\n \"changedBy\"\n> & {\n changedBy?: ObjectId | null;\n};\n\nexport type SchemaBillingCatalogEntry = Omit<\n BillingCatalogEntryType,\n \"_id\" | \"priceHistory\" | \"updatedBy\"\n> & {\n _id: ObjectId;\n priceHistory: SchemaBillingCatalogPriceHistoryEntry[];\n updatedBy?: ObjectId | null;\n};\n\nconst paidVendorLicences = [\n EnumUserLicence.PRO_VENDOR,\n EnumUserLicence.PRO_PLUS_VENDOR,\n] as const;\n\nconst supportedBillingPeriods = [\n EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n] as const;\n\nconst unitAmountField = {\n min: 1,\n required: true,\n type: Number,\n validate: {\n message: \"Billing catalogue price must be a positive integer.\",\n validator: Number.isInteger,\n },\n} as const;\n\nconst currencyField = {\n default: BILLING_CATALOG_CURRENCY,\n enum: [BILLING_CATALOG_CURRENCY],\n immutable: true,\n lowercase: true,\n required: true,\n trim: true,\n type: String,\n} as const;\n\nconst stripePriceIdField = {\n default: null,\n required: false,\n trim: true,\n type: String,\n} as const;\n\nconst stripeProductIdField = {\n default: null,\n required: false,\n trim: true,\n type: String,\n} as const;\n\nconst priceHistorySchema =\n new MongooseSchema<SchemaBillingCatalogPriceHistoryEntry>(\n {\n changedAt: { required: true, type: Date },\n changedBy: {\n default: null,\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n currency: currencyField,\n effectiveFrom: { required: true, type: Date },\n effectiveTo: { required: true, type: Date },\n stripePriceId: stripePriceIdField,\n stripeProductId: stripeProductIdField,\n unitAmount: unitAmountField,\n },\n { _id: false },\n );\n\nconst schema = new MongooseSchema<SchemaBillingCatalogEntry>(\n {\n active: { default: true, required: true, type: Boolean },\n billingPeriod: {\n enum: supportedBillingPeriods,\n immutable: true,\n required: true,\n type: String,\n },\n currency: currencyField,\n effectiveFrom: { default: Date.now, required: true, type: Date },\n key: {\n enum: BILLING_CATALOG_KEYS,\n immutable: true,\n required: true,\n type: String,\n unique: true,\n },\n licenceType: {\n enum: paidVendorLicences,\n immutable: true,\n required: true,\n type: String,\n },\n priceHistory: {\n default: [],\n required: true,\n type: [priceHistorySchema],\n },\n revision: {\n default: 1,\n min: 1,\n required: true,\n type: Number,\n validate: {\n message: \"Billing catalogue revision must be a positive integer.\",\n validator: Number.isInteger,\n },\n },\n stripePriceId: stripePriceIdField,\n stripeProductId: stripeProductIdField,\n taxInclusive: {\n default: true,\n immutable: true,\n required: true,\n type: Boolean,\n validate: {\n message: \"Billing catalogue prices must include GST.\",\n validator: (value: boolean) => value === true,\n },\n },\n unitAmount: unitAmountField,\n updatedBy: {\n default: null,\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n {\n collection: BILLING_CATALOG_COLLECTION_NAME,\n strict: true,\n timestamps: true,\n },\n);\n\nschema.pre(\"validate\", function validateDefinition() {\n if (!billingCatalogDefinitionMatches(this)) {\n this.invalidate(\n \"key\",\n \"Billing catalogue key does not match its licence and billing period.\",\n );\n }\n});\n\nschema.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });\nschema.index({ active: 1, licenceType: 1 });\nschema.index(\n { stripePriceId: 1 },\n {\n partialFilterExpression: { stripePriceId: { $type: \"string\" } },\n unique: true,\n },\n);\n\nexport const BillingCatalogModel =\n (mongoose.models\n .BillingCatalogEntry as mongoose.Model<SchemaBillingCatalogEntry>) ||\n mongoose.model<SchemaBillingCatalogEntry>(\n \"BillingCatalogEntry\",\n schema,\n BILLING_CATALOG_COLLECTION_NAME,\n );\n\n/**\n * Produces the four records used for an idempotent `$setOnInsert` catalogue\n * initialisation. Stripe identifiers deliberately start empty and are attached\n * only after Stripe successfully creates the matching Product and Price.\n */\nexport function buildInitialBillingCatalogEntries(now: Date = new Date()) {\n return INITIAL_BILLING_CATALOG.map((entry) => ({\n active: entry.active,\n billingPeriod: entry.billingPeriod,\n currency: entry.currency,\n effectiveFrom: new Date(now.getTime()),\n key: entry.key,\n licenceType: entry.licenceType,\n priceHistory: [],\n revision: 1,\n stripePriceId: null,\n stripeProductId: null,\n taxInclusive: entry.taxInclusive,\n unitAmount: entry.unitAmount,\n updatedBy: null,\n }));\n}\n\nexport function getBillingCatalogDefinition(\n key: (typeof BILLING_CATALOG_KEYS)[number],\n) {\n return BILLING_CATALOG_DEFINITIONS[key];\n}\n","import {\n ChatMessageType,\n ChatType,\n EnumChatType,\n ParticipantType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaChatMessageReplyPreviewType = Omit<\n NonNullable<ChatMessageType[\"replyPreview\"]>,\n \"senderId\"\n> & {\n senderId: ObjectId;\n};\n\nexport type SchemaChatMessageReactionType = Omit<\n NonNullable<ChatMessageType[\"likedBy\"]>[number],\n \"userId\"\n> & {\n userId: ObjectId;\n};\n\nexport type SchemaChatMessageSeenType = Omit<\n NonNullable<ChatMessageType[\"seenBy\"]>[number],\n \"userId\"\n> & {\n userId: ObjectId;\n};\n\nexport type SchemaChatMessageType = Omit<\n ChatMessageType,\n \"senderId\" | \"replyToMessageId\" | \"replyPreview\" | \"likedBy\" | \"seenBy\"\n> & {\n senderId: ObjectId;\n replyToMessageId?: ObjectId | null;\n replyPreview?: SchemaChatMessageReplyPreviewType | null;\n likedBy?: SchemaChatMessageReactionType[];\n seenBy?: SchemaChatMessageSeenType[];\n};\n\nexport type SchemaParticipantType = Omit<ParticipantType, \"userId\"> & {\n userId: ObjectId;\n};\n\nconst MessageReplyPreviewSchema =\n new MongooseSchema<SchemaChatMessageReplyPreviewType>(\n {\n contentPreview: { required: true, type: String },\n senderId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n senderName: { required: true, type: String },\n },\n { _id: false },\n );\n\nconst MessageReactionSchema = new MongooseSchema<SchemaChatMessageReactionType>(\n {\n createdAt: { required: true, type: Date },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\n);\n\nconst MessageSeenSchema = new MongooseSchema<SchemaChatMessageSeenType>(\n {\n seenAt: { required: true, type: Date },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\n);\n\nconst MessageSchema = new MongooseSchema<SchemaChatMessageType>(\n {\n content: { required: true, type: String },\n likedBy: { default: [], required: false, type: [MessageReactionSchema] },\n replyPreview: {\n required: false,\n type: MessageReplyPreviewSchema,\n },\n replyToMessageId: {\n ref: \"Chat.messages\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n seenBy: { default: [], required: false, type: [MessageSeenSchema] },\n senderId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\nexport type SchemaChatType = Omit<ChatType, \"participants\" | \"messages\"> & {\n participants: SchemaParticipantType[];\n messages: SchemaChatMessageType[];\n};\n\nconst ParticipantSchema = new MongooseSchema<SchemaParticipantType>(\n {\n active: { default: true, required: true, type: Boolean },\n userAvatar: { required: false, type: String },\n userEmail: { required: true, type: String },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n userName: { required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst ChatSchema = new MongooseSchema<SchemaChatType>(\n {\n active: { default: true, required: true, type: Boolean },\n chatDescription: { required: false, type: String },\n chatName: { required: true, type: String },\n chatType: {\n enum: Object.values(EnumChatType),\n required: true,\n type: String,\n },\n deletedAt: { default: null, required: false, type: Date },\n messages: [MessageSchema],\n participants: [ParticipantSchema],\n region: { default: null, required: false, type: String },\n },\n {\n timestamps: true,\n },\n);\n\nChatSchema.index({\n \"participants.active\": 1,\n \"participants.userId\": 1,\n updatedAt: -1,\n});\n\nexport const ChatModel =\n (mongoose.models.Chat as mongoose.Model<SchemaChatType>) ||\n mongoose.model<SchemaChatType>(\"Chat\", ChatSchema);\n","import {\n EnumChatReportReason,\n ReportChatUser,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaChatReportType = Omit<\n ReportChatUser,\n \"reporterUserId\" | \"reportedUserId\" | \"chatId\"\n> & {\n reporterUserId: ObjectId;\n reportedUserId: ObjectId;\n chatId: ObjectId;\n};\n\nconst ReasonSchema = new MongooseSchema<\n NonNullable<ReportChatUser[\"reason\"]>,\n null,\n unknown\n>(\n {\n details: { default: null, required: false, type: String },\n reasonType: {\n enum: Object.values(EnumChatReportReason),\n required: true,\n type: String,\n },\n },\n { _id: false },\n);\n\nconst ChatReportSchema = new MongooseSchema<SchemaChatReportType>(\n {\n chatId: {\n ref: \"Chat\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n reason: { required: true, type: ReasonSchema },\n reportedUserId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n reporterUserId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n resolved: { default: false, required: true, type: Boolean },\n },\n { timestamps: true },\n);\n\nChatReportSchema.index({ chatId: 1, reportedUserId: 1 });\nChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });\n\nexport const ChatReportModel =\n (mongoose.models.ChatReport as mongoose.Model<SchemaChatReportType>) ||\n mongoose.model<SchemaChatReportType>(\"ChatReport\", ChatReportSchema);\n","import {\n Category,\n DateTimeType,\n EnumEventDateStatus,\n EnumPostType,\n EnumUserLicence,\n LocationGeoType,\n LocationType,\n OwnerType,\n PosterUsageType,\n RelatedPostType,\n ResourceContactDetailsType,\n ResourceImageType,\n SocialMediaType,\n SocialShareResourceType,\n Subcategory,\n TermsAgreement,\n UserLicenceType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaRelatedPostType = Omit<RelatedPostType, \"postId\"> & {\n postId: ObjectId;\n};\n\nexport type SchemaOwnerType = Omit<OwnerType, \"userId\"> & {\n userId: ObjectId;\n};\n\nexport const OwnerTypeSchema = new MongooseSchema<SchemaOwnerType>(\n {\n email: { required: true, type: String },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const SocialMediaTypeSchema = new MongooseSchema<SocialMediaType>(\n {\n link: { required: true, type: String },\n name: { required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field\n);\n\nexport const ResourceImageTypeSchema = new MongooseSchema<ResourceImageType>(\n {\n active: { default: true, required: true, type: Boolean },\n source: { required: false, type: String },\n title: { required: false, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst SubCategorySchema = new MongooseSchema<Subcategory>(\n {\n id: { required: false, type: String },\n items: [\n {\n id: { required: false, type: String },\n name: { required: false, type: String },\n },\n ],\n name: { required: false, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const CategorySchema = new MongooseSchema<Category>(\n {\n id: { required: true, type: String },\n name: { required: true, type: String },\n subcategories: [SubCategorySchema],\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst PosterUsageTypeSchema = new MongooseSchema<PosterUsageType>(\n {\n count: { default: 0, required: false, type: Number },\n month: { required: false, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const userLicenseSchema = new MongooseSchema<UserLicenceType>(\n {\n expiryDate: { required: true, type: Date },\n issuedDate: { required: true, type: Date },\n licenceType: {\n enum: Object.values(EnumUserLicence),\n required: true,\n type: String,\n },\n prevLicenceType: {\n enum: Object.values(EnumUserLicence),\n required: false,\n type: String,\n },\n },\n { _id: false, timestamps: false },\n);\n\nexport const ContactDetailsSchema =\n new MongooseSchema<ResourceContactDetailsType>(\n {\n email: { required: false, type: String },\n landlinePhone: { required: false, type: String },\n mobilePhone: { required: false, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n );\n\nexport const termsAgreementSchema = new MongooseSchema<TermsAgreement>(\n {\n appBuildNumber: { required: true, type: String },\n appId: { required: true, type: String },\n appVersion: { required: true, type: String },\n brand: { required: true, type: String },\n deviceName: { required: true, type: String },\n installationId: { required: true, type: String },\n manufacturer: { required: true, type: String },\n modelName: { required: true, type: String },\n osName: { required: true, type: String },\n osVersion: { required: true, type: String },\n termVersion: { required: true, type: String },\n timestamp: { required: true, type: Date },\n },\n { _id: false },\n);\n\nexport const dateTimeSchema = new MongooseSchema<DateTimeType>(\n {\n dateStatus: {\n enum: Object.values(EnumEventDateStatus),\n required: false,\n type: String,\n },\n endDate: { required: true, type: String },\n endTime: { required: true, type: String },\n startDate: { required: true, type: String },\n startTime: { required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const locationGeoSchema = new MongooseSchema<LocationGeoType>(\n {\n coordinates: { required: true, type: [Number] }, // [longitude, latitude]\n type: { default: \"Point\", enum: [\"Point\"], required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const locationsSchema = new MongooseSchema<LocationType>(\n {\n city: { required: true, type: String },\n country: { required: true, type: String },\n fullAddress: { required: true, type: String },\n geo: {\n required: true,\n type: locationGeoSchema,\n },\n latitude: { required: true, type: Number },\n longitude: { required: true, type: Number },\n region: { required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const relatedPostSchema = new MongooseSchema<SchemaRelatedPostType>(\n {\n postActive: { default: true, required: true, type: Boolean },\n postId: {\n ref: \"Post\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n postSlug: { required: true, type: String },\n postType: {\n enum: Object.values(EnumPostType),\n required: true,\n type: String,\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const socialShareResourceSchema =\n new MongooseSchema<SocialShareResourceType>(\n {\n qrCode: { required: true, type: ResourceImageTypeSchema },\n socialImage: { required: true, type: ResourceImageTypeSchema },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n );\n\nexport const baseResourceFields = {\n active: { default: false, required: true, type: Boolean },\n adIds: {\n ref: \"Ad\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n approvedAt: { default: null, required: false, type: Date },\n contactDetails: { required: false, type: ContactDetailsSchema },\n cover: {\n required: true,\n type: ResourceImageTypeSchema,\n },\n deletedAt: { default: null, required: false, type: Date },\n description: { required: true, type: String },\n images: { required: false, type: [ResourceImageTypeSchema] },\n logo: { required: false, type: ResourceImageTypeSchema },\n name: { required: true, type: String },\n owner: {\n required: true,\n type: OwnerTypeSchema,\n },\n posterUsage: { required: false, type: PosterUsageTypeSchema },\n promoCodes: { required: false, type: [String] },\n rating: { required: false, type: Number },\n region: { required: true, type: String },\n relatedPost: { required: false, type: relatedPostSchema },\n reviewCount: { required: false, type: Number },\n sharePublic: { required: false, type: socialShareResourceSchema },\n slug: { required: true, type: String },\n socialMedia: { required: false, type: [SocialMediaTypeSchema] },\n termsAgreement: { required: true, type: termsAgreementSchema },\n};\n","import {\n EnumEventType,\n GoogleAddressComponent,\n GoogleImportedMarket,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport {\n dateTimeSchema,\n locationsSchema,\n ResourceImageTypeSchema,\n} from \"./global\";\nimport { searchNamePlugin } from \"./searchNamePlugin\";\n\nexport type SchemaGoogleImportedMarket = Omit<\n GoogleImportedMarket,\n \"eventId\" | \"claimedByUserId\"\n> & {\n eventId?: mongoose.Types.ObjectId;\n claimedByUserId?: mongoose.Types.ObjectId;\n /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */\n searchName?: string;\n};\n\nconst MongooseSchema = mongoose.Schema;\n\nconst addressComponentSchema = new MongooseSchema<GoogleAddressComponent>(\n {\n longName: { required: false, type: String },\n shortName: { required: false, type: String },\n types: { required: false, type: [String] },\n },\n { _id: false },\n);\n\n/**\n * This is the schema for the GoogleImportedMarket type.\n * It is used to define the structure of the GoogleImportedMarket type in the database.\n * The schema is used by Mongoose to create a model for the GoogleImportedMarket type.\n */\nconst schema = new MongooseSchema<SchemaGoogleImportedMarket>(\n {\n active: { default: false, required: true, type: Boolean },\n address: { required: true, type: String },\n addressComponents: { required: false, type: [addressComponentSchema] },\n approvedAt: { default: null, required: false, type: Date },\n businessStatus: { required: false, type: String },\n claimed: { default: false, required: true, type: Boolean },\n claimedAt: { default: null, required: false, type: Date },\n claimedByUserId: {\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n cover: {\n required: false,\n type: ResourceImageTypeSchema,\n },\n dateTime: [dateTimeSchema],\n deletedAt: { default: null, required: false, type: Date },\n description: { required: true, type: String },\n eventId: {\n ref: \"Event\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n eventType: {\n enum: Object.values(EnumEventType),\n required: true,\n type: String,\n },\n googleMapsUrl: { required: false, type: String },\n googlePlaceId: {\n required: true,\n type: String,\n unique: true, // unique, indexed\n },\n images: { required: false, type: [ResourceImageTypeSchema] }, // array of photo_reference\n importedAt: { default: () => new Date(), required: true, type: Date },\n location: {\n required: true, // optional because lat/lng may expire after 30 days\n type: locationsSchema,\n },\n logo: { required: false, type: ResourceImageTypeSchema },\n name: { required: true, type: String },\n openingHours: { required: false, type: [String] },\n rainOrShine: { required: true, type: Boolean },\n rating: { required: false, type: Number },\n region: { required: false, type: String },\n reviewCount: { required: false, type: Number },\n slug: { required: true, type: String },\n website: { required: false, type: String },\n },\n { timestamps: true },\n);\n\n// Indexes for search, geo, soft-delete, and dateTime status queries.\nschema.index({ \"location.geo\": \"2dsphere\" });\nschema.index({ name: 1 });\nschema.index({ region: 1 });\nschema.index({ deletedAt: 1 });\nschema.index({ \"dateTime.dateStatus\": 1 });\nschema.index({ slug: 1 });\n\n// Full-text search across name/description (see eventsSearch google branch).\nschema.index({ description: \"text\", name: \"text\" });\n\nschema.plugin(searchNamePlugin);\n\nexport const GoogleImportedMarketModel =\n (mongoose.models\n .GoogleImportedMarket as mongoose.Model<SchemaGoogleImportedMarket>) ||\n mongoose.model<SchemaGoogleImportedMarket>(\"GoogleImportedMarket\", schema);\n","import mongoose from \"mongoose\";\n\n/**\n * Derives the lowercase prefix mirror used for type-ahead search.\n * `name` is required on every searchable resource, so a missing/blank name\n * yields \"\".\n */\nexport function deriveSearchName(name: unknown): string {\n return typeof name === \"string\" ? name.trim().toLowerCase() : \"\";\n}\n\n/**\n * Returns a copy of a Mongo update with `searchName` synced from `name`, or\n * `null` when the update has no string `name` to derive from. Supports the\n * three update shapes: `$set` operator objects, direct field replacement\n * (`{ name: \"x\" }`), and aggregation-pipeline arrays (`[{ $set: ... }]`).\n */\nfunction syncSearchNameInUpdate(update: unknown): any {\n if (Array.isArray(update)) {\n let changed = false;\n const next = update.map((stage) => {\n if (!stage || typeof stage !== \"object\") {\n return stage;\n }\n const $set = (stage as { $set?: Record<string, unknown> }).$set;\n const name = $set && typeof $set.name === \"string\" ? $set.name : null;\n // In an aggregation pipeline, a string starting with `$` is a field-path\n // expression, not a literal value. The computed name isn't known here, so\n // leave `searchName` alone rather than desynchronizing it from `name`.\n if (!name || name.startsWith(\"$\")) {\n return stage;\n }\n changed = true;\n return {\n ...(stage as Record<string, unknown>),\n $set: { ...$set, searchName: deriveSearchName(name) },\n };\n });\n return changed ? next : null;\n }\n\n if (!update || typeof update !== \"object\") {\n return null;\n }\n\n const obj = update as Record<string, unknown>;\n const $set = obj.$set;\n\n if ($set && typeof $set === \"object\" && !Array.isArray($set)) {\n const setObj = $set as Record<string, unknown>;\n if (typeof setObj.name === \"string\") {\n return {\n ...obj,\n $set: { ...setObj, searchName: deriveSearchName(setObj.name) },\n };\n }\n return null;\n }\n\n // Direct field replacement (no operator prefix): Mongoose casts top-level\n // non-operator keys into `$set`, so mirror `searchName` at the same level.\n if (typeof obj.name === \"string\") {\n return { ...obj, searchName: deriveSearchName(obj.name) };\n }\n\n return null;\n}\n\n/**\n * Mongoose schema plugin that keeps `searchName` (lowercase `name`) in sync\n * with `name` and indexes it for anchored prefix queries.\n *\n * Why: MongoDB `$text` matches whole, stemmed words — partial terms like \"cof\"\n * no longer match \"coffee\". Search resolvers OR an anchored\n * `{ searchName: /^term/ }` clause together with their `$text` clause so\n * type-ahead prefix matching keeps working, backed by the regular\n * `{ searchName: 1 }` index (case-sensitive regex + pre-lowercased field).\n *\n * Coverage: `save`, `insertMany`, `bulkWrite` (insertOne/replaceOne documents\n * and updateOne/updateMany updates in `$set`, direct-field, and pipeline\n * forms), `findOneAndUpdate`, `updateOne`, and `updateMany` are kept in sync.\n * Anything that still slips through (e.g. direct driver writes) is reconciled\n * at the application level by the `backfillSearchName` startup migration in\n * `cluemart-server` (matches `{ searchName: { $exists: false } }`).\n */\nexport function searchNamePlugin(schema: mongoose.Schema): void {\n schema.add({ searchName: { default: \"\", required: false, type: String } });\n schema.index({ searchName: 1 });\n\n schema.pre(\"save\", function syncSearchNameOnSave(next) {\n const doc = this as unknown as { name?: string; searchName?: string };\n doc.searchName = deriveSearchName(doc.name);\n next();\n });\n\n schema.pre(\"insertMany\", function syncSearchNameOnInsertMany(next, docs) {\n const list = Array.isArray(docs) ? docs : [docs];\n for (const doc of list as Array<{ name?: string; searchName?: string }>) {\n if (doc && typeof doc.name === \"string\") {\n doc.searchName = deriveSearchName(doc.name);\n }\n }\n next();\n });\n\n schema.pre(\"bulkWrite\", function syncSearchNameOnBulkWrite(next, ops) {\n for (const op of ops as Array<Record<string, any>>) {\n const doc = op.insertOne?.document ?? op.replaceOne?.replacement;\n if (doc && typeof doc.name === \"string\") {\n doc.searchName = deriveSearchName(doc.name);\n }\n\n for (const key of [\"updateOne\", \"updateMany\"] as const) {\n const update = op[key]?.update;\n if (update === undefined) {\n continue;\n }\n const synced = syncSearchNameInUpdate(update);\n if (synced !== null) {\n op[key].update = synced;\n }\n }\n }\n next();\n });\n\n const syncSearchNameOnUpdate = function (\n this: mongoose.Query<unknown, unknown>,\n next: () => void,\n ) {\n const synced = syncSearchNameInUpdate(this.getUpdate());\n if (synced !== null) {\n this.setUpdate(synced);\n }\n next();\n };\n\n schema.pre(\n [\"findOneAndUpdate\", \"updateOne\", \"updateMany\"],\n syncSearchNameOnUpdate,\n );\n}\n","import {\n CreateBulkNotificationInput,\n NotificationType,\n EnumNotificationResourceType,\n EnumNotificationType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst notificationDataSchema = new MongooseSchema(\n {\n resourceId: { required: true, type: String },\n resourceName: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumNotificationResourceType),\n required: true,\n type: String,\n },\n },\n { _id: false },\n);\n\nexport type SchemaCreateBulkNotificationInput = Omit<\n CreateBulkNotificationInput,\n \"userIds\"\n> & {\n userIds: ObjectId[];\n};\n\nexport type SchemaNotificationType = Omit<NotificationType, \"userId\"> & {\n userId: ObjectId;\n};\n/**\n * Schema for storing in-app notifications\n * Each notification is tied to a specific user and can be marked as read/unread\n */\nconst schema = new MongooseSchema<SchemaNotificationType>(\n {\n data: {\n default: null,\n required: false,\n type: notificationDataSchema,\n },\n isRead: { default: false, index: true, required: true, type: Boolean },\n message: { required: true, type: String },\n title: { required: true, type: String },\n type: {\n default: EnumNotificationType.SYSTEM,\n enum: Object.values(EnumNotificationType),\n required: true,\n type: String,\n },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\n// Compound index for efficient queries\nschema.index({ isRead: 1, userId: 1 });\nschema.index({ createdAt: -1, userId: 1 });\n\nexport const NotificationModel =\n (mongoose.models.Notification as mongoose.Model<SchemaNotificationType>) ||\n mongoose.model<SchemaNotificationType>(\"Notification\", schema);\n","import { PushTokenType } from \"@timardex/cluemart-shared\";\nimport { EnumOSPlatform } from \"@timardex/cluemart-shared/enums\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaPushTokenType = Omit<PushTokenType, \"userId\"> & {\n userId: ObjectId;\n};\n\n/**\n * This is the schema for the push token type.\n * It is used to define the structure of the push token type in the database.\n * The schema is used by Mongoose to create a model for the push token type.\n */\nconst schema = new MongooseSchema<SchemaPushTokenType>(\n {\n platform: {\n enum: Object.values(EnumOSPlatform),\n required: true,\n type: String,\n },\n token: { required: true, type: String },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\nexport const PushTokenModel =\n (mongoose.models.PushToken as mongoose.Model<SchemaPushTokenType>) ||\n mongoose.model<SchemaPushTokenType>(\"PushToken\", schema);\n","import {\n EnumEventDateStatus,\n EnumInviteStatus,\n EnumRelationResource,\n EnumResourceType,\n RelationDate,\n RelationType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { StallTypeSchema } from \"./event/EventInfo\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst relationDateTimeSchema = new MongooseSchema<RelationDate[\"dateTime\"]>(\n {\n dateStatus: {\n enum: Object.values(EnumEventDateStatus),\n required: true,\n type: String,\n },\n endDate: { required: true, type: String },\n endTime: { required: true, type: String },\n stallType: StallTypeSchema,\n startDate: { required: true, type: String },\n startTime: { required: true, type: String },\n },\n { _id: false },\n);\n\nexport const relationDatesSchema = new MongooseSchema<RelationDate>(\n {\n dateTime: {\n required: true,\n type: relationDateTimeSchema,\n },\n lastUpdateBy: {\n resourceId: { required: false, type: String },\n userEmail: { required: false, type: String },\n },\n paymentReference: { required: false, type: String },\n status: {\n enum: Object.values(EnumInviteStatus),\n required: false,\n type: String,\n },\n },\n { _id: false },\n);\n\nexport type SchemaRelationType = Omit<\n RelationType,\n \"eventId\" | \"vendorId\" | \"chatId\"\n> & {\n eventId: ObjectId;\n vendorId: ObjectId;\n chatId: ObjectId;\n};\n/**\n * This is the schema for the relation type.\n * It is used to define the structure of the relation type in the database.\n * The schema is used by Mongoose to create a model for the relation type.\n */\nexport const RelationTypeSchema = new MongooseSchema<SchemaRelationType>(\n {\n active: { default: true, required: true, type: Boolean },\n chatId: {\n ref: \"Chat\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n deletedAt: { default: null, required: false, type: Date },\n eventId: {\n ref: \"Event\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n lastUpdateBy: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n relationDates: [relationDatesSchema],\n relationType: {\n enum: Object.values(EnumRelationResource),\n required: true,\n type: String,\n },\n vendorId: {\n ref: \"Vendor\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\nRelationTypeSchema.index({\n eventId: 1,\n \"relationDates.startDate\": 1,\n \"relationDates.startTime\": 1,\n \"relationDates.status\": 1,\n vendorId: 1,\n});\n\n// --- IMPORTANT: bind custom model type ---\nexport const RelationModel =\n (mongoose.models.Relation as mongoose.Model<SchemaRelationType>) ||\n mongoose.model<SchemaRelationType>(\"Relation\", RelationTypeSchema);\n","import {\n DateTimeWithPriceType,\n EnumEventDateStatus,\n EnumPaymentMethod,\n EventInfoType,\n PaymentInfoType,\n RefundPolicy,\n Requirement,\n StallType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const StallTypeSchema = new MongooseSchema<StallType>(\n {\n label: { required: false, type: String },\n price: { required: false, type: Number },\n stallCapacity: { required: false, type: Number },\n },\n {\n _id: false, // Prevents Mongoose from creating an additional _id field for subdocuments\n },\n);\n\nconst dateTimeSchema = new MongooseSchema<DateTimeWithPriceType>(\n {\n dateStatus: {\n enum: Object.values(EnumEventDateStatus),\n required: false,\n type: String,\n },\n endDate: { required: true, type: String },\n endTime: { required: true, type: String },\n stallTypes: [StallTypeSchema],\n startDate: { required: true, type: String },\n startTime: { required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst paymentInfoSchema = new MongooseSchema<PaymentInfoType>(\n {\n accountHolderName: { required: false, type: String },\n accountNumber: { required: false, type: String },\n link: { required: false, type: String },\n paymentMethod: {\n enum: Object.values(EnumPaymentMethod),\n required: true,\n type: String,\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field\n);\n\nconst requirementsSchema = new MongooseSchema<Requirement>(\n {\n category: { required: true, type: String },\n label: { required: true, type: String },\n value: { required: true, type: Boolean },\n },\n {\n _id: false, // Prevents Mongoose from creating an additional _id field for\n },\n);\n\nexport const refundPolicySchema = new MongooseSchema<RefundPolicy>(\n {\n category: { required: true, type: String },\n label: { required: true, type: String },\n value: { required: true, type: Boolean },\n },\n { _id: false },\n);\n\nexport type SchemaEventInfoType = Omit<EventInfoType, \"eventId\"> & {\n eventId: ObjectId;\n};\n\n/**\n * This is the schema for the event info type.\n * It is used to define the structure of the event info type in the database.\n * The schema is used by Mongoose to create a model for the event info type.\n */\nconst schema = new MongooseSchema<SchemaEventInfoType>(\n {\n active: { default: true, type: Boolean },\n applicationDeadlineHours: { required: true, type: Number },\n dateTime: { required: true, type: [dateTimeSchema] },\n eventId: {\n ref: \"Event\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n packInTime: { required: true, type: Number },\n paymentDueHours: { required: true, type: Number },\n paymentInfo: { required: true, type: [paymentInfoSchema] },\n refundPolicy: { required: true, type: [refundPolicySchema] },\n requirements: { required: false, type: [requirementsSchema] },\n },\n { timestamps: true },\n);\n\n// Serves `getEventInfo` / `createRelation` / relation resolvers / user deletion:\n// every read/write is `findOne({ eventId })` equality.\nschema.index({ eventId: 1 });\n\nexport const EventInfoModel =\n (mongoose.models.EventInfo as mongoose.Model<SchemaEventInfoType>) ||\n mongoose.model<SchemaEventInfoType>(\"EventInfo\", schema);\n","import {\n EnumActivity,\n EnumEventDateStatus,\n EnumOSPlatform,\n EnumResourceType,\n ResourceActivityEntry,\n ResourceActivityType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { locationGeoSchema } from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst ActivitySchema = new MongooseSchema<ResourceActivityEntry>(\n {\n activityType: {\n enum: Object.values(EnumActivity),\n required: true,\n type: String,\n },\n dateStatus: {\n enum: Object.values(EnumEventDateStatus),\n required: false,\n type: String,\n },\n location: {\n required: false,\n type: locationGeoSchema,\n },\n startDate: { required: false, type: String },\n startTime: { required: false, type: String },\n timestamp: { default: Date.now, type: Date },\n userAgent: {\n enum: Object.values(EnumOSPlatform),\n required: true,\n type: String,\n },\n userId: { required: false, type: String },\n },\n { _id: false },\n);\n\nconst schema = new MongooseSchema<ResourceActivityType>(\n {\n activity: { default: [], type: [ActivitySchema] },\n resourceId: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n },\n { timestamps: true },\n);\n\nschema.index({ resourceId: 1, resourceType: 1 }, { unique: true }); // one per entity\nschema.index({ \"views.location\": \"2dsphere\" });\n\nexport const ResourceActivityModel =\n (mongoose.models.ResourceActivity as mongoose.Model<ResourceActivityType>) ||\n mongoose.model<ResourceActivityType>(\"ResourceActivity\", schema);\n","import {\n EnumBillingPeriod,\n EnumNotificationResourceType,\n EnumOSPlatform,\n EnumResourceType,\n EnumReward,\n EnumSubscriptionStatus,\n EnumUserLicence,\n EnumUserRole,\n RedeemedReward,\n StripeSubscription,\n UserActivityEvent,\n UserType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport {\n dateTimeSchema,\n locationsSchema,\n ResourceImageTypeSchema,\n termsAgreementSchema,\n userLicenseSchema,\n} from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaUserActivityEvent = Omit<UserActivityEvent, \"resourceId\"> & {\n resourceId: ObjectId;\n};\n\nexport type SchemaUserType = Omit<\n UserType,\n | \"vendor\"\n | \"coupon\"\n | \"events\"\n | \"partner\"\n | \"userActivity\"\n | \"_id\"\n | \"game\"\n | \"school\"\n | \"affiliate\"\n | \"permissions\"\n | \"stripe\"\n> & {\n _id: ObjectId;\n affiliate: ObjectId;\n coupon: ObjectId;\n events: ObjectId[];\n game: ObjectId;\n partner: ObjectId;\n school: ObjectId;\n stripe?: SchemaStripeSubscription;\n vendor: ObjectId;\n userActivity: {\n favourites: {\n events: ObjectId[];\n vendors: ObjectId[];\n partners: ObjectId[];\n };\n interested: {\n events: SchemaUserActivityEvent[];\n };\n going: {\n events: SchemaUserActivityEvent[];\n };\n present: {\n events: SchemaUserActivityEvent[];\n };\n };\n};\n\nexport type SchemaStripeSubscription = StripeSubscription & {\n billingPeriod?: EnumBillingPeriod;\n cancelAtPeriodEnd?: boolean;\n paymentFailedAt?: Date;\n paymentGracePeriodEndsAt?: Date;\n paymentGraceSubscriptionId?: string;\n pendingBillingPeriod?: EnumBillingPeriod;\n pendingChangeEffectiveAt?: Date;\n pendingPlan?: EnumUserLicence;\n priceId?: string;\n scheduleId?: string;\n subscriptionMutationLockExpiresAt?: Date;\n subscriptionMutationLockId?: string;\n};\n\nconst userActivityEventSchema = new MongooseSchema<SchemaUserActivityEvent>(\n {\n dateTime: dateTimeSchema,\n resourceId: {\n ref: \"Event\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\n);\n\nconst userActivityFavouritesSchema = new MongooseSchema(\n {\n events: {\n ref: \"Event\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n partners: {\n ref: \"Partner\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n vendors: {\n ref: \"Vendor\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n },\n { _id: false },\n);\n\nconst stripeSchema = new MongooseSchema<SchemaStripeSubscription>(\n {\n billingPeriod: {\n enum: Object.values(EnumBillingPeriod),\n required: false,\n type: String,\n },\n cancelAtPeriodEnd: {\n required: false,\n type: Boolean,\n },\n currentPlan: {\n enum: Object.values(EnumUserLicence),\n required: false,\n type: String,\n },\n customerId: {\n required: false,\n type: String,\n },\n endDate: {\n required: false,\n type: Date,\n },\n paymentFailedAt: {\n required: false,\n type: Date,\n },\n paymentGracePeriodEndsAt: {\n required: false,\n type: Date,\n },\n paymentGraceSubscriptionId: {\n required: false,\n type: String,\n },\n pendingBillingPeriod: {\n enum: Object.values(EnumBillingPeriod),\n required: false,\n type: String,\n },\n pendingChangeEffectiveAt: {\n required: false,\n type: Date,\n },\n pendingPlan: {\n enum: Object.values(EnumUserLicence),\n required: false,\n type: String,\n },\n priceId: {\n required: false,\n type: String,\n },\n scheduleId: {\n required: false,\n type: String,\n },\n startDate: {\n required: false,\n type: Date,\n },\n status: {\n enum: Object.values(EnumSubscriptionStatus),\n required: false,\n type: String,\n },\n subscriptionId: {\n required: false,\n type: String,\n },\n subscriptionMutationLockExpiresAt: {\n required: false,\n type: Date,\n },\n subscriptionMutationLockId: {\n required: false,\n type: String,\n },\n },\n { _id: false },\n);\n\nconst redeemedRewardSchema = new MongooseSchema<RedeemedReward>(\n {\n name: {\n enum: Object.values(EnumReward),\n required: true,\n type: String,\n },\n pointsUsed: { required: true, type: Number },\n redeemedAt: { required: true, type: Date },\n },\n { _id: false },\n);\n\n/**\n * This is the schema for the user type.\n * It is used to define the structure of the user type in the database.\n * The schema is used by Mongoose to create a model for the user type.\n */\nconst schema = new MongooseSchema<SchemaUserType>(\n {\n active: { default: false, required: true, type: Boolean },\n affiliate: {\n ref: \"Affiliate\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n avatar: {\n required: false,\n type: ResourceImageTypeSchema,\n },\n coupon: {\n ref: \"Coupon\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n deletedAt: { default: null, required: false, type: Date },\n email: { required: true, type: String },\n emailSentFor: {\n enum: Object.values(EnumNotificationResourceType),\n required: false,\n type: [String],\n },\n events: {\n ref: \"Event\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n firstName: { required: true, type: String },\n game: {\n ref: \"Game\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n interests: {\n enum: Object.values(EnumResourceType),\n required: false,\n type: [String],\n },\n isTester: { default: false, required: true, type: Boolean },\n lastName: { required: true, type: String },\n licences: {\n required: false,\n type: [userLicenseSchema],\n },\n location: {\n required: false,\n type: locationsSchema,\n },\n nickName: { required: false, type: String },\n overallPoints: { default: 0, required: false, type: Number },\n partner: {\n ref: \"Partner\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n password: { required: true, type: String },\n platform: {\n enum: Object.values(EnumOSPlatform),\n required: false,\n type: String,\n },\n preferredRegion: {\n required: true,\n type: String,\n },\n promoCodes: {\n required: false,\n type: [String],\n },\n redeemedRewards: {\n required: false,\n type: [redeemedRewardSchema],\n },\n refreshToken: {\n required: false,\n type: String,\n },\n roles: {\n default: [EnumUserRole.CUSTOMER],\n enum: Object.values(EnumUserRole),\n required: true,\n type: [String],\n },\n school: {\n ref: \"School\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n stripe: {\n required: false,\n type: stripeSchema,\n },\n termsAgreement: termsAgreementSchema,\n userActivity: {\n favourites: {\n default: () => ({ events: [], vendors: [] }),\n type: userActivityFavouritesSchema,\n },\n going: {\n events: [userActivityEventSchema],\n },\n interested: {\n events: [userActivityEventSchema],\n },\n present: {\n events: [userActivityEventSchema],\n },\n },\n vendor: {\n ref: \"Vendor\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { strict: false, timestamps: true },\n);\n\nschema.index({ \"licences.expiryDate\": 1 });\nschema.index({ \"licences.licenceType\": 1 });\n// Serves `usersByPromoCode` (`{ promoCodes: code }`) and `getSchool`\n// (`{ active: true, deletedAt: null, promoCodes: { $in: [code] } }`). `promoCodes`\n// is the selective multikey field, so it leads the index.\nschema.index({ promoCodes: 1, active: 1, deletedAt: 1 });\n// Backs the super-admin `getUsers` search (`{ $text: { $search } }`) so the\n// search clause is served by an index instead of a collection scan. `$text`\n// matches whole, stemmed words — partial type-ahead would need a lowercase\n// mirror field, so keep this in mind before tightening search semantics.\nschema.index({ email: \"text\", firstName: \"text\", lastName: \"text\" });\n\nexport const UserModel =\n (mongoose.models.User as mongoose.Model<SchemaUserType>) ||\n mongoose.model<SchemaUserType>(\"User\", schema);\n","import mongoose from \"mongoose\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport interface VerificationTokenType {\n email: string;\n verificationToken: string;\n createdAt: Date;\n}\n\nconst schema = new MongooseSchema<VerificationTokenType>(\n {\n createdAt: {\n default: Date.now,\n expires: 24 * 60 * 60, // 24 hours in seconds (MongoDB TTL expects seconds)\n required: true,\n type: Date,\n }, // Token expires after 1 day\n email: { required: true, type: String },\n verificationToken: { required: true, type: String },\n },\n { timestamps: true },\n);\n\nexport const VerificationTokenModel =\n (mongoose.models\n .VerificationToken as mongoose.Model<VerificationTokenType>) ||\n mongoose.model<VerificationTokenType>(\"VerificationToken\", schema);\n","import {\n EnumEventDateStatus,\n EnumVendorType,\n VendorCalendarData,\n VendorProductList,\n VendorType,\n VendorDowngradeSnapshot,\n VendorAvailability,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport {\n baseResourceFields,\n CategorySchema,\n locationsSchema,\n SchemaOwnerType,\n socialShareResourceSchema,\n} from \"../global\";\nimport { searchNamePlugin } from \"../searchNamePlugin\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const vendorProductTypeSchema = new MongooseSchema<VendorProductList>(\n {\n description: { required: false, type: String },\n name: { required: true, type: String },\n price: { required: true, type: Number },\n priceMax: { required: false, type: Number },\n priceUnit: { required: true, type: String },\n productGroups: { required: false, type: [String] },\n },\n { timestamps: true },\n);\n\nconst productWrapperSchema = new MongooseSchema<VendorType[\"products\"]>(\n {\n active: { default: false, required: false, type: Boolean },\n productsList: { required: false, type: [vendorProductTypeSchema] },\n },\n { _id: false },\n);\n\nconst calendarSchema = new MongooseSchema<VendorCalendarData>(\n {\n dateTime: {\n dateStatus: {\n enum: Object.values(EnumEventDateStatus),\n required: false,\n type: String,\n },\n endDate: { required: false, type: String },\n endTime: { required: false, type: String },\n startDate: { required: false, type: String },\n startTime: { required: false, type: String },\n },\n description: { required: false, type: String },\n location: {\n required: false,\n type: locationsSchema,\n },\n },\n { _id: false },\n);\n\nconst calendarWrapperSchema = new MongooseSchema<VendorType[\"calendar\"]>(\n {\n active: { default: false, required: true, type: Boolean },\n calendarData: { required: false, type: [calendarSchema] },\n },\n { _id: false },\n);\n\nconst vendorAvailabilitySchema = new MongooseSchema<VendorAvailability>(\n {\n corporate: { default: false, required: false, type: Boolean },\n private: { default: false, required: false, type: Boolean },\n school: { default: false, required: false, type: Boolean },\n },\n { _id: false },\n);\n\n/**\n * Snapshot of licence-gated fields captured when a vendor is downgraded to\n * STANDARD_VENDOR, used to restore the vendor's own configuration on a later\n * PRO upgrade (see downgradeVendorProFeatures / restoreVendorProFeatures).\n */\nconst downgradeSnapshotSchema = new MongooseSchema<VendorDowngradeSnapshot>(\n {\n availability: { required: false, type: vendorAvailabilitySchema },\n calendarActive: { required: false, type: Boolean },\n productsActive: { required: false, type: Boolean },\n },\n { _id: false },\n);\n\nexport type SchemaVendorType = Omit<\n VendorType,\n \"vendorInfoId\" | \"owner\" | \"adIds\" | \"unregisteredVendorId\"\n> & {\n adIds?: ObjectId[];\n /** Mirror of `categories[].name` for $text search (see vendorSearch). */\n categoriesNames?: string[];\n owner: SchemaOwnerType;\n /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */\n searchName?: string;\n vendorInfoId: ObjectId;\n unregisteredVendorId?: ObjectId | null;\n};\n\nconst schema = new MongooseSchema<SchemaVendorType>(\n {\n ...baseResourceFields, // Importing base resource fields from global.ts\n availability: { required: false, type: vendorAvailabilitySchema },\n calendar: {\n required: false,\n type: calendarWrapperSchema,\n },\n categories: { required: true, type: [CategorySchema] },\n categoriesNames: { default: [], required: false, type: [String] },\n claimed: { default: true, required: false, type: Boolean },\n downgradeSnapshot: { required: false, type: downgradeSnapshotSchema },\n foodTruck: { required: true, type: Boolean },\n products: { required: false, type: productWrapperSchema },\n shareRelation: { required: false, type: socialShareResourceSchema },\n unregisteredVendorId: {\n ref: \"UnregisteredVendor\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n vendorInfoId: {\n ref: \"VendorInfo\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n vendorType: {\n enum: Object.values(EnumVendorType),\n required: true,\n type: String,\n },\n },\n { timestamps: true },\n);\n\n// 🔹 Add indexes to speed up regex-based searches\nschema.index({ name: 1 });\nschema.index({ description: 1 });\nschema.index({ region: 1 });\nschema.index({ \"categories.name\": 1 });\nschema.index({ slug: 1 });\n\n// Full-text search across name/description/categoriesNames (see vendorSearch).\nschema.index({\n categoriesNames: \"text\",\n description: \"text\",\n name: \"text\",\n});\n\n// Serves getUserVendors / ownedCoupons' Vendor lookups:\n// `{ deletedAt: null, \"owner.userId\": <id> }` (and ownedCoupons' additional\n// `active: true` is a residual filter).\nschema.index({ deletedAt: 1, \"owner.userId\": 1 });\n\nschema.plugin(searchNamePlugin);\n\nexport const VendorModel =\n (mongoose.models.Vendor as mongoose.Model<SchemaVendorType>) ||\n mongoose.model<SchemaVendorType>(\"Vendor\", schema);\n","import {\n EnumFoodFlavor,\n VendorAttributes,\n VendorInfoType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { ResourceImageTypeSchema } from \"../global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaVendorInfoType = Omit<VendorInfoType, \"vendorId\"> & {\n vendorId: ObjectId;\n};\n\nconst AttributesSchema = new MongooseSchema<VendorAttributes>(\n {\n details: { required: false, type: String },\n isRequired: { default: false, required: true, type: Boolean },\n },\n { _id: false },\n);\n\nconst schema = new MongooseSchema<SchemaVendorInfoType>(\n {\n active: { default: true, type: Boolean },\n compliance: {\n foodBeverageLicense: { default: false, required: false, type: Boolean },\n liabilityInsurance: { default: false, required: false, type: Boolean },\n },\n documents: [ResourceImageTypeSchema],\n product: {\n foodFlavors: {\n enum: Object.values(EnumFoodFlavor),\n required: true,\n type: [String],\n },\n packaging: { required: true, type: [String] },\n priceRange: {\n max: { required: true, type: String },\n min: { required: true, type: String },\n },\n producedIn: { required: true, type: [String] },\n },\n requirements: {\n electricity: AttributesSchema,\n gazebo: AttributesSchema,\n table: AttributesSchema,\n },\n stallInfo: {\n size: {\n depth: { required: true, type: String },\n width: { required: true, type: String },\n },\n },\n vendorId: {\n ref: \"Vendor\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\n// Serves `getVendorInfo` / user deletion: `findOne({ vendorId })` equality.\nschema.index({ vendorId: 1 });\n\nexport const VendorInfoModel =\n (mongoose.models.VendorInfo as mongoose.Model<SchemaVendorInfoType>) ||\n mongoose.model<SchemaVendorInfoType>(\"VendorInfo\", schema);\n","import {\n UnregisteredVendorInvitationType,\n UnregisteredVendorType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { dateTimeSchema } from \"../global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaUnregisteredVendorInvitationType = Omit<\n UnregisteredVendorInvitationType,\n \"inviterId\"\n> & {\n inviterId: ObjectId;\n};\n\nexport type SchemaUnregisteredVendorType = Omit<\n UnregisteredVendorType,\n \"invitations\" | \"claimedByUserId\"\n> & {\n claimInitiatedAt?: Date | null;\n claimToken?: string | null;\n claimTokenExpiresAt?: Date | null;\n claimedByUserId?: mongoose.Types.ObjectId;\n invitations: SchemaUnregisteredVendorInvitationType[];\n};\n\nconst invitationSchema =\n new MongooseSchema<SchemaUnregisteredVendorInvitationType>(\n {\n dateTime: { required: true, type: [dateTimeSchema] },\n inviterId: {\n ref: \"Event\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\n );\n\nconst schema = new MongooseSchema<SchemaUnregisteredVendorType>(\n {\n active: { default: true, required: true, type: Boolean },\n categoryIds: { required: true, type: [String] },\n claimed: { default: false, required: true, type: Boolean },\n claimedAt: { default: null, required: false, type: Date },\n claimedByUserId: {\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n claimInitiatedAt: { default: null, required: false, type: Date },\n claimToken: { default: null, required: false, type: String },\n claimTokenExpiresAt: { default: null, required: false, type: Date },\n deletedAt: { default: null, required: false, type: Date },\n email: { required: true, type: String },\n invitations: { required: true, type: [invitationSchema] },\n name: { required: true, type: String },\n region: { required: true, type: String },\n },\n { timestamps: true },\n);\n\nschema.index({ name: 1 });\nschema.index({ email: 1 });\n\nexport const UnregisteredVendorModel =\n (mongoose.models\n .UnregisteredVendor as mongoose.Model<SchemaUnregisteredVendorType>) ||\n mongoose.model<SchemaUnregisteredVendorType>(\"UnregisteredVendor\", schema);\n","import { EnumEventType, EventType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport {\n baseResourceFields,\n dateTimeSchema,\n locationsSchema,\n SchemaOwnerType,\n socialShareResourceSchema,\n} from \"../global\";\nimport { searchNamePlugin } from \"../searchNamePlugin\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaEventType = Omit<\n EventType,\n \"eventInfoId\" | \"owner\" | \"adIds\"\n> & {\n adIds?: ObjectId[];\n eventInfoId: ObjectId;\n owner: SchemaOwnerType;\n /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */\n searchName?: string;\n};\n\n/**\n * This is the schema for the event type.\n * It is used to define the structure of the event type in the database.\n * The schema is used by Mongoose to create a model for the event type.\n */\nconst schema = new MongooseSchema<SchemaEventType>(\n {\n ...baseResourceFields, // Importing base resource fields from global.ts\n claimed: { default: true, required: false, type: Boolean },\n dateTime: { required: true, type: [dateTimeSchema] },\n eventInfoId: {\n ref: \"EventInfo\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n eventType: {\n enum: Object.values(EnumEventType),\n required: true,\n type: String,\n },\n googlePlaceId: {\n default: null,\n required: false,\n type: String,\n },\n location: {\n required: true,\n type: locationsSchema,\n },\n nzbn: { required: true, type: String },\n provider: { required: false, type: String },\n rainOrShine: { required: true, type: Boolean },\n shareRelation: { required: false, type: socialShareResourceSchema },\n tags: { required: true, type: [String] },\n },\n { timestamps: true },\n);\n\n// Indexes for search, geo, soft-delete, and dateTime status queries.\nschema.index({ name: 1 });\nschema.index({ description: 1 });\nschema.index({ region: 1 });\nschema.index({ \"location.geo\": \"2dsphere\" });\nschema.index({ tags: 1 });\nschema.index({ deletedAt: 1 });\nschema.index({ \"dateTime.dateStatus\": 1 });\nschema.index({ slug: 1 });\n\n// Full-text search across name/description/tags (see eventsSearch resolver).\nschema.index({ description: \"text\", name: \"text\", tags: \"text\" });\n\n// Serves getUserEvents / ownedCoupons' Event lookups:\n// `{ deletedAt: null, \"owner.userId\": <id> }` (and ownedCoupons' additional\n// `active: true` is a residual filter).\nschema.index({ deletedAt: 1, \"owner.userId\": 1 });\n\nschema.plugin(searchNamePlugin);\n\nexport const EventModel =\n (mongoose.models.Event as mongoose.Model<SchemaEventType>) ||\n mongoose.model<SchemaEventType>(\"Event\", schema);\n","import { DateTimeType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { dateTimeSchema } from \"../global\";\n\nexport type SchemaEventDateArchiveType = {\n dateTime: DateTimeType[];\n eventId: ObjectId;\n};\n\n/**\n * Archived (ended) event date slots removed from `Event.dateTime` so the Event\n * document only carries the live schedule. One document per event, mirroring\n * the Event model's `dateTime` array shape.\n */\nconst schema = new mongoose.Schema<SchemaEventDateArchiveType>(\n {\n dateTime: { required: true, type: [dateTimeSchema] },\n eventId: {\n ref: \"Event\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\n// One archive document per event.\nschema.index({ eventId: 1 }, { unique: true });\n\nexport const EventDateArchiveModel =\n (mongoose.models\n .EventDateArchive as mongoose.Model<SchemaEventDateArchiveType>) ||\n mongoose.model<SchemaEventDateArchiveType>(\"EventDateArchive\", schema);\n","import { EnumPartnerType, PartnerType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { baseResourceFields, locationsSchema, SchemaOwnerType } from \"./global\";\nimport { searchNamePlugin } from \"./searchNamePlugin\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaPartnerType = Omit<PartnerType, \"owner\" | \"adIds\"> & {\n adIds?: ObjectId[];\n owner: SchemaOwnerType;\n /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */\n searchName?: string;\n};\n\nconst schema = new MongooseSchema<SchemaPartnerType>(\n {\n ...baseResourceFields,\n location: {\n required: true,\n type: locationsSchema,\n },\n nzbn: { required: true, type: String },\n partnerType: {\n enum: Object.values(EnumPartnerType),\n required: true,\n type: String,\n },\n },\n { timestamps: true },\n);\n\n// 🔹 Add indexes to speed up regex-based searches\nschema.index({ name: 1 });\nschema.index({ description: 1 });\nschema.index({ region: 1 });\nschema.index({ \"location.geo\": \"2dsphere\" });\nschema.index({ slug: 1 });\n\n// Full-text search across name/description (see partnersSearch resolver).\nschema.index({ name: \"text\", description: \"text\" });\n\n// Serves getUserPartners / ownedCoupons' Partner lookups:\n// `{ deletedAt: null, \"owner.userId\": <id> }`.\nschema.index({ \"owner.userId\": 1, deletedAt: 1 });\n\nschema.plugin(searchNamePlugin);\n\nexport const PartnerModel =\n (mongoose.models.Partner as mongoose.Model<SchemaPartnerType>) ||\n mongoose.model<SchemaPartnerType>(\"Partner\", schema);\n","import {\n EnumPostContentType,\n EnumPostType,\n EnumResourceType,\n PostContentType,\n PostResource,\n PostType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose, { Schema } from \"mongoose\";\n\nimport { ResourceImageTypeSchema, socialShareResourceSchema } from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaPostType = PostType;\n\nconst contentSchema = new MongooseSchema<PostContentType>(\n {\n contentData: Schema.Types.Mixed,\n contentOrder: { required: true, type: Number },\n contentType: {\n enum: Object.values(EnumPostContentType),\n required: true,\n type: String,\n },\n },\n { _id: false },\n);\n\nconst resourceSchema = new MongooseSchema<PostResource>(\n {\n resourceId: { required: true, type: String },\n resourceRegion: { required: true, type: String },\n resourceSlug: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n },\n { _id: false },\n);\n\nconst schema = new MongooseSchema<SchemaPostType>(\n {\n active: { default: false, required: true, type: Boolean },\n approvedAt: { default: null, required: false, type: Date },\n caption: { required: true, type: String },\n content: {\n default: [],\n required: false,\n type: [contentSchema],\n },\n cover: {\n required: false,\n type: ResourceImageTypeSchema,\n },\n deletedAt: { default: null, required: false, type: Date },\n postType: {\n enum: Object.values(EnumPostType),\n required: true,\n type: String,\n },\n resource: {\n required: false,\n type: resourceSchema,\n },\n sharePublic: { required: false, type: socialShareResourceSchema },\n slug: { required: true, type: String },\n tags: { default: [], required: false, type: [String] },\n title: { required: true, type: String },\n },\n { timestamps: true },\n);\n\n// 🔹 Add indexes to speed up searches by title and tags\nschema.index({ title: 1 });\nschema.index({ tags: 1 });\nschema.index({ postType: 1, slug: 1 }, { unique: true });\n\nexport const PostModel =\n (mongoose.models.Post as mongoose.Model<SchemaPostType>) ||\n mongoose.model<SchemaPostType>(\"Post\", schema);\n","import { AppSettingsType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const APP_SETTINGS_ID = \"APP_SETTINGS_DOCUMENT_ID\";\n\nexport type SchemaAppSettingsType = AppSettingsType & {\n adSettings: {\n mobileDisplayEnabled: boolean;\n webDisplayEnabled: boolean;\n };\n};\n\nconst AppSettingSchema = new MongooseSchema<SchemaAppSettingsType>(\n {\n activeSchoolsStudentCountTotal: {\n default: 0,\n required: true,\n type: Number,\n },\n activeSchoolsStudentCountUpdatedAt: {\n default: Date.now,\n required: true,\n type: Date,\n },\n adSettings: {\n mobileDisplayEnabled: { default: false, required: true, type: Boolean },\n webDisplayEnabled: { default: false, required: true, type: Boolean },\n },\n appVersion: { default: \"1.0.1\", required: true, type: String },\n isOfflineMode: { default: false, required: true, type: Boolean },\n key: {\n default: APP_SETTINGS_ID,\n immutable: true, // ✅ prevents changes after creation\n required: true,\n type: String,\n unique: true, // ✅ allowed here\n },\n minimumRedeemableAffiliatePoints: {\n default: 500,\n required: true,\n type: Number,\n },\n },\n { timestamps: true },\n);\n\nexport const AppSettingModel =\n (mongoose.models.AppSetting as mongoose.Model<SchemaAppSettingsType>) ||\n mongoose.model<SchemaAppSettingsType>(\"AppSetting\", AppSettingSchema);\n","import {\n EnumGameStatus,\n EnumGameType,\n GameDocType,\n GameHistory,\n GameType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { OwnerTypeSchema } from \"../global\";\n\nimport { schemaDailyClueGameData } from \"./DailyClue\";\nimport { schemaPuzzleGameData } from \"./PuzzleGame\";\nimport { schemaGameDate } from \"./utils\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaGameType = Omit<GameType, \"_id\"> & {\n _id: ObjectId;\n};\n\n// REMOVE partial when other game types are added\nconst gameDataSchemas: Partial<Record<EnumGameType, any>> = {\n [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,\n [EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,\n [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData,\n};\n\nconst gameDataDefinition = Object.fromEntries(\n Object.entries(gameDataSchemas).map(([key, schema]) => [\n key,\n { default: null, required: false, type: schema },\n ]),\n);\n\nconst gameHistorySchema = new MongooseSchema<GameHistory>(\n {\n createdAt: { required: true, type: Date },\n gameDate: { required: true, type: schemaGameDate },\n gameStatus: {\n enum: Object.values(EnumGameStatus),\n required: true,\n type: String,\n },\n gameTitle: { required: true, type: String },\n gameType: {\n enum: Object.values(EnumGameType),\n required: true,\n type: String,\n },\n gameTypeId: { required: true, type: String },\n pointsEarned: { default: 0, required: true, type: Number },\n },\n { _id: false },\n);\n\nconst gameTypeSchema = new MongooseSchema<SchemaGameType>(\n {\n active: { default: true, required: true, type: Boolean },\n gameData: gameDataDefinition,\n gameHistory: { default: [], required: true, type: [gameHistorySchema] },\n gameTitle: { required: true, type: String },\n gameType: {\n enum: Object.values(EnumGameType),\n required: true,\n type: String,\n },\n gameTypeId: { required: true, type: String },\n },\n { timestamps: true },\n);\n\nconst schema = new MongooseSchema<GameDocType>(\n {\n active: { default: false, required: true, type: Boolean },\n deletedAt: { default: null, required: false, type: Date },\n games: { default: [], required: false, type: [gameTypeSchema] },\n owner: {\n required: true,\n type: OwnerTypeSchema,\n },\n points: { default: 0, required: true, type: Number },\n },\n { timestamps: true },\n);\n\nexport const GameModel =\n (mongoose.models.Game as mongoose.Model<GameDocType>) ||\n mongoose.model<GameDocType>(\"Game\", schema);\n","import {\n DailyClueBaseGame,\n DailyClueGameData,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { schemaGameDate } from \"./utils\";\n\nconst MongooseSchema = mongoose.Schema;\n\n/*\n DAILY CLUE GAME DATA SCHEMA\n**/\nconst schemaLetters = new MongooseSchema<DailyClueGameData[\"letterInfo\"]>(\n {\n collected: { required: false, type: [String] },\n solutionShuffled: { required: true, type: [String] },\n // todaysLetter and todaysPlacement is generated in the backend, so they are not required\n },\n { _id: false },\n);\n\n/**\n * ✅ Shared definition (THIS replaces .obj usage)\n * related to Post Model, PostContentData is using BaseGame\n */\nconst schemaDailyClueBaseGame = new MongooseSchema<DailyClueBaseGame>(\n {\n gameDate: { required: true, type: schemaGameDate },\n gameSolution: { required: true, type: String },\n },\n { _id: false },\n);\n\nexport const schemaDailyClueGameData = new MongooseSchema<DailyClueGameData>(\n {\n gameFields: { required: true, type: schemaDailyClueBaseGame },\n lastFoundDate: { default: null, required: false, type: Date },\n letterInfo: {\n required: true,\n type: schemaLetters,\n },\n points: { default: 0, required: true, type: Number },\n streak: { default: 0, required: true, type: Number },\n },\n { _id: false },\n);\n","import { GameDate } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nconst MongooseSchema = mongoose.Schema;\n\n// ✅ Shared definition\nexport const schemaGameDate = new MongooseSchema<GameDate>(\n {\n endDate: { required: true, type: Date },\n startDate: { required: true, type: Date },\n },\n { _id: false },\n);\n","import {\n PuzzleAnswer,\n PuzzleAnsweredQuestion,\n PuzzleBaseGame,\n PuzzleGameData,\n PuzzleQuestion,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst schemaPuzzleAnswer = new MongooseSchema<PuzzleAnswer>(\n {\n answer: { required: true, type: String },\n answerId: { required: true, type: String },\n correct: { required: true, type: Boolean },\n },\n { _id: false },\n);\n\nconst schemaPuzzleQuestion = new MongooseSchema<PuzzleQuestion>(\n {\n answers: { required: true, type: [schemaPuzzleAnswer] },\n question: { required: true, type: String },\n questionId: { required: true, type: String },\n },\n { _id: false },\n);\n\nconst schemaPuzzleBaseGame = new MongooseSchema<PuzzleBaseGame>(\n {\n questions: { required: true, type: [schemaPuzzleQuestion] },\n },\n { _id: false },\n);\n\nconst schemaPuzzleAnsweredQuestion = new MongooseSchema<PuzzleAnsweredQuestion>(\n {\n questionId: { required: true, type: String },\n selectedAnswerId: { required: true, type: String },\n },\n { _id: false },\n);\n\nexport const schemaPuzzleGameData = new MongooseSchema<PuzzleGameData>(\n {\n answeredQuestions: {\n default: null,\n required: false,\n type: [schemaPuzzleAnsweredQuestion],\n },\n gameFields: { required: true, type: schemaPuzzleBaseGame },\n points: { default: 0, required: true, type: Number },\n streak: { default: 0, required: true, type: Number },\n },\n { _id: false },\n);\n","import { SchoolCampaignType, SchoolType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport {\n ContactDetailsSchema,\n locationsSchema,\n OwnerTypeSchema,\n ResourceImageTypeSchema,\n SocialMediaTypeSchema,\n termsAgreementSchema,\n} from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\ntype SchoolDocument = Omit<SchoolType, \"ranking\">;\n\nconst campaignsSchema = new MongooseSchema<SchoolCampaignType>(\n {\n endDate: { required: true, type: Date },\n name: { required: true, type: String },\n startDate: { required: true, type: Date },\n },\n { _id: false },\n);\n\nconst schema = new MongooseSchema<SchoolDocument>(\n {\n // New schools are active by default\n active: { default: false, required: true, type: Boolean },\n approvedAt: { default: null, required: false, type: Date },\n campaigns: { required: false, type: [campaignsSchema] },\n contactDetails: { required: false, type: ContactDetailsSchema },\n deletedAt: { default: null, required: false, type: Date },\n location: {\n required: true,\n type: locationsSchema,\n },\n logo: { required: false, type: ResourceImageTypeSchema },\n name: { required: true, type: String },\n overallPoints: { default: 0, required: false, type: Number },\n owner: {\n required: true,\n type: OwnerTypeSchema,\n },\n region: { required: true, type: String },\n schoolCode: { required: true, type: String },\n socialMedia: { required: false, type: [SocialMediaTypeSchema] },\n studentCount: { default: 0, required: true, type: Number },\n termsAgreement: { required: true, type: termsAgreementSchema },\n },\n { timestamps: true },\n);\n\nschema.index(\n { schoolCode: 1 },\n {\n partialFilterExpression: { active: true, deletedAt: null },\n unique: true,\n },\n);\n\nexport const SchoolModel =\n (mongoose.models.School as mongoose.Model<SchoolDocument>) ||\n mongoose.model<SchoolDocument>(\"School\", schema);\n","import {\n AffiliateBankAccountDetailsType,\n AffiliateContactDetails,\n AffiliateDetailsType,\n AffiliateResourceType,\n AffiliateRewardType,\n AffiliateType,\n EnumAffiliateParticipantType,\n EnumAffiliateRewardType,\n EnumResourceType,\n RedeemHistoryType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport {\n locationsSchema,\n OwnerTypeSchema,\n SchemaOwnerType,\n SocialMediaTypeSchema,\n termsAgreementSchema,\n} from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaAffiliateReward = AffiliateRewardType;\n\nexport type SchemaAffiliateResourceType = Omit<\n AffiliateResourceType,\n \"resourceId\" | \"resourceOwner\"\n> & {\n resourceId: ObjectId;\n resourceOwner: SchemaOwnerType;\n};\n\ntype AffiliateDocument = Omit<\n AffiliateType,\n \"_id\" | \"owner\" | \"affiliateResources\"\n> & {\n affiliateResources: SchemaAffiliateResourceType[];\n owner: SchemaOwnerType;\n};\n\nconst affiliateRewardSchema = new MongooseSchema<SchemaAffiliateReward>(\n {\n createdAt: { required: true, type: Date },\n redeemedAt: { default: null, required: false, type: Date },\n rewardDescription: { required: true, type: String },\n rewardType: {\n enum: Object.values(EnumAffiliateRewardType),\n required: true,\n type: String,\n },\n rewardValue: { required: true, type: Number },\n },\n { _id: false },\n);\n\nconst affiliateResourceSchema = new MongooseSchema<SchemaAffiliateResourceType>(\n {\n resourceActive: { default: true, required: true, type: Boolean },\n resourceDeletedAt: { default: null, required: false, type: Date },\n resourceId: {\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n resourceName: { required: true, type: String },\n resourceOwner: {\n required: true,\n type: OwnerTypeSchema,\n },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n rewards: {\n default: [],\n required: false,\n type: [affiliateRewardSchema],\n },\n },\n { _id: false },\n);\n\nconst affiliateContactDetailsSchema =\n new MongooseSchema<AffiliateContactDetails>(\n {\n mobilePhone: { required: true, type: String },\n },\n { _id: false },\n );\n\nconst affiliateBankAccountDetailsSchema =\n new MongooseSchema<AffiliateBankAccountDetailsType>(\n {\n accountHolderName: { required: true, type: String },\n accountNumber: { required: true, type: String },\n },\n { _id: false },\n );\n\nconst affiliateDetailsSchema = new MongooseSchema<AffiliateDetailsType>(\n {\n bankAccountDetails: {\n required: true,\n type: affiliateBankAccountDetailsSchema,\n },\n contactDetails: { required: true, type: affiliateContactDetailsSchema },\n email: { required: true, type: String },\n firstName: { required: true, type: String },\n irdNumber: { required: true, type: String },\n lastName: { required: true, type: String },\n location: { required: true, type: locationsSchema },\n participantType: {\n enum: Object.values(EnumAffiliateParticipantType),\n required: true,\n type: String,\n },\n socialMedia: { required: false, type: [SocialMediaTypeSchema] },\n termsAgreement: { required: true, type: termsAgreementSchema },\n },\n { _id: false },\n);\n\nconst redeemHistorySchema = new MongooseSchema<RedeemHistoryType>(\n {\n paidAt: { default: null, required: false, type: Date },\n redeemedAt: { required: true, type: Date },\n rewardValue: { required: true, type: Number },\n },\n { _id: false },\n);\n\nconst schema = new MongooseSchema<AffiliateDocument>(\n {\n active: { default: false, required: true, type: Boolean },\n affiliateBonusRewards: {\n default: [],\n required: false,\n type: [affiliateRewardSchema],\n },\n affiliateCode: { default: null, required: false, type: String },\n affiliateDetails: { required: false, type: affiliateDetailsSchema },\n affiliateResources: {\n default: [],\n required: false,\n type: [affiliateResourceSchema],\n },\n approvedAt: { default: null, required: false, type: Date },\n deletedAt: { default: null, required: false, type: Date },\n overallPoints: { default: 0, required: true, type: Number },\n owner: {\n required: true,\n type: OwnerTypeSchema,\n },\n redeemHistory: {\n default: [],\n required: false,\n type: [redeemHistorySchema],\n },\n },\n { timestamps: true },\n);\n\nschema.index(\n { affiliateCode: 1 },\n {\n partialFilterExpression: { active: true, deletedAt: null },\n unique: true,\n },\n);\n\nexport const AffiliateModel =\n (mongoose.models.Affiliate as mongoose.Model<AffiliateDocument>) ||\n mongoose.model<AffiliateDocument>(\"Affiliate\", schema);\n","import {\n CouponCodeType,\n CouponDataType,\n CouponOption,\n CouponParticipantUserType,\n CouponType,\n EnumCouponQualificationType,\n EnumResourceType,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nimport { OwnerTypeSchema, ResourceImageTypeSchema } from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\ntype SchemaCouponParticipantUserType = Omit<\n CouponParticipantUserType,\n \"userId\"\n> & {\n userId: ObjectId;\n};\n\ntype SchemaCouponVendorProductType = {\n couponId: ObjectId;\n productId: ObjectId;\n vendorCouponId?: ObjectId;\n vendorId: ObjectId;\n};\n\ntype SchemaCouponDataType = Omit<\n CouponDataType,\n \"participantUsers\" | \"couponVendorProducts\"\n> & {\n couponVendorProducts?: SchemaCouponVendorProductType[];\n participantUsers: SchemaCouponParticipantUserType[] | null;\n};\n\nexport type CouponDocument = Omit<CouponType, \"couponData\"> & {\n couponData: SchemaCouponDataType[];\n};\n\nconst couponOptionSchema = new MongooseSchema<CouponOption>(\n {\n buy: { required: false, type: Number },\n get: { required: false, type: Number },\n maxRewardCount: { required: false, type: Number },\n type: {\n enum: Object.values(EnumCouponQualificationType),\n required: true,\n type: String,\n },\n unit: { required: false, type: String },\n visits: { required: false, type: Number },\n },\n { _id: false },\n);\n\nconst couponVendorProductSchema =\n new MongooseSchema<SchemaCouponVendorProductType>(\n {\n couponId: {\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n productId: {\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n vendorCouponId: {\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n vendorId: {\n ref: \"Vendor\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\n );\n\nconst couponCodeSchema = new MongooseSchema<CouponCodeType>(\n {\n code: { required: true, type: String },\n qrCode: { required: true, type: ResourceImageTypeSchema },\n shareableQrCode: { required: true, type: ResourceImageTypeSchema },\n },\n { _id: false },\n);\n\nconst couponParticipantUserSchema =\n new MongooseSchema<SchemaCouponParticipantUserType>(\n {\n couponCollectedCount: { default: 0, required: true, type: Number },\n couponCycleRedeemed: { default: false, required: true, type: Boolean },\n couponRedeemedAt: { default: null, required: false, type: Date },\n couponRedeemedCount: { default: 0, required: true, type: Number },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n );\n\nconst couponDataSchema = new MongooseSchema<SchemaCouponDataType>(\n {\n active: { default: true, required: true, type: Boolean },\n couponCode: { required: false, type: couponCodeSchema },\n couponDescription: { required: true, type: String },\n couponOption: { required: true, type: couponOptionSchema },\n couponVendorProducts: {\n required: false,\n type: [couponVendorProductSchema],\n },\n deletedAt: { default: null, required: false, type: Date },\n endDate: { required: true, type: Date },\n participantUsers: {\n default: null,\n required: false,\n type: [couponParticipantUserSchema],\n },\n resourceId: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n startDate: { required: true, type: Date },\n },\n { timestamps: true },\n);\n\nconst schema = new MongooseSchema<CouponDocument>(\n {\n active: { default: true, required: true, type: Boolean },\n couponData: { default: [], required: false, type: [couponDataSchema] },\n deletedAt: { default: null, required: false, type: Date },\n owner: {\n required: true,\n type: OwnerTypeSchema,\n },\n },\n { timestamps: true },\n);\n\n// Indexes for the getCoupons aggregations. All three (activeCoupons,\n// scannedCoupons, ownedCoupons) open with `{ active: true, deletedAt: null }`,\n// so one compound index serves that shared prefix; `owner.userId` (a top-level\n// embedded field, NOT inside `couponData`) covers ownedCoupons' equality match.\n// The nested participant filter used by scannedCoupons lives inside the\n// `couponData` array of subdocuments, so it needs its own multikey index.\n//\n// Note: the `$sort: { updatedAt: -1 }` at the end of each aggregation cannot\n// use an index because it follows `$addFields`/`$match` stages — only the\n// leading `$match` is indexable.\nschema.index({ active: 1, deletedAt: 1, \"owner.userId\": 1 });\nschema.index({ \"couponData.participantUsers.userId\": 1 });\n\nexport const CouponModel =\n (mongoose.models.Coupon as mongoose.Model<CouponDocument>) ||\n mongoose.model<CouponDocument>(\"Coupon\", schema);\n","import { EnumResourceType } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaImpersonationSessionType = {\n /** The SUPER_ADMIN who is impersonating. */\n impersonatorUserId: ObjectId;\n /** The resource owner being impersonated. */\n impersonatedUserId: ObjectId;\n /** Hashed impersonation refresh token (stored here, not on the User doc). */\n refreshToken: string;\n expiresAt: Date;\n};\n\nconst impersonationSessionSchema =\n new MongooseSchema<SchemaImpersonationSessionType>(\n {\n expiresAt: { expires: 0, required: true, type: Date },\n impersonatedUserId: {\n index: true,\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n impersonatorUserId: {\n index: true,\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n refreshToken: { required: true, type: String },\n },\n { timestamps: true },\n );\n\nexport const ImpersonationSessionModel =\n (mongoose.models\n .ImpersonationSession as mongoose.Model<SchemaImpersonationSessionType>) ||\n mongoose.model<SchemaImpersonationSessionType>(\n \"ImpersonationSession\",\n impersonationSessionSchema,\n );\n\nexport type SchemaImpersonationAuditType = {\n action: \"start\" | \"end\";\n /** Reason for an `end` record (manual, logout, reuse_revoked, expired). */\n endReason?: string | null;\n impersonatedUserId: ObjectId;\n impersonatorUserId: ObjectId;\n resourceId?: ObjectId | null;\n resourceType?: EnumResourceType | null;\n sessionId: ObjectId;\n};\n\nconst impersonationAuditSchema =\n new MongooseSchema<SchemaImpersonationAuditType>(\n {\n action: { enum: [\"start\", \"end\"], required: true, type: String },\n endReason: { type: String },\n impersonatedUserId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n impersonatorUserId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n resourceId: { type: mongoose.Schema.Types.ObjectId },\n resourceType: { enum: Object.values(EnumResourceType), type: String },\n sessionId: {\n ref: \"ImpersonationSession\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n );\n\nexport const ImpersonationAuditModel =\n (mongoose.models\n .ImpersonationAudit as mongoose.Model<SchemaImpersonationAuditType>) ||\n mongoose.model<SchemaImpersonationAuditType>(\n \"ImpersonationAudit\",\n impersonationAuditSchema,\n );\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,cAAc;AAErB,IAAM,iBAAiB,SAAS;AAEzB,IAAM,mBAAmB,IAAI,eAAmC;AAAA,EACrE,eAAe,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EAC9C,SAAS,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EACxC,SAAS;AAAA,IACP,SAAS,YAAY;AAAA,IACrB,MAAM,OAAO,OAAO,WAAW;AAAA,IAC/B,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,SAAS,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EACxC,QAAQ;AAAA,IACN,SAAS,WAAW;AAAA,IACpB,MAAM,OAAO,OAAO,UAAU;AAAA,IAC9B,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,YAAY,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EAC3C,cAAc,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EAC7C,gBAAgB,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EAC/C,cAAc,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,EAC7C,cAAc;AAAA,IACZ,MAAM,OAAO,OAAO,gBAAgB;AAAA,IACpC,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AACF,CAAC;AAED,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,IACE,QAAQ,EAAE,SAAS,MAAM,MAA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ACL,UAAU;AAAA,MACV,MAAMD,WAAS,OAAO,MAAM;AAAA,IAC9B;AAAA,IACA,oBAAoB;AAAA,MAClB,KAAK;AAAA,MACL,UAAU;AAAA,MACV,MAAMA,WAAS,OAAO,MAAM;AAAA,IAC9B;AAAA,IACA,YAAY,EAAE,MAAMA,WAAS,OAAO,MAAM,SAAS;AAAA,IACnD,cAAc,EAAE,MAAM,OAAO,OAAOD,iBAAgB,GAAG,MAAM,OAAO;AAAA,IACpE,WAAW;AAAA,MACT,KAAK;AAAA,MACL,UAAU;AAAA,MACV,MAAMC,WAAS,OAAO,MAAM;AAAA,IAC9B;AAAA,EACF;AAAA,EACA,EAAE,YAAY,KAAK;AACrB;AAEK,IAAM,0BACVA,WAAS,OACP,sBACHA,WAAS;AAAA,EACP;AAAA,EACA;AACF;","names":["mongoose","schema","EnumAdApprovalStatus","EnumAdBookingSlotKind","EnumAdShowOn","mongoose","EnumAdShowOn","schema","mongoose","EnumAdApprovalStatus","EnumAdBookingSlotKind","EnumAdShowOn","mongoose","schema","mongoose","schema","mongoose","MongooseSchema","schema","mongoose","MongooseSchema","mongoose","MongooseSchema","EnumUserLicence","mongoose","MongooseSchema","mongoose","$set","schema","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","schema","mongoose","MongooseSchema","schema","EnumEventDateStatus","EnumResourceType","mongoose","EnumEventDateStatus","mongoose","MongooseSchema","dateTimeSchema","schema","MongooseSchema","mongoose","EnumEventDateStatus","EnumResourceType","EnumEventDateStatus","EnumOSPlatform","EnumResourceType","mongoose","MongooseSchema","mongoose","EnumEventDateStatus","EnumOSPlatform","schema","EnumResourceType","EnumBillingPeriod","EnumNotificationResourceType","EnumOSPlatform","EnumResourceType","EnumUserLicence","mongoose","MongooseSchema","mongoose","EnumBillingPeriod","EnumUserLicence","schema","EnumNotificationResourceType","EnumResourceType","EnumOSPlatform","mongoose","MongooseSchema","schema","EnumEventDateStatus","mongoose","MongooseSchema","mongoose","EnumEventDateStatus","schema","mongoose","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","mongoose","schema","EnumEventType","mongoose","MongooseSchema","mongoose","schema","EnumEventType","mongoose","schema","mongoose","mongoose","MongooseSchema","mongoose","schema","EnumPostType","EnumResourceType","mongoose","MongooseSchema","mongoose","EnumResourceType","schema","EnumPostType","mongoose","MongooseSchema","mongoose","mongoose","mongoose","MongooseSchema","MongooseSchema","mongoose","mongoose","MongooseSchema","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","mongoose","schema","EnumResourceType","mongoose","MongooseSchema","mongoose","EnumResourceType","schema","EnumResourceType","mongoose","MongooseSchema","mongoose","EnumResourceType","schema","EnumResourceType","mongoose","MongooseSchema"]}
@@ -14,4 +14,4 @@ export {
14
14
  mongoose,
15
15
  EnumPubSubEvents
16
16
  };
17
- //# sourceMappingURL=chunk-6PNG5BI5.mjs.map
17
+ //# sourceMappingURL=chunk-TMPPPLIW.mjs.map
@@ -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\nexport interface AuthUser {\n email: string;\n roles: EnumUserRole[];\n userId: ObjectId;\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"]}
@@ -60,6 +60,10 @@ interface AuthUser {
60
60
  email: string;
61
61
  roles: EnumUserRole[];
62
62
  userId: ObjectId;
63
+ /** Set when this token represents an impersonation session. */
64
+ impersonationSessionId?: string;
65
+ /** The SUPER_ADMIN who started the impersonation session. */
66
+ impersonatorUserId?: ObjectId;
63
67
  }
64
68
  interface SubscriptionPayload {
65
69
  getChatMessage?: SchemaChatType;
@@ -60,6 +60,10 @@ interface AuthUser {
60
60
  email: string;
61
61
  roles: EnumUserRole[];
62
62
  userId: ObjectId;
63
+ /** Set when this token represents an impersonation session. */
64
+ impersonationSessionId?: string;
65
+ /** The SUPER_ADMIN who started the impersonation session. */
66
+ impersonatorUserId?: ObjectId;
63
67
  }
64
68
  interface SubscriptionPayload {
65
69
  getChatMessage?: SchemaChatType;