@timardex/cluemart-server-shared 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1981,6 +1981,7 @@ schema15.index({ "licences.expiryDate": 1 });
1981
1981
  schema15.index({ "licences.licenceType": 1 });
1982
1982
  schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
1983
1983
  schema15.index({ email: "text", firstName: "text", lastName: "text" });
1984
+ schema15.index({ email: 1 }, { name: "email_unique", unique: true });
1984
1985
  schema15.index({ "associatedResources.events": 1 });
1985
1986
  schema15.index({ "associatedResources.partners": 1 });
1986
1987
  schema15.index({ "associatedResources.vendors": 1 });
@@ -3038,4 +3039,4 @@ export {
3038
3039
  ImpersonationSessionModel,
3039
3040
  ImpersonationAuditModel
3040
3041
  };
3041
- //# sourceMappingURL=chunk-ABW2L2HY.mjs.map
3042
+ //# sourceMappingURL=chunk-HHATQITH.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/AdPurchase.ts","../src/mongoose/ad/AdMetrics.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/AiImportedMarket.ts","../src/mongoose/AiImportRun.ts","../src/mongoose/AiImportRunLock.ts","../src/mongoose/ScrapeSite.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/AuthHandoffToken.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 isUtcMidnight,\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 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 end: {\n required: true,\n type: Date,\n validate: {\n message: \"end must be a UTC-midnight day key.\",\n validator: isUtcMidnight,\n },\n },\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: {\n required: true,\n type: Date,\n validate: {\n message: \"start must be a UTC-midnight day key.\",\n validator: isUtcMidnight,\n },\n },\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, EnumAdShowOn } 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: Object.values(EnumAdShowOn),\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 EnumAdShowOn,\n isUtcMidnight,\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 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 required: true,\n type: Date,\n validate: {\n message: \"dayKey must be a UTC-midnight day key.\",\n validator: isUtcMidnight,\n },\n },\n expiresAt: { default: null, type: Date },\n placement: {\n enum: Object.values(EnumAdShowOn),\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 default: EnumAdBookingSlotKind.PAID,\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 = 30;\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);\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 mongoose from \"mongoose\";\n\nimport { schemaAdresource } from \"./Ad\";\n\n/** One Stripe payment covers individually capacity-guarded daily bookings. */\nconst schema = new mongoose.Schema(\n {\n _id: { required: true, type: String },\n approvalRequired: { type: Boolean },\n bookingIds: { required: true, type: [String] },\n checkoutAttemptId: { required: true, type: String },\n checkoutLeaseUntil: { type: Date },\n checkoutLeaseToken: { type: String },\n createdAt: { default: Date.now, required: true, type: Date },\n expiresAt: { required: true, type: Date },\n holdsReleased: { type: Boolean },\n quote: { required: true, type: mongoose.Schema.Types.Mixed },\n resource: { required: true, type: schemaAdresource },\n selectionKey: { required: true, type: String },\n state: {\n enum: [\"reserving\", \"checkout\", \"paid\", \"failed\", \"cancelled\"],\n required: true,\n type: String,\n },\n stripeCheckoutSessionId: { default: null, type: String },\n stripePaymentIntentId: { default: null, type: String },\n stripeRequestStartedAt: { type: Date },\n userId: { required: true, type: String },\n },\n { collection: \"adPurchases\" },\n);\n\n/* eslint-disable sort-keys -- Unique index matches checkout ownership and attempt. */\nschema.index({ userId: 1, checkoutAttemptId: 1 }, { unique: true });\n/* eslint-enable sort-keys */\nschema.index(\n { stripeCheckoutSessionId: 1 },\n {\n unique: true,\n partialFilterExpression: { stripeCheckoutSessionId: { $type: \"string\" } },\n },\n);\n/* eslint-disable sort-keys -- Expired purchase scan. */\nschema.index({ state: 1, expiresAt: 1 });\n/* eslint-enable sort-keys */\n\nexport const AdPurchaseModel =\n mongoose.models.AdPurchase || mongoose.model(\"AdPurchase\", schema);\n","import {\n AdMetricsResourceType,\n AdMetricsType,\n EnumAdPlatform,\n EnumAdShowOn,\n isUtcMidnight,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nconst ResourceMetricsSchema = new mongoose.Schema<AdMetricsResourceType>(\n {\n clicks: { default: 0, required: true, type: Number },\n date: {\n immutable: true,\n required: true,\n type: Date,\n validate: {\n message: \"date must be a UTC-midnight day key.\",\n validator: isUtcMidnight,\n },\n },\n impressions: { default: 0, required: true, type: Number },\n placement: {\n enum: Object.values(EnumAdShowOn),\n immutable: true,\n required: true,\n type: String,\n },\n platform: {\n enum: Object.values(EnumAdPlatform),\n immutable: true,\n required: true,\n type: String,\n },\n },\n { _id: false },\n);\n\nconst schema = new mongoose.Schema<AdMetricsType>(\n {\n adId: { ref: \"Ad\", required: true, type: String },\n resource: { default: [], type: [ResourceMetricsSchema] },\n },\n { timestamps: true },\n);\n\n// One metrics document per ad, with a bucket per NZ calendar day, placement\n// and platform inside its `resource` array.\n//\n// The `adId` unique index enforces one document per ad so concurrent `$push`\n// upserts can't create duplicate parent documents; the compound multikey index\n// enforces one bucket per (ad, day, placement, platform) across documents.\nschema.index({ adId: 1 }, { unique: true });\nschema.index(\n {\n adId: 1,\n \"resource.date\": 1,\n \"resource.placement\": 1,\n \"resource.platform\": 1,\n },\n { unique: true },\n);\n\nexport const AdMetricsModel =\n (mongoose.models.AdMetrics as mongoose.Model<AdMetricsType>) ||\n mongoose.model<AdMetricsType>(\"AdMetrics\", schema);\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 AssociateType,\n Category,\n DateTimeType,\n EnumAssociateStatus,\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 type SchemaAssociateType = Omit<AssociateType, \"userId\" | \"status\"> & {\n status: EnumAssociateStatus;\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 AssociateTypeSchema = new MongooseSchema<SchemaAssociateType>(\n {\n addedAt: { default: Date.now, required: false, type: Date },\n email: { lowercase: true, required: true, trim: true, type: String },\n respondedAt: { default: null, required: false, type: Date },\n status: {\n default: EnumAssociateStatus.PENDING,\n enum: Object.values(EnumAssociateStatus),\n required: true,\n type: String,\n },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\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 associates: { default: [], required: false, type: [AssociateTypeSchema] },\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 ContactDetailsSchema,\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 /** Indexed earliest `dateTime` start instant for chronological pagination. */\n earliestStartDate?: Date | null;\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 contactDetails: { required: false, type: ContactDetailsSchema },\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 earliestStartDate: { default: null, required: false, type: Date },\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 });\n// eslint-disable-next-line sort-keys\nschema.index({ earliestStartDate: 1, _id: 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 */\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 AiImportedMarket,\n EnumEventType,\n EnumImportedMarketDeactivationReason,\n EnumImportedMarketReviewStatus,\n GoogleAddressComponent,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nimport {\n ContactDetailsSchema,\n dateTimeSchema,\n locationsSchema,\n ResourceImageTypeSchema,\n} from \"./global\";\nimport { searchNamePlugin } from \"./searchNamePlugin\";\n\nexport type SchemaAiImportedMarket = Omit<\n AiImportedMarket,\n \"eventId\" | \"claimedByUserId\" | \"reviewedByUserId\"\n> & {\n eventId?: mongoose.Types.ObjectId;\n claimedByUserId?: mongoose.Types.ObjectId;\n reviewedByUserId?: mongoose.Types.ObjectId;\n /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */\n searchName?: string;\n /** Indexed earliest `dateTime` start instant for chronological pagination. */\n earliestStartDate?: Date | null;\n /** Set to the run timestamp each time the market appears on its source. */\n lastSeenAt?: Date | null;\n /** Consecutive successful runs where the market did not appear. */\n missedRuns?: number;\n /** Hash of the raw model description used to skip unchanged re-rewrites. */\n descriptionSourceHash?: string | null;\n /** Why an active market was deactivated (null while active). */\n deactivatedReason?: EnumImportedMarketDeactivationReason | null;\n /** sourceKey of an existing AI market this one may duplicate (soft flag). */\n duplicateHint?: string | null;\n /** Fields still missing before the market can be approved. */\n missingFields?: string[];\n /**\n * Set when an admin edits a queued candidate. The importer stops overwriting\n * such a document's content on re-scrape (it only refreshes bookkeeping), so a\n * reviewer's fix is never replaced by the source data; approval clears it.\n */\n reviewerEditedAt?: Date | null;\n /**\n * True while the published listing's city is unknown: approval fell back to\n * the region because the document never carried one. The duplicate matcher\n * treats such a listing as matching any city, which the publication key alone\n * cannot express, so approvals of the same name + region are serialised.\n * Rewritten by every approval (with the key), so a value left on an\n * unpublished document is stale but self-correcting.\n */\n publicationCityUnknown?: boolean | null;\n /**\n * Normalized `region::name::city` key held only while the market is the\n * published listing for that market. A unique partial index on it makes\n * \"one published listing per market\" a durable constraint (see below).\n */\n publicationKey?: string | null;\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 * Schema for AI-imported markets (scraped from admin-defined websites via the\n * DeepSeek API). Mirrors GoogleImportedMarket so approved markets can ride the\n * same combined read paths, but adds review/provenance fields and uses\n * `sourceKey` as the unique dedupe key instead of `googlePlaceId`.\n */\nconst schema = new MongooseSchema<SchemaAiImportedMarket>(\n {\n active: { default: false, required: true, type: Boolean },\n address: { required: false, type: String },\n addressComponents: { required: false, type: [addressComponentSchema] },\n approvedAt: { default: null, required: false, type: Date },\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 contactDetails: { required: false, type: ContactDetailsSchema },\n cover: {\n required: false,\n type: ResourceImageTypeSchema,\n },\n dateTime: [dateTimeSchema],\n deactivatedReason: {\n enum: Object.values(EnumImportedMarketDeactivationReason),\n required: false,\n type: String,\n },\n deletedAt: { default: null, required: false, type: Date },\n description: { required: true, type: String },\n descriptionSourceHash: { required: false, type: String },\n duplicateHint: { required: false, type: String },\n earliestStartDate: { default: null, required: false, type: Date },\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 images: { required: false, type: [ResourceImageTypeSchema] },\n lastSeenAt: { default: null, required: false, type: Date },\n location: {\n required: false,\n type: locationsSchema,\n },\n logo: { required: false, type: ResourceImageTypeSchema },\n missedRuns: { default: 0, required: true, type: Number },\n missingFields: { required: false, type: [String] },\n name: { required: true, type: String },\n openingHours: { required: false, type: [String] },\n publicationCityUnknown: { default: false, required: false, type: Boolean },\n publicationKey: { required: false, type: String },\n rainOrShine: { required: true, type: Boolean },\n rating: { required: false, type: Number },\n region: { required: false, type: String },\n rejectReason: { required: false, type: String },\n reviewCount: { required: false, type: Number },\n reviewedAt: { default: null, required: false, type: Date },\n reviewedByUserId: {\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n reviewerEditedAt: { default: null, required: false, type: Date },\n reviewStatus: {\n default: EnumImportedMarketReviewStatus.PENDING,\n enum: Object.values(EnumImportedMarketReviewStatus),\n required: true,\n type: String,\n },\n scrapedAt: { default: () => new Date(), required: true, type: Date },\n slug: { required: true, type: String },\n sourceKey: {\n required: true,\n type: String,\n unique: true, // unique, indexed\n },\n sourceName: { required: true, type: String },\n sourceUrl: { required: true, type: String },\n tags: { required: false, type: [String] },\n website: { required: false, type: String },\n },\n { timestamps: true },\n);\n\n// Indexes for search, geo, soft-delete, review, 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 });\n// eslint-disable-next-line sort-keys\nschema.index({ earliestStartDate: 1, _id: 1 });\n// Public list reads filter reviewStatus + active (and region) and sort by\n// earliestStartDate; these compounds keep those scans index-backed as the\n// collection grows.\n// eslint-disable-next-line sort-keys\nschema.index({ reviewStatus: 1, active: 1, earliestStartDate: 1, _id: 1 });\n/* eslint-disable sort-keys -- index key order is semantic */\nschema.index({\n region: 1,\n reviewStatus: 1,\n active: 1,\n earliestStartDate: 1,\n _id: 1,\n});\n/* eslint-enable sort-keys */\n// `{ region, searchName }` is intentionally NOT unique: two different markets\n// can legitimately share a name within a region (e.g. two \"Farmers Market\"s\n// in different suburbs). Cross-source duplicates are flagged softly for admin\n// review instead of enforced by a hard index (see scrapeConfiguredSites).\nschema.index({ region: 1, searchName: 1 });\n// \"One published listing per market\" as a durable rule: the approval update\n// writes `publicationKey` in the same operation that sets APPROVED, so two\n// concurrent approvals of the same market cannot both commit — the loser fails\n// with a duplicate-key error instead of being cleaned up after the fact. The\n// key is released (unset) whenever a market stops being the published record.\n// A partial index keeps it out of every non-published document.\nschema.index(\n { publicationKey: 1 },\n {\n name: \"ai_market_publication_key\",\n partialFilterExpression: {\n publicationKey: { $exists: true, $type: \"string\" },\n },\n unique: true,\n },\n);\nschema.index({ slug: 1 });\nschema.index({ reviewStatus: 1 });\n\n// Full-text search across name/description (see eventsSearch ai branch).\nschema.index({ description: \"text\", name: \"text\" });\n\nschema.plugin(searchNamePlugin);\n\nexport const AiImportedMarketModel =\n (mongoose.models\n .AiImportedMarket as mongoose.Model<SchemaAiImportedMarket>) ||\n mongoose.model<SchemaAiImportedMarket>(\"AiImportedMarket\", schema);\n","import {\n AiImportUsage,\n EnumAiImportRunStatus,\n} from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type AiImportRunStatus = EnumAiImportRunStatus;\n\nexport type AiImportSiteResult = {\n error?: string | null;\n errors: number;\n found: number;\n imported: number;\n name: string;\n skipped: number;\n skipReasons?: Array<{ count: number; reason: string }>;\n status: EnumAiImportRunStatus.SUCCESS | EnumAiImportRunStatus.ERROR;\n usage: AiImportUsage;\n url: string;\n};\n\nexport type SchemaAiImportRun = {\n _id: mongoose.Types.ObjectId;\n createdAt: Date;\n updatedAt: Date;\n error?: string | null;\n finishedAt?: Date | null;\n result?: {\n errors: number;\n totalFound: number;\n totalImported: number;\n totalSkipped: number;\n } | null;\n siteResults: AiImportSiteResult[];\n startedAt: Date;\n status: AiImportRunStatus;\n triggeredByUserId?: mongoose.Types.ObjectId | null;\n usage?: AiImportUsage | null;\n};\n\nconst usageSchema = new MongooseSchema<AiImportUsage>(\n {\n completionTokens: { default: 0, required: true, type: Number },\n promptTokens: { default: 0, required: true, type: Number },\n totalTokens: { default: 0, required: true, type: Number },\n },\n { _id: false },\n);\n\nconst siteResultSchema = new MongooseSchema<AiImportSiteResult>(\n {\n error: { required: false, type: String },\n errors: { default: 0, required: true, type: Number },\n found: { default: 0, required: true, type: Number },\n imported: { default: 0, required: true, type: Number },\n name: { required: true, type: String },\n skipped: { default: 0, required: true, type: Number },\n skipReasons: {\n default: undefined,\n required: false,\n type: [\n new MongooseSchema(\n {\n count: { required: true, type: Number },\n reason: { required: true, type: String },\n },\n { _id: false },\n ),\n ],\n },\n status: {\n enum: [EnumAiImportRunStatus.SUCCESS, EnumAiImportRunStatus.ERROR],\n required: true,\n type: String,\n },\n url: { required: true, type: String },\n usage: { required: true, type: usageSchema },\n },\n { _id: false, suppressReservedKeysWarning: true },\n);\n\nconst resultSchema = new MongooseSchema(\n {\n errors: { default: 0, required: true, type: Number },\n totalFound: { default: 0, required: true, type: Number },\n totalImported: { default: 0, required: true, type: Number },\n totalSkipped: { default: 0, required: true, type: Number },\n },\n { _id: false, suppressReservedKeysWarning: true },\n);\n\nconst schema = new MongooseSchema<SchemaAiImportRun>(\n {\n error: { required: false, type: String },\n finishedAt: { required: false, type: Date },\n result: { required: false, type: resultSchema },\n siteResults: { default: [], required: true, type: [siteResultSchema] },\n startedAt: { default: () => new Date(), required: true, type: Date },\n status: {\n default: EnumAiImportRunStatus.PENDING,\n enum: Object.values(EnumAiImportRunStatus),\n required: true,\n type: String,\n },\n triggeredByUserId: {\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n usage: { required: false, type: usageSchema },\n },\n { timestamps: true },\n);\n\nschema.index({ createdAt: -1 });\n\nexport const AiImportRunModel =\n (mongoose.models.AiImportRun as mongoose.Model<SchemaAiImportRun>) ||\n mongoose.model<SchemaAiImportRun>(\"AiImportRun\", schema);\n","import mongoose from \"mongoose\";\n\n/** Fixed `_id` of the single-document lock guarding AI import runs. */\nexport const AI_IMPORT_RUN_LOCK_KEY = \"ai-import-run\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst schema = new MongooseSchema(\n {\n _id: { required: true, type: String },\n lockedAt: { required: false, type: Date },\n token: { required: false, type: String },\n },\n { timestamps: true },\n);\n\nexport const AiImportRunLockModel =\n (mongoose.models.AiImportRunLock as mongoose.Model<{\n _id: string;\n lockedAt?: Date | null;\n token?: string | null;\n }>) || mongoose.model(\"AiImportRunLock\", schema);\n","import { ScrapeSite } from \"@timardex/cluemart-shared\";\nimport mongoose from \"mongoose\";\n\n/**\n * Fixed `_id` of the single-document AI scrape-site config. Using `_id`\n * (rather than a free-form `key` field) makes the singleton structural: the\n * collection can only ever contain one configuration document.\n */\nexport const SCRAPE_SITES_CONFIG_ID = \"scrapeSites\";\n\nconst MongooseSchema = mongoose.Schema;\n\ntype SchemaScrapeSiteItem = Omit<ScrapeSite, \"_id\" | \"createdAt\" | \"updatedAt\">;\n\ntype SchemaScrapeSiteConfig = {\n _id: string;\n sites: Array<SchemaScrapeSiteItem & { _id: mongoose.Types.ObjectId }>;\n updatedByUserId?: mongoose.Types.ObjectId;\n};\n\nconst scrapeSiteItemSchema = new MongooseSchema<SchemaScrapeSiteItem>(\n {\n enabled: { default: true, required: true, type: Boolean },\n lastCount: { required: false, type: Number },\n lastError: { required: false, type: String },\n lastScrapedAt: { required: false, type: Date },\n lastScrapeStatus: { required: false, type: String },\n name: { required: true, type: String },\n regionHint: { required: false, type: String },\n url: { required: true, type: String },\n },\n { timestamps: true },\n);\n\n/**\n * Single-document store for the admin-managed AI scrape-site list, keyed by\n * `_id === SCRAPE_SITES_CONFIG_ID`. Keeping the whole list in one document\n * makes replacement a single atomic `$set` (the local MongoDB deployment is\n * standalone, so multi-document transactions are not available).\n */\nconst configSchema = new MongooseSchema<SchemaScrapeSiteConfig>(\n {\n _id: { required: true, type: String },\n sites: {\n default: [],\n required: true,\n type: [scrapeSiteItemSchema],\n },\n updatedByUserId: {\n ref: \"User\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\nexport const ScrapeSiteConfigModel =\n (mongoose.models\n .ScrapeSiteConfig as mongoose.Model<SchemaScrapeSiteConfig>) ||\n mongoose.model<SchemaScrapeSiteConfig>(\"ScrapeSiteConfig\", configSchema);\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 EnumPointType,\n EnumResourceType,\n EnumReward,\n EnumSubscriptionStatus,\n EnumUserLicence,\n EnumUserRole,\n RedeemedReward,\n StripeSubscription,\n UserActivityEvent,\n UserOverallPointsEntry,\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 SchemaUserAssociatedResourcesType = {\n events: ObjectId[];\n partners: ObjectId[];\n vendors: 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 | \"associatedResources\"\n | \"permissions\"\n | \"stripe\"\n | \"totalOverallPoints\"\n> & {\n _id: ObjectId;\n affiliate: ObjectId;\n associatedResources?: SchemaUserAssociatedResourcesType | null;\n coupon: ObjectId;\n events: ObjectId[];\n game: ObjectId;\n partner: ObjectId;\n /** Server-only hashed refresh tokens; never exposed to clients. */\n refreshTokenAdmin?: string | null;\n refreshTokenMobile?: string | null;\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\nconst userOverallPointsSchema = new MongooseSchema<UserOverallPointsEntry>(\n {\n createdAt: { required: true, type: Date },\n points: { default: 0, required: true, type: Number },\n pointType: {\n enum: Object.values(EnumPointType),\n required: true,\n type: String,\n },\n sourceId: { required: false, type: String },\n },\n { _id: false },\n);\n\nconst userAssociatedResourcesSchema =\n new MongooseSchema<SchemaUserAssociatedResourcesType>(\n {\n events: {\n default: [],\n ref: \"Event\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n partners: {\n default: [],\n ref: \"Partner\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n vendors: {\n default: [],\n ref: \"Vendor\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\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 associatedResources: {\n default: () => ({ events: [], partners: [], vendors: [] }),\n required: false,\n type: userAssociatedResourcesSchema,\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 // `normalizeEmail` (`cluemart-shared`) is trim + lower-case; keeping the same\n // rule here means every write path — resolvers, seeds, scripts — stores the\n // comparable form, not only the clients that validate through `emailRequiredSchema`.\n email: { lowercase: true, required: true, trim: 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 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: {\n default: [],\n required: false,\n type: [userOverallPointsSchema],\n },\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 // Per-client slots: a mobile session and an in-app WebView admin session\n // coexist without rotating each other out.\n refreshTokenAdmin: {\n default: null,\n required: false,\n type: String,\n },\n refreshTokenMobile: {\n default: null,\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 }` — promoCodes is the only\n// predicate, so it must lead the index) and the school member list\n// (`{ active: true, deletedAt: null, promoCodes: { $in: [code] } }`, where all\n// three are equality/`$in` predicates and any field order is usable).\n/* eslint-disable-next-line sort-keys -- Compound-index field order controls promo-code lookups. */\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// One account per address. `register` is a check-then-insert, so two concurrent\n// sign-ups can both miss its lookup; this index makes the loser fail with E11000,\n// which `register` turns into the same duplicate-account error. Emails are stored\n// normalised (trimmed, lower-cased) by the schema and `normalizeEmail`, so the\n// stored value is the comparable address. Accounts that collide after\n// normalisation make the build fail: `backfillNormalizedUserEmails` reports them\n// in the deploy log, and `ensureUniqueUserEmailIndex` retries the build on the\n// next boot once they are resolved.\nschema.index({ email: 1 }, { name: \"email_unique\", unique: true });\n// Multikey indexes on the associate grants. Both the state-derived detach\n// (`{ <path>: resourceId, _id: { $nin: acceptedIds } }`) and the cron\n// reconciliation scan (`{ <path>: { $exists: true, $ne: [] } }`) start from\n// this path; without them every associate removal scans the whole collection.\nschema.index({ \"associatedResources.events\": 1 });\nschema.index({ \"associatedResources.partners\": 1 });\nschema.index({ \"associatedResources.vendors\": 1 });\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 SchemaAssociateType,\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\"\n | \"owner\"\n | \"ownerLicenceType\"\n | \"adIds\"\n | \"associates\"\n | \"unregisteredVendorId\"\n> & {\n adIds?: ObjectId[];\n associates?: SchemaAssociateType[] | null;\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\n// Serves associate lookups (`getUserVendors`, `canUserAccessResource`).\nschema.index({ \"associates.userId\": 1, deletedAt: 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 SchemaAssociateType,\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\" | \"ownerLicenceType\" | \"adIds\" | \"associates\"\n> & {\n adIds?: ObjectId[];\n associates?: SchemaAssociateType[] | null;\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 // Claim link of the AI-imported market this event was created from, the\n // counterpart of `googlePlaceId`. Written once by `createEvent`.\n aiImportedMarketSourceKey: {\n default: null,\n required: false,\n type: String,\n },\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\n// Serves associate lookups (`getUserEvents`, `canUserAccessResource`).\nschema.index({ \"associates.userId\": 1, deletedAt: 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 {\n baseResourceFields,\n locationsSchema,\n SchemaAssociateType,\n SchemaOwnerType,\n} from \"./global\";\nimport { searchNamePlugin } from \"./searchNamePlugin\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaPartnerType = Omit<\n PartnerType,\n \"owner\" | \"ownerLicenceType\" | \"adIds\" | \"associates\"\n> & {\n adIds?: ObjectId[];\n associates?: SchemaAssociateType[] | null;\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\n// Serves associate lookups (`getUserPartners`, `canUserAccessResource`).\nschema.index({ \"associates.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 approvalRequired: boolean;\n minAppearancesPerHour?: number;\n mobileDisplayEnabled: boolean;\n purchasePricing?: Record<string, unknown>;\n regionPricing?: Record<string, unknown>;\n paidSlotsPerPlacement?: number;\n reservedSlotsPerPlacement?: number;\n rotationSeconds?: number;\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 approvalRequired: { default: true, required: true, type: Boolean },\n // Kept for older API clients; these fields do not control ad delivery.\n minAppearancesPerHour: {\n max: 12,\n min: 1,\n type: Number,\n validate: Number.isInteger,\n },\n mobileDisplayEnabled: { default: false, required: true, type: Boolean },\n purchasePricing: { type: MongooseSchema.Types.Mixed },\n regionPricing: { type: MongooseSchema.Types.Mixed },\n paidSlotsPerPlacement: { enum: [30], type: Number },\n reservedSlotsPerPlacement: { enum: [7], type: Number },\n rotationSeconds: { enum: [8], type: Number },\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 mongoose from \"mongoose\";\n\nimport type { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\n/**\n * Single-use record backing a WebView auto-login handoff.\n *\n * The app mints a short-lived signed token and opens the admin site with it;\n * the admin site exchanges the token for its own admin-slot session. Keeping\n * the `jti` here (with an atomic `usedAt` update) makes the token replay-proof\n * across server instances — a purely in-memory store would not.\n */\nexport interface AuthHandoffTokenType {\n createdAt: Date;\n expiresAt: Date;\n jti: string;\n updatedAt: Date;\n usedAt: Date | null;\n userId: ObjectId;\n}\n\nconst schema = new MongooseSchema<AuthHandoffTokenType>(\n {\n expiresAt: { required: true, type: Date },\n jti: { index: true, required: true, type: String, unique: true },\n usedAt: { default: null, required: false, type: Date },\n userId: {\n index: true,\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\n// MongoDB removes the record once the handoff lifetime is over.\nschema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });\n\nexport const AuthHandoffTokenModel =\n (mongoose.models.AuthHandoffToken as mongoose.Model<AuthHandoffTokenType>) ||\n mongoose.model<AuthHandoffTokenType>(\"AuthHandoffToken\", schema);\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 // See `GameType.pointsCredited`: absent means \"completed before the marker\n // existed\", which must not be re-credited.\n pointsCredited: { required: false, type: Boolean },\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,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,MAAM,QAAQ;AAAA,IACv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AM,4BACVA,WAAS,OACP,wBACHA,WAAS;AAAA,EACP;AAAA,EACA;AACF;AAaF,IAAM,2BACJ,IAAIC;AAAA,EACF;AAAA,IACE,QAAQ,EAAE,MAAM,CAAC,SAAS,KAAK,GAAG,UAAU,MAAM,MAAM,OAAO;AAAA,IAC/D,WAAW,EAAE,MAAM,OAAO;AAAA,IAC1B,oBAAoB;AAAA,MAClB,KAAK;AAAA,MACL,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":["EnumAdShowOn","mongoose","schema","EnumAdApprovalStatus","EnumAdBookingSlotKind","EnumAdShowOn","isUtcMidnight","mongoose","schema","mongoose","EnumAdApprovalStatus","isUtcMidnight","EnumAdShowOn","EnumAdBookingSlotKind","mongoose","schema","mongoose","EnumAdShowOn","isUtcMidnight","mongoose","schema","mongoose","MongooseSchema","schema","mongoose","MongooseSchema","mongoose","MongooseSchema","EnumUserLicence","mongoose","MongooseSchema","mongoose","$set","schema","MongooseSchema","mongoose","schema","EnumEventType","mongoose","MongooseSchema","mongoose","addressComponentSchema","schema","EnumEventType","mongoose","MongooseSchema","schema","mongoose","MongooseSchema","schema","mongoose","MongooseSchema","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","MongooseSchema","schema","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"]}
package/dist/index.cjs CHANGED
@@ -2094,6 +2094,7 @@ schema15.index({ "licences.expiryDate": 1 });
2094
2094
  schema15.index({ "licences.licenceType": 1 });
2095
2095
  schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
2096
2096
  schema15.index({ email: "text", firstName: "text", lastName: "text" });
2097
+ schema15.index({ email: 1 }, { name: "email_unique", unique: true });
2097
2098
  schema15.index({ "associatedResources.events": 1 });
2098
2099
  schema15.index({ "associatedResources.partners": 1 });
2099
2100
  schema15.index({ "associatedResources.vendors": 1 });