@timardex/cluemart-server-shared 1.0.263 → 1.0.264

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType } from '@timardex/cluemart-shared';
2
+ import { AdType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, AffiliateReward, AffiliateResourceType, AffiliateType } from '@timardex/cluemart-shared';
3
3
  import mongoose from 'mongoose';
4
4
  import { O as ObjectId } from '../Chat-DYkhie3G.mjs';
5
5
  export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-DYkhie3G.mjs';
@@ -392,8 +392,9 @@ declare const ResourceActivityModel: mongoose.Model<ResourceActivityType, {}, {}
392
392
  type SchemaUserActivityEvent = Omit<UserActivityEvent, "resourceId"> & {
393
393
  resourceId: ObjectId;
394
394
  };
395
- type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school"> & {
395
+ type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school" | "affiliate"> & {
396
396
  _id: ObjectId;
397
+ affiliate: ObjectId;
397
398
  events: ObjectId[];
398
399
  game: ObjectId;
399
400
  partner: ObjectId;
@@ -416,8 +417,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActi
416
417
  };
417
418
  };
418
419
  };
419
- declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school"> & {
420
+ declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school" | "affiliate"> & {
420
421
  _id: ObjectId;
422
+ affiliate: ObjectId;
421
423
  events: ObjectId[];
422
424
  game: ObjectId;
423
425
  partner: ObjectId;
@@ -603,4 +605,21 @@ declare const SchoolModel: mongoose.Model<SchoolDocument, {}, {}, {}, mongoose.D
603
605
  __v: number;
604
606
  }, any>;
605
607
 
606
- export { APP_SETTINGS_ID, AdModel, AppSettingModel, CategorySchema, ChatReportModel, ContactDetailsSchema, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatReportType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaOwnerType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, resourceRelationsSchema, socialShareResourceSchema, termsAgreementSchema, userLicenseSchema };
608
+ type SchemaAffiliateReward = AffiliateReward;
609
+ type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceId"> & {
610
+ resourceId: ObjectId;
611
+ };
612
+ type AffiliateDocument = Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
613
+ affiliateResources: SchemaAffiliateResourceType[];
614
+ owner: SchemaOwnerType;
615
+ };
616
+ declare const AffiliateModel: mongoose.Model<AffiliateDocument, {}, {}, {}, mongoose.Document<unknown, {}, AffiliateDocument, {}, {}> & Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
617
+ affiliateResources: SchemaAffiliateResourceType[];
618
+ owner: SchemaOwnerType;
619
+ } & {
620
+ _id: mongoose.Types.ObjectId;
621
+ } & {
622
+ __v: number;
623
+ }, any>;
624
+
625
+ export { APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, CategorySchema, ChatReportModel, ContactDetailsSchema, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatReportType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaOwnerType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, resourceRelationsSchema, socialShareResourceSchema, termsAgreementSchema, userLicenseSchema };
@@ -1,5 +1,5 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType } from '@timardex/cluemart-shared';
2
+ import { AdType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, PosterUsageType, SocialShareResourceType, GoogleImportedMarket, PushTokenType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, AffiliateReward, AffiliateResourceType, AffiliateType } from '@timardex/cluemart-shared';
3
3
  import mongoose from 'mongoose';
4
4
  import { O as ObjectId } from '../Chat-DYkhie3G.js';
5
5
  export { C as ChatModel, N as NotificationModel, a as SchemaChatMessageReactionType, S as SchemaChatMessageReplyPreviewType, b as SchemaChatMessageSeenType, c as SchemaChatMessageType, e as SchemaChatType, f as SchemaCreateBulkNotificationInput, g as SchemaNotificationType, d as SchemaParticipantType } from '../Chat-DYkhie3G.js';
@@ -392,8 +392,9 @@ declare const ResourceActivityModel: mongoose.Model<ResourceActivityType, {}, {}
392
392
  type SchemaUserActivityEvent = Omit<UserActivityEvent, "resourceId"> & {
393
393
  resourceId: ObjectId;
394
394
  };
395
- type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school"> & {
395
+ type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActivity" | "_id" | "game" | "school" | "affiliate"> & {
396
396
  _id: ObjectId;
397
+ affiliate: ObjectId;
397
398
  events: ObjectId[];
398
399
  game: ObjectId;
399
400
  partner: ObjectId;
@@ -416,8 +417,9 @@ type SchemaUserType = Omit<UserType, "vendor" | "events" | "partner" | "userActi
416
417
  };
417
418
  };
418
419
  };
419
- declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school"> & {
420
+ declare const UserModel: mongoose.Model<SchemaUserType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaUserType, {}, {}> & Omit<UserType, "_id" | "vendor" | "events" | "partner" | "userActivity" | "game" | "school" | "affiliate"> & {
420
421
  _id: ObjectId;
422
+ affiliate: ObjectId;
421
423
  events: ObjectId[];
422
424
  game: ObjectId;
423
425
  partner: ObjectId;
@@ -603,4 +605,21 @@ declare const SchoolModel: mongoose.Model<SchoolDocument, {}, {}, {}, mongoose.D
603
605
  __v: number;
604
606
  }, any>;
605
607
 
606
- export { APP_SETTINGS_ID, AdModel, AppSettingModel, CategorySchema, ChatReportModel, ContactDetailsSchema, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatReportType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaOwnerType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, resourceRelationsSchema, socialShareResourceSchema, termsAgreementSchema, userLicenseSchema };
608
+ type SchemaAffiliateReward = AffiliateReward;
609
+ type SchemaAffiliateResourceType = Omit<AffiliateResourceType, "resourceId"> & {
610
+ resourceId: ObjectId;
611
+ };
612
+ type AffiliateDocument = Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
613
+ affiliateResources: SchemaAffiliateResourceType[];
614
+ owner: SchemaOwnerType;
615
+ };
616
+ declare const AffiliateModel: mongoose.Model<AffiliateDocument, {}, {}, {}, mongoose.Document<unknown, {}, AffiliateDocument, {}, {}> & Omit<AffiliateType, "_id" | "owner" | "affiliateResources"> & {
617
+ affiliateResources: SchemaAffiliateResourceType[];
618
+ owner: SchemaOwnerType;
619
+ } & {
620
+ _id: mongoose.Types.ObjectId;
621
+ } & {
622
+ __v: number;
623
+ }, any>;
624
+
625
+ export { APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, CategorySchema, ChatReportModel, ContactDetailsSchema, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatReportType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaOwnerType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relatedPostSchema, resourceRelationsSchema, socialShareResourceSchema, termsAgreementSchema, userLicenseSchema };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  APP_SETTINGS_ID,
3
3
  AdModel,
4
+ AffiliateModel,
4
5
  AppSettingModel,
5
6
  CategorySchema,
6
7
  ChatModel,
@@ -39,10 +40,11 @@ import {
39
40
  socialShareResourceSchema,
40
41
  termsAgreementSchema,
41
42
  userLicenseSchema
42
- } from "../chunk-BDHZYR65.mjs";
43
+ } from "../chunk-REX574WV.mjs";
43
44
  export {
44
45
  APP_SETTINGS_ID,
45
46
  AdModel,
47
+ AffiliateModel,
46
48
  AppSettingModel,
47
49
  CategorySchema,
48
50
  ChatModel,
@@ -3551,6 +3551,7 @@ var gameScreenIdentifierList = [
3551
3551
  match: "/visitors"
3552
3552
  }
3553
3553
  ];
3554
+ var PROMO_CODE_PREFIX = "CM-";
3554
3555
  var EnumAdShowOn = /* @__PURE__ */ ((EnumAdShowOn2) => {
3555
3556
  EnumAdShowOn2["EVENTS_PAGE"] = "Events_page";
3556
3557
  EnumAdShowOn2["FRONT_PAGE"] = "Front_page";
@@ -3609,6 +3610,12 @@ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
3609
3610
  EnumGameType2["ODD_ONE_OUT"] = "oddOneOut";
3610
3611
  return EnumGameType2;
3611
3612
  })(EnumGameType || {});
3613
+ var EnumAffiliateRewardType = /* @__PURE__ */ ((EnumAffiliateRewardType2) => {
3614
+ EnumAffiliateRewardType2["NEW_EVENT_REGISTRATION"] = "NEW_EVENT_REGISTRATION";
3615
+ EnumAffiliateRewardType2["NEW_VENDOR_REGISTRATION"] = "NEW_VENDOR_REGISTRATION";
3616
+ EnumAffiliateRewardType2["NEW_PARTNER_REGISTRATION"] = "NEW_PARTNER_REGISTRATION";
3617
+ return EnumAffiliateRewardType2;
3618
+ })(EnumAffiliateRewardType || {});
3612
3619
  var mapArrayToOptions = (items) => items.map((item) => ({
3613
3620
  label: item,
3614
3621
  value: item
@@ -3626,6 +3633,8 @@ var paymentMethodOptions = mapArrayToOptions(
3626
3633
  Object.values(EnumPaymentMethod)
3627
3634
  );
3628
3635
  var CLUEMART_MAIN_DOMAIN_URL = "https://cluemart.co.nz";
3636
+ var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
3637
+ var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
3629
3638
  var dateFormat = "DD-MM-YYYY";
3630
3639
  var timeFormat = "HH:mm";
3631
3640
  import_dayjs.default.extend(import_customParseFormat.default);
@@ -5021,12 +5030,6 @@ var REDEEMED_REWARD_FIELDS_FRAGMENT = gql`
5021
5030
  redeemedAt
5022
5031
  }
5023
5032
  `;
5024
- var AFFILIATE_FIELDS_FRAGMENT = gql`
5025
- fragment AffiliateFields on AffiliateType {
5026
- affiliateCode
5027
- pointsAvailable
5028
- }
5029
- `;
5030
5033
  var USER_FIELDS_FRAGMENT = gql`
5031
5034
  fragment UserFields on UserType {
5032
5035
  _id
@@ -5034,9 +5037,7 @@ var USER_FIELDS_FRAGMENT = gql`
5034
5037
  associates {
5035
5038
  ...AssociatesFields
5036
5039
  }
5037
- affiliate {
5038
- ...AffiliateFields
5039
- }
5040
+ affiliate
5040
5041
  avatar {
5041
5042
  ...ResourceImageFields
5042
5043
  }
@@ -5080,7 +5081,6 @@ var USER_FIELDS_FRAGMENT = gql`
5080
5081
  ${LICENCE_FIELDS_FRAGMENT}
5081
5082
  ${LOCATION_FIELDS_FRAGMENT}
5082
5083
  ${REDEEMED_REWARD_FIELDS_FRAGMENT}
5083
- ${AFFILIATE_FIELDS_FRAGMENT}
5084
5084
  `;
5085
5085
  var STALL_TYPE_FIELDS_FRAGMENT = gql`
5086
5086
  fragment StallTypeFields on StallTypeType {
@@ -7426,6 +7426,62 @@ var REQUEST_MARKETING_MATERIAL_MUTATION = gql`
7426
7426
  }
7427
7427
  }
7428
7428
  `;
7429
+ var AFFILIATE_REWARD_FIELDS_FRAGMENT = gql`
7430
+ fragment AffiliateRewardFields on AffiliateRewardType {
7431
+ createdAt
7432
+ deletedAt
7433
+ redeemedAt
7434
+ rewardDescription
7435
+ rewardType
7436
+ rewardValue
7437
+ updatedAt
7438
+ }
7439
+ `;
7440
+ var AFFILIATE_RESOURCE_FIELDS_FRAGMENT = gql`
7441
+ fragment AffiliateResourceFields on AffiliateResourceType {
7442
+ resourceActive
7443
+ resourceId
7444
+ resourceType
7445
+ rewards {
7446
+ ...AffiliateRewardFields
7447
+ }
7448
+ }
7449
+ ${AFFILIATE_REWARD_FIELDS_FRAGMENT}
7450
+ `;
7451
+ var AFFILIATE_FIELDS_FRAGMENT = gql`
7452
+ fragment AffiliateFields on AffiliateType {
7453
+ _id
7454
+ affiliateCode
7455
+ affiliateResources {
7456
+ ...AffiliateResourceFields
7457
+ }
7458
+ createdAt
7459
+ deletedAt
7460
+ overallPoints
7461
+ owner {
7462
+ ...OwnerFields
7463
+ }
7464
+ updatedAt
7465
+ }
7466
+ ${AFFILIATE_RESOURCE_FIELDS_FRAGMENT}
7467
+ ${OWNER_FIELDS_FRAGMENT}
7468
+ `;
7469
+ var GET_AFFILIATE = gql`
7470
+ query getAffiliate($_id: ID!) {
7471
+ affiliate(_id: $_id) {
7472
+ ...AffiliateFields
7473
+ }
7474
+ }
7475
+ ${AFFILIATE_FIELDS_FRAGMENT}
7476
+ `;
7477
+ var GET_AFFILIATES = gql`
7478
+ query getAffiliates {
7479
+ affiliates {
7480
+ ...AffiliateFields
7481
+ }
7482
+ }
7483
+ ${AFFILIATE_FIELDS_FRAGMENT}
7484
+ `;
7429
7485
  var PKG = "@timardex/cluemart-shared";
7430
7486
  var IMAGE_EXTENSION = ".webp";
7431
7487
  var posterIds = [
@@ -8575,19 +8631,13 @@ var redeemedRewardSchema = new MongooseSchema11(
8575
8631
  },
8576
8632
  { _id: false }
8577
8633
  );
8578
- var affiliateSchema = new MongooseSchema11(
8579
- {
8580
- affiliateCode: { required: true, type: String },
8581
- pointsAvailable: { required: true, type: Number }
8582
- },
8583
- { _id: false }
8584
- );
8585
8634
  var schema7 = new MongooseSchema11(
8586
8635
  {
8587
8636
  active: { default: false, required: true, type: Boolean },
8588
8637
  affiliate: {
8638
+ ref: "Affiliate",
8589
8639
  required: false,
8590
- type: affiliateSchema
8640
+ type: import_mongoose12.default.Schema.Types.ObjectId
8591
8641
  },
8592
8642
  associates: {
8593
8643
  required: false,
@@ -8687,13 +8737,6 @@ var schema7 = new MongooseSchema11(
8687
8737
  },
8688
8738
  { strict: false, timestamps: true }
8689
8739
  );
8690
- schema7.index(
8691
- { "affiliate.affiliateCode": 1 },
8692
- {
8693
- partialFilterExpression: { active: true, deletedAt: null },
8694
- unique: true
8695
- }
8696
- );
8697
8740
  schema7.index({ "associates.email": 1 });
8698
8741
  schema7.index({ "licences.expiryDate": 1 });
8699
8742
  schema7.index({ "licences.licenceType": 1 });
@@ -9184,9 +9227,9 @@ var gameDataSchemas = {
9184
9227
  [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
9185
9228
  };
9186
9229
  var gameDataDefinition = Object.fromEntries(
9187
- Object.entries(gameDataSchemas).map(([key, schema17]) => [
9230
+ Object.entries(gameDataSchemas).map(([key, schema18]) => [
9188
9231
  key,
9189
- { default: null, required: false, type: schema17 }
9232
+ { default: null, required: false, type: schema18 }
9190
9233
  ])
9191
9234
  );
9192
9235
  var gameHistorySchema = new MongooseSchema23(
@@ -9285,6 +9328,71 @@ schema16.index(
9285
9328
  );
9286
9329
  var SchoolModel = import_mongoose25.default.models.School || import_mongoose25.default.model("School", schema16);
9287
9330
 
9331
+ // src/mongoose/Affiliate.ts
9332
+ var import_mongoose26 = __toESM(require("mongoose"));
9333
+ var MongooseSchema25 = import_mongoose26.default.Schema;
9334
+ var affiliateRewardSchema = new MongooseSchema25(
9335
+ {
9336
+ createdAt: { required: true, type: Date },
9337
+ deletedAt: { default: null, required: false, type: Date },
9338
+ redeemedAt: { default: null, required: false, type: Date },
9339
+ rewardDescription: { required: true, type: String },
9340
+ rewardType: {
9341
+ enum: Object.values(EnumAffiliateRewardType),
9342
+ required: true,
9343
+ type: String
9344
+ },
9345
+ rewardValue: { required: true, type: Number },
9346
+ updatedAt: { default: null, required: false, type: Date }
9347
+ },
9348
+ { _id: false }
9349
+ );
9350
+ var affiliateResourceSchema = new MongooseSchema25(
9351
+ {
9352
+ resourceActive: { default: true, required: true, type: Boolean },
9353
+ resourceId: {
9354
+ required: true,
9355
+ type: import_mongoose26.default.Schema.Types.ObjectId
9356
+ },
9357
+ resourceType: {
9358
+ enum: Object.values(EnumResourceType),
9359
+ required: true,
9360
+ type: String
9361
+ },
9362
+ rewards: {
9363
+ default: [],
9364
+ required: false,
9365
+ type: [affiliateRewardSchema]
9366
+ }
9367
+ },
9368
+ { _id: false }
9369
+ );
9370
+ var schema17 = new MongooseSchema25(
9371
+ {
9372
+ affiliateCode: { required: true, type: String },
9373
+ affiliateResources: {
9374
+ default: [],
9375
+ required: false,
9376
+ type: [affiliateResourceSchema]
9377
+ },
9378
+ deletedAt: { default: null, required: false, type: Date },
9379
+ overallPoints: { default: 0, required: true, type: Number },
9380
+ owner: {
9381
+ required: true,
9382
+ type: OwnerTypeSchema
9383
+ }
9384
+ },
9385
+ { timestamps: true }
9386
+ );
9387
+ schema17.index(
9388
+ { affiliateCode: 1 },
9389
+ {
9390
+ partialFilterExpression: { deletedAt: null },
9391
+ unique: true
9392
+ }
9393
+ );
9394
+ var AffiliateModel = import_mongoose26.default.models.Affiliate || import_mongoose26.default.model("Affiliate", schema17);
9395
+
9288
9396
  // src/service/updateAdStatus.ts
9289
9397
  async function updateAdStatuses() {
9290
9398
  const now = /* @__PURE__ */ new Date();
@@ -9321,9 +9429,9 @@ async function updateAdStatuses() {
9321
9429
  }
9322
9430
 
9323
9431
  // src/service/associate.ts
9324
- var import_mongoose27 = __toESM(require("mongoose"));
9432
+ var import_mongoose28 = __toESM(require("mongoose"));
9325
9433
  function normalizeObjectId(id) {
9326
- return typeof id === "string" ? new import_mongoose27.default.Types.ObjectId(id) : id;
9434
+ return typeof id === "string" ? new import_mongoose28.default.Types.ObjectId(id) : id;
9327
9435
  }
9328
9436
  async function getAssociateEmailsForResource({
9329
9437
  normalizedResourceId,
@@ -9475,12 +9583,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
9475
9583
  }
9476
9584
 
9477
9585
  // src/service/objectIdToString.ts
9478
- var import_mongoose30 = __toESM(require("mongoose"));
9586
+ var import_mongoose31 = __toESM(require("mongoose"));
9479
9587
  function convertObjectIdsToStrings(obj) {
9480
9588
  if (obj === null || obj === void 0) {
9481
9589
  return obj;
9482
9590
  }
9483
- if (obj instanceof import_mongoose30.default.Types.ObjectId) {
9591
+ if (obj instanceof import_mongoose31.default.Types.ObjectId) {
9484
9592
  return obj.toString();
9485
9593
  }
9486
9594
  if (obj instanceof Date) {