@timardex/cluemart-shared 1.2.28 → 1.2.30

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.
Files changed (42) hide show
  1. package/dist/{ad-ZnPU3uan.d.ts → ad-C02AZIGy.d.ts} +1 -1
  2. package/dist/{ad-C-0i99zR.d.mts → ad-CTWMmc7b.d.mts} +1 -1
  3. package/dist/{auth-Ddkaba1k.d.mts → auth-YsJJnj12.d.mts} +1 -1
  4. package/dist/{auth-BRY-YJss.d.ts → auth-o_ns6gLk.d.ts} +1 -1
  5. package/dist/chunk-BO3HICLR.mjs +24 -0
  6. package/dist/chunk-BO3HICLR.mjs.map +1 -0
  7. package/dist/chunk-O6LVIQFK.mjs +66 -0
  8. package/dist/chunk-O6LVIQFK.mjs.map +1 -0
  9. package/dist/formFields/index.d.mts +1 -1
  10. package/dist/formFields/index.d.ts +1 -1
  11. package/dist/{global-IDogsFQv.d.ts → global-4lS-fh61.d.ts} +37 -4
  12. package/dist/{global-DlaX2SCk.d.mts → global-_ZHkOcnR.d.mts} +37 -4
  13. package/dist/graphql/index.d.mts +2 -2
  14. package/dist/graphql/index.d.ts +2 -2
  15. package/dist/hooks/index.d.mts +3 -3
  16. package/dist/hooks/index.d.ts +3 -3
  17. package/dist/hooks/index.mjs +5 -5
  18. package/dist/index.cjs +1157 -26
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.mts +468 -1
  21. package/dist/index.d.ts +468 -1
  22. package/dist/index.mjs +1130 -26
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/mongoose/index.cjs +1097 -0
  25. package/dist/mongoose/index.cjs.map +1 -0
  26. package/dist/mongoose/index.d.mts +422 -0
  27. package/dist/mongoose/index.d.ts +422 -0
  28. package/dist/mongoose/index.mjs +874 -0
  29. package/dist/mongoose/index.mjs.map +1 -0
  30. package/dist/service/index.cjs +334 -0
  31. package/dist/service/index.cjs.map +1 -0
  32. package/dist/service/index.d.mts +27 -0
  33. package/dist/service/index.d.ts +27 -0
  34. package/dist/service/index.mjs +214 -0
  35. package/dist/service/index.mjs.map +1 -0
  36. package/dist/types/index.d.mts +3 -3
  37. package/dist/types/index.d.ts +3 -3
  38. package/dist/types/index.mjs +4 -19
  39. package/dist/types/index.mjs.map +1 -1
  40. package/dist/utils/index.d.mts +1 -1
  41. package/dist/utils/index.d.ts +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mongoose/Ad.ts","../../src/mongoose/global.ts","../../src/mongoose/Relation.ts","../../src/mongoose/event/EventInfo.ts","../../src/mongoose/Chat.ts","../../src/mongoose/ResourceActivity.ts","../../src/mongoose/Testers.ts","../../src/mongoose/User.ts","../../src/mongoose/VerificationToken.ts","../../src/mongoose/vendor/Vendor.ts","../../src/mongoose/vendor/VendorInfo.ts","../../src/mongoose/event/Event.ts"],"sourcesContent":["import mongoose from \"mongoose\";\n\nimport { EnumResourceType } from \"src/enums\";\nimport {\n AdType,\n EnumAdShowOn,\n EnumAdStatus,\n EnumAdStyle,\n EnumAdType,\n} from \"src/types\";\n\nimport { SocialMediaTypeSchema } from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst schema = new MongooseSchema<AdType>(\n {\n active: { default: true, type: Boolean },\n adStyle: {\n default: EnumAdStyle.BLOOM,\n enum: Object.values(EnumAdStyle),\n required: true,\n type: String,\n },\n adType: {\n default: EnumAdType.SPONSORED,\n enum: Object.values(EnumAdType),\n required: true,\n type: String,\n },\n // TODO: similar to ViewSchema\n clicks: { default: 0, required: true, type: Number },\n clui: { required: false, type: String },\n end: { required: true, type: Date },\n // TODO: similar to ViewSchema\n impressions: { default: 0, required: true, type: Number },\n resourceCover: { required: true, type: String },\n resourceDescription: { required: true, type: String },\n resourceId: { required: true, type: String },\n resourceLogo: { required: false, type: String },\n resourceName: { required: true, type: String },\n resourceRegion: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n showOn: {\n default: EnumAdShowOn.FRONT_PAGE,\n enum: Object.values(EnumAdShowOn),\n required: true,\n type: String,\n },\n socialMedia: [SocialMediaTypeSchema],\n start: { required: true, type: Date },\n status: {\n default: EnumAdStatus.ACTIVE,\n enum: Object.values(EnumAdStatus),\n required: true,\n type: String,\n },\n targetRegion: { required: false, type: String },\n },\n {\n timestamps: true,\n },\n);\n\n// Compound index for background job queries\nschema.index({\n end: 1,\n start: 1,\n status: 1,\n});\n\nexport const AdModel = mongoose.model<AdType>(\"Ad\", schema);\n","import mongoose from \"mongoose\";\n\nimport { EnumResourceType, EnumUserLicence } from \"src/enums\";\nimport {\n Category,\n ObjectId,\n OwnerType,\n PartnerType,\n PosterUsageType,\n RelationDate,\n ResourceContactDetailsType,\n ResourceImageType,\n SocialMediaType,\n Subcategory,\n TermsAgreement,\n} from \"src/types\";\n\nimport { relationDatesSchema } from \"./Relation\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaOwnerType = Omit<OwnerType, \"userId\"> & {\n userId: ObjectId;\n};\n\nconst OwnerTypeSchema = new MongooseSchema<SchemaOwnerType>(\n {\n email: { required: true, type: String },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport const SocialMediaTypeSchema = new MongooseSchema<SocialMediaType>(\n {\n link: { required: true, type: String },\n name: { required: true, type: String },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field\n);\n\nexport const ResourceImageTypeSchema = new MongooseSchema<ResourceImageType>(\n {\n 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 partnersSchema = new MongooseSchema<PartnerType>(\n {\n email: { required: false, type: String },\n licence: {\n enum: Object.values(EnumUserLicence),\n required: false,\n type: String,\n },\n resourceId: {\n required: false,\n type: String,\n },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: false,\n type: String,\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst ContactDetailsSchema = 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: String },\n },\n { _id: false },\n);\n\nconst resourceRelationsSchema = new MongooseSchema<{\n relationId: ObjectId;\n relationDates: RelationDate[];\n}>(\n {\n relationDates: {\n default: [],\n required: false,\n type: [relationDatesSchema],\n },\n relationId: {\n ref: \"Relation\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { _id: false },\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 contactDetails: ContactDetailsSchema,\n cover: ResourceImageTypeSchema,\n deletedAt: { default: null, required: false, type: Date },\n description: { required: true, type: String },\n images: [ResourceImageTypeSchema],\n logo: ResourceImageTypeSchema,\n name: { required: true, type: String },\n owner: OwnerTypeSchema,\n partners: {\n required: false,\n type: [partnersSchema],\n },\n posterUsage: PosterUsageTypeSchema,\n promoCodes: { required: false, type: [String] },\n region: { required: true, type: String },\n relations: {\n default: [],\n required: false,\n type: [resourceRelationsSchema],\n },\n socialMedia: [SocialMediaTypeSchema],\n termsAgreement: termsAgreementSchema,\n};\n","import mongoose from \"mongoose\";\n\nimport {\n EnumInviteStatus,\n EnumRelationResource,\n EnumResourceType,\n} from \"src/enums\";\nimport { ObjectId, RelationDate, RelationType } from \"src/types\";\n\nimport { StallTypeSchema } from \"./event/EventInfo\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const relationDatesSchema = new MongooseSchema<RelationDate>(\n {\n lastUpdateBy: {\n resourceId: { required: false, type: String },\n userEmail: { required: false, type: String },\n },\n paymentReference: { required: false, type: String },\n stallType: StallTypeSchema,\n startDate: { required: false, type: String },\n startTime: { 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 \"chatId\" | \"eventId\" | \"vendorId\"\n> & {\n chatId: ObjectId;\n eventId: ObjectId;\n vendorId: 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 \"relationDates.startDate\": 1,\n \"relationDates.startTime\": 1,\n \"relationDates.status\": 1,\n});\n\n// --- IMPORTANT: bind custom model type ---\nexport const RelationModel = mongoose.model<SchemaRelationType>(\n \"Relation\",\n RelationTypeSchema,\n);\n","import mongoose from \"mongoose\";\n\nimport { EnumPaymentMethod } from \"src/enums\";\nimport {\n DateTimeWithPriceType,\n EventInfoType,\n ObjectId,\n PaymentInfoType,\n Requirement,\n StallType,\n} from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport const StallTypeSchema = new MongooseSchema<StallType>(\n {\n electricity: {\n price: { required: false, type: Number },\n selected: { required: false, type: Boolean },\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 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 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 applicationDeadlineHours: { required: true, type: Number },\n dateTime: [dateTimeSchema],\n eventId: {\n ref: \"Event\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n packInTime: { required: true, type: Number },\n paymentDueHours: { required: true, type: Number },\n paymentInfo: [paymentInfoSchema],\n requirements: [requirementsSchema],\n },\n { timestamps: true },\n);\n\nexport const EventInfoModel = mongoose.model<SchemaEventInfoType>(\n \"EventInfo\",\n schema,\n);\n","import mongoose from \"mongoose\";\n\nimport { EnumChatType } from \"src/enums\";\nimport {\n ChatMessageType,\n ChatType,\n ObjectId,\n ParticipantType,\n} from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaChatMessageType = Omit<ChatMessageType, \"senderId\"> & {\n senderId: ObjectId;\n};\n\nexport type SchemaParticipantType = Omit<ParticipantType, \"userId\"> & {\n userId: ObjectId;\n};\n\nconst MessageSchema = new MongooseSchema<SchemaChatMessageType>(\n {\n content: { required: true, type: String },\n senderAvatar: { required: false, 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 { timestamps: true },\n);\n\nexport type SchemaChatType = Omit<\n ChatType,\n \"participants\" | \"messages\" | \"resourceInfo\"\n> & {\n participants: SchemaParticipantType[];\n messages: SchemaChatMessageType[];\n resourceInfo: { eventId: ObjectId; vendorId: ObjectId } | null;\n};\n\nexport const ParticipantSchema = new MongooseSchema<SchemaParticipantType>(\n {\n active: { default: true, required: true, type: Boolean },\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\nconst ChatSchema = new MongooseSchema<SchemaChatType>(\n {\n active: { default: true, required: true, type: Boolean },\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 resourceInfo: {\n eventId: {\n ref: \"Event\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n vendorId: {\n ref: \"Vendor\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n },\n {\n timestamps: true,\n },\n);\n\nexport const ChatModel = mongoose.model<SchemaChatType>(\"Chat\", ChatSchema);\n","import mongoose from \"mongoose\";\n\nimport { EnumOSPlatform, EnumResourceType } from \"src/enums\";\nimport {\n EnumActivity,\n ResourceActivityEntry,\n ResourceActivityType,\n} from \"src/types\";\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 location: {\n coordinates: {\n required: false,\n type: [Number],\n },\n type: {\n default: \"Point\",\n enum: [\"Point\"],\n required: false,\n type: String,\n },\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 = mongoose.model(\"ResourceActivity\", schema);\n","import mongoose from \"mongoose\";\n\nimport { EnumOSPlatform, EnumResourceType } from \"src/enums\";\nimport { TesterType } from \"src/types\";\n\nimport { CategorySchema } from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst TesterSchema = new MongooseSchema<TesterType>(\n {\n active: { default: false, required: true, type: Boolean },\n categories: [CategorySchema],\n companyName: { required: true, type: String },\n email: { required: true, type: String },\n firstName: { required: true, type: String },\n lastName: { required: true, type: String },\n osType: {\n enum: Object.values(EnumOSPlatform),\n required: true,\n type: String,\n },\n region: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumResourceType),\n required: true,\n type: String,\n },\n },\n {\n timestamps: true,\n },\n);\n\nexport const TesterModel = mongoose.model<TesterType>(\"Tester\", TesterSchema);\n","import mongoose from \"mongoose\";\n\nimport { EnumOSPlatform, EnumUserLicence, EnumUserRole } from \"src/enums\";\nimport { ObjectId, UserActivityEvent, UserType } from \"src/types\";\n\nimport {\n partnersSchema,\n ResourceImageTypeSchema,\n termsAgreementSchema,\n} from \"./global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaUserActivityEvent = Omit<UserActivityEvent, \"resourceId\"> & {\n resourceId: ObjectId;\n};\n\nexport type SchemaUserType = Omit<\n UserType,\n \"vendor\" | \"events\" | \"userActivity\" | \"_id\"\n> & {\n _id: ObjectId;\n vendor: ObjectId;\n events: ObjectId[];\n userActivity: {\n favourites: {\n events: ObjectId[];\n vendors: ObjectId[];\n };\n interested: {\n events: SchemaUserActivityEvent[];\n };\n going: {\n events: SchemaUserActivityEvent[];\n };\n present: {\n events: SchemaUserActivityEvent[];\n };\n };\n};\n\nconst userActivityEventSchema = new MongooseSchema<SchemaUserActivityEvent>(\n {\n resourceId: {\n ref: \"Event\",\n required: false,\n type: mongoose.Schema.Types.ObjectId,\n },\n startDate: { required: false, type: String },\n startTime: { required: false, type: String },\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 vendors: {\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 avatar: ResourceImageTypeSchema,\n deletedAt: { default: null, required: false, type: Date },\n email: { required: true, type: String },\n events: {\n ref: \"Event\",\n required: false,\n type: [mongoose.Schema.Types.ObjectId],\n },\n firstName: { required: true, type: String },\n isTester: { default: false, required: false, type: Boolean },\n lastName: { required: true, type: String },\n licences: {\n enum: Object.values(EnumUserLicence),\n required: false,\n type: [String],\n },\n partners: {\n required: false,\n type: [partnersSchema],\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 refreshToken: {\n required: false,\n type: String,\n },\n role: {\n default: EnumUserRole.CUSTOMER,\n enum: Object.values(EnumUserRole),\n required: true,\n type: String,\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 { timestamps: true },\n);\n\nschema.index({ \"partners.email\": 1 });\n\nexport const UserModel = 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 = mongoose.model<VerificationTokenType>(\n \"VerificationToken\",\n schema,\n);\n","import mongoose from \"mongoose\";\n\nimport { EnumVendorType } from \"src/enums\";\nimport { ObjectId, VendorMenuType, VendorType } from \"src/types\";\n\nimport { baseResourceFields, CategorySchema, SchemaOwnerType } from \"../global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst MenuTypeSchema = new MongooseSchema<VendorMenuType>(\n {\n description: { required: false, type: String },\n name: { required: false, type: String },\n price: { required: false, type: Number },\n productGroups: { required: false, type: [String] },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst LocationsSchema = new MongooseSchema<VendorType[\"locations\"]>(\n {\n dateTime: {\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 city: { required: false, type: String },\n coordinates: {\n required: false,\n type: [Number], // [longitude, latitude]\n },\n country: { required: false, type: String },\n fullAddress: { required: false, type: String },\n latitude: { required: false, type: Number },\n longitude: { required: false, type: Number },\n region: { required: false, type: String },\n type: { required: false, type: String }, // Mongoose GeoJSON type\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nexport type SchemaVendorType = Omit<\n VendorType,\n \"vendorInfoId\" | \"owner\" | \"adIds\"\n> & {\n adIds?: ObjectId[];\n owner: SchemaOwnerType;\n vendorInfoId: ObjectId;\n};\n\nconst schema = new MongooseSchema<SchemaVendorType>(\n {\n ...baseResourceFields, // Importing base resource fields from global.ts\n availability: {\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 categories: [CategorySchema],\n locations: [LocationsSchema],\n multiLocation: { required: true, type: Boolean },\n products: [MenuTypeSchema],\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({ \"partners.email\": 1 });\n\nexport const VendorModel = mongoose.model<SchemaVendorType>(\"Vendor\", schema);\n","import mongoose from \"mongoose\";\n\nimport { EnumFoodFlavor } from \"src/enums\";\nimport { ObjectId, VendorAttributes, VendorInfoType } 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 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: Number },\n min: { required: true, type: Number },\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: Number },\n width: { required: true, type: Number },\n },\n },\n vendorId: {\n ref: \"Vendor\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\nexport const VendorInfoModel = mongoose.model<SchemaVendorInfoType>(\n \"VendorInfo\",\n schema,\n);\n","import mongoose from \"mongoose\";\n\nimport { EnumEventType } from \"src/enums\";\nimport { DateTimeType, EventType, LocationType, ObjectId } from \"src/types\";\n\nimport { baseResourceFields, SchemaOwnerType } from \"../global\";\n\nconst MongooseSchema = mongoose.Schema;\n\nconst locationsSchema = new MongooseSchema<LocationType>(\n {\n city: { required: true, type: String },\n coordinates: {\n required: true,\n type: [Number], // [longitude, latitude]\n },\n country: { required: true, type: String },\n fullAddress: { required: true, type: String },\n latitude: { required: true, type: Number },\n longitude: { required: true, type: Number },\n region: { required: true, type: String },\n type: {\n default: \"Point\",\n enum: [\"Point\"],\n required: true,\n type: String,\n },\n },\n { _id: false }, // Prevents Mongoose from creating an additional _id field for subdocuments\n);\n\nconst dateTimeSchema = new MongooseSchema<DateTimeType>(\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 type SchemaEventType = Omit<\n EventType,\n \"eventInfoId\" | \"owner\" | \"adIds\"\n> & {\n adIds?: ObjectId[];\n eventInfoId: ObjectId;\n owner: SchemaOwnerType;\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 dateTime: [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 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 tags: { required: true, type: [String] },\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: \"2dsphere\" });\nschema.index({ tags: 1 });\nschema.index({ \"partners.email\": 1 });\n\nexport const EventModel = mongo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A,QAAO,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC1BA,QAAO,MAAM,EAAE,UAAU,WAAW,CAAC;AACrCA,QAAO,MAAM,EAAE,MAAM,EAAE,CAAC;AACxBA,QAAO,MAAM,EAAE,kBAAkB,EAAE,CAAC;AAE7B,IAAM,aAAaF,WAAS,MAAuB,SAASE,OAAM;","names":["mongoose","mongoose","mongoose","MongooseSchema","mongoose","MongooseSchema","mongoose","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","mongoose","mongoose","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","mongoose","mongoose","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","schema","mongoose","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","mongoose","schema","mongoose","MongooseSchema","mongoose","dateTimeSchema","schema"]}
@@ -0,0 +1,334 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/service/index.ts
31
+ var service_exports = {};
32
+ __export(service_exports, {
33
+ connectToDatabase: () => connectToDatabase,
34
+ createNotifications: () => createNotifications,
35
+ publishNotificationEvents: () => publishNotificationEvents,
36
+ sendPushNotification: () => sendPushNotification
37
+ });
38
+ module.exports = __toCommonJS(service_exports);
39
+
40
+ // src/service/database.ts
41
+ var import_mongoose = __toESM(require("mongoose"));
42
+
43
+ // src/service/timezonePlugin.ts
44
+ var import_dayjs = __toESM(require("dayjs"));
45
+ var import_timezone = __toESM(require("dayjs/plugin/timezone"));
46
+ var import_utc = __toESM(require("dayjs/plugin/utc"));
47
+ import_dayjs.default.extend(import_utc.default);
48
+ import_dayjs.default.extend(import_timezone.default);
49
+ function timezonePlugin(schema3) {
50
+ if (!schema3.get("timestamps")) return;
51
+ const transform = (_doc, ret) => {
52
+ if (ret.createdAt)
53
+ ret.createdAt = (0, import_dayjs.default)(ret.createdAt).tz("Pacific/Auckland").format();
54
+ if (ret.updatedAt)
55
+ ret.updatedAt = (0, import_dayjs.default)(ret.updatedAt).tz("Pacific/Auckland").format();
56
+ return ret;
57
+ };
58
+ schema3.set("toJSON", { transform });
59
+ schema3.set("toObject", { transform });
60
+ }
61
+
62
+ // src/service/database.ts
63
+ import_mongoose.default.plugin(timezonePlugin);
64
+ var connectToDatabase = async () => {
65
+ try {
66
+ const mongoUri = process.env.MONGODB_URI ? process.env.MONGODB_URI : (
67
+ // Fallback to MongoDB Atlas connection string
68
+ `mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_NAME}.mongodb.net/?retryWrites=true&w=majority&appName=${process.env.APP_NAME}`
69
+ );
70
+ await import_mongoose.default.connect(mongoUri);
71
+ const connectionType = process.env.MONGODB_URI ? "Local MongoDB" : "MongoDB Atlas";
72
+ console.log(
73
+ `${connectionType} connected from server/src/service/database.ts`
74
+ );
75
+ } catch (err) {
76
+ console.error("Error connecting to MongoDB:", err);
77
+ throw err;
78
+ }
79
+ };
80
+
81
+ // src/mongoose/Notification.ts
82
+ var import_mongoose2 = __toESM(require("mongoose"));
83
+
84
+ // src/enums/index.ts
85
+ var EnumOSPlatform = /* @__PURE__ */ ((EnumOSPlatform2) => {
86
+ EnumOSPlatform2["ANDROID"] = "android";
87
+ EnumOSPlatform2["IOS"] = "ios";
88
+ EnumOSPlatform2["WEB"] = "web";
89
+ return EnumOSPlatform2;
90
+ })(EnumOSPlatform || {});
91
+ var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceType2) => {
92
+ EnumNotificationResourceType2["ADDED_AS_PARTNER_EVENT"] = "added_as_partner_event";
93
+ EnumNotificationResourceType2["ADDED_AS_PARTNER_VENDOR"] = "added_as_partner_vendor";
94
+ EnumNotificationResourceType2["APPROVED_EVENT"] = "approved_event";
95
+ EnumNotificationResourceType2["APPROVED_VENDOR"] = "approved_vendor";
96
+ EnumNotificationResourceType2["CREATED_EVENT"] = "created_event";
97
+ EnumNotificationResourceType2["CREATED_VENDOR"] = "created_vendor";
98
+ EnumNotificationResourceType2["EVENT_INVITE_VENDOR"] = "event_invite_vendor" /* EVENT_INVITE_VENDOR */;
99
+ EnumNotificationResourceType2["EVENT_STARTING_SOON"] = "event_starting_soon";
100
+ EnumNotificationResourceType2["NEW_CHAT_MESSAGE"] = "new_chat_message";
101
+ EnumNotificationResourceType2["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event" /* VENDOR_APPLICATION_TO_EVENT */;
102
+ return EnumNotificationResourceType2;
103
+ })(EnumNotificationResourceType || {});
104
+ var EnumNotificationType = /* @__PURE__ */ ((EnumNotificationType2) => {
105
+ EnumNotificationType2["EVENT"] = "event" /* EVENT */;
106
+ EnumNotificationType2["VENDOR"] = "vendor" /* VENDOR */;
107
+ EnumNotificationType2["RELATION"] = "relation";
108
+ EnumNotificationType2["CHAT"] = "chat";
109
+ EnumNotificationType2["SYSTEM"] = "system";
110
+ return EnumNotificationType2;
111
+ })(EnumNotificationType || {});
112
+
113
+ // src/mongoose/Notification.ts
114
+ var MongooseSchema = import_mongoose2.default.Schema;
115
+ var schema = new MongooseSchema(
116
+ {
117
+ data: {
118
+ resourceId: { required: true, type: String },
119
+ resourceName: { required: true, type: String },
120
+ resourceType: {
121
+ enum: Object.values(EnumNotificationResourceType),
122
+ required: true,
123
+ type: String
124
+ }
125
+ },
126
+ isRead: { default: false, index: true, required: true, type: Boolean },
127
+ message: { required: true, type: String },
128
+ title: { required: true, type: String },
129
+ type: {
130
+ default: "system" /* SYSTEM */,
131
+ enum: Object.values(EnumNotificationType),
132
+ required: true,
133
+ type: String
134
+ },
135
+ userId: {
136
+ ref: "User",
137
+ required: true,
138
+ type: import_mongoose2.default.Schema.Types.ObjectId
139
+ }
140
+ },
141
+ { timestamps: true }
142
+ );
143
+ schema.index({ isRead: 1, userId: 1 });
144
+ schema.index({ createdAt: -1, userId: 1 });
145
+ var NotificationModel = import_mongoose2.default.model(
146
+ "Notification",
147
+ schema
148
+ );
149
+
150
+ // src/service/notificationService.ts
151
+ async function publishNotificationEvents(userId, context) {
152
+ try {
153
+ const userNotifications = await NotificationModel.find({
154
+ userId
155
+ }).sort({ createdAt: -1 });
156
+ const [total, unread] = await Promise.all([
157
+ NotificationModel.countDocuments({ userId }),
158
+ NotificationModel.countDocuments({ isRead: false, userId })
159
+ ]);
160
+ context.pubsub.publish("GET_NOTIFICATIONS" /* GET_NOTIFICATIONS */, {
161
+ getNotifications: userNotifications,
162
+ getNotificationsUserId: userId
163
+ });
164
+ context.pubsub.publish("GET_NOTIFICATIONS_COUNT" /* GET_NOTIFICATIONS_COUNT */, {
165
+ getNotificationsCount: { total, unread, userId }
166
+ });
167
+ console.log(`Published notification events for user: ${String(userId)}`);
168
+ } catch (error) {
169
+ console.error(
170
+ `Failed to publish notification events for user ${String(userId)}:`,
171
+ error
172
+ );
173
+ }
174
+ }
175
+ async function createNotifications(payload, context) {
176
+ const { data, message, title, type, userIds } = payload;
177
+ try {
178
+ const notifications = userIds.map((userId) => ({
179
+ data,
180
+ isRead: false,
181
+ message,
182
+ title,
183
+ type,
184
+ userId
185
+ }));
186
+ const savedNotifications = await NotificationModel.insertMany(notifications);
187
+ console.log(
188
+ `Created ${savedNotifications.length} notifications for ${userIds.length} users`
189
+ );
190
+ const uniqueUserIds = [...new Set(userIds)];
191
+ for (const userId of uniqueUserIds) {
192
+ await publishNotificationEvents(userId, context);
193
+ }
194
+ return savedNotifications;
195
+ } catch (error) {
196
+ console.error("Failed to create notifications:", error);
197
+ return [];
198
+ }
199
+ }
200
+
201
+ // src/service/sendPushNotification.ts
202
+ var import_expo_server_sdk = require("expo-server-sdk");
203
+
204
+ // src/mongoose/PushToken.ts
205
+ var import_mongoose3 = __toESM(require("mongoose"));
206
+ var MongooseSchema2 = import_mongoose3.default.Schema;
207
+ var schema2 = new MongooseSchema2(
208
+ {
209
+ platform: {
210
+ enum: Object.values(EnumOSPlatform),
211
+ required: true,
212
+ type: String
213
+ },
214
+ token: { required: true, type: String },
215
+ userId: { required: true, type: import_mongoose3.default.Schema.Types.ObjectId }
216
+ },
217
+ { timestamps: true }
218
+ );
219
+ var PushTokenModel = import_mongoose3.default.model("PushToken", schema2);
220
+
221
+ // src/service/sendPushNotification.ts
222
+ var expo = new import_expo_server_sdk.Expo();
223
+ function extractTokensFromMessage(message) {
224
+ return Array.isArray(message.to) ? message.to : [message.to];
225
+ }
226
+ function createPushMessages({
227
+ tokens,
228
+ message,
229
+ title,
230
+ data
231
+ }) {
232
+ const messages = [];
233
+ const invalidTokens = [];
234
+ for (const token of tokens) {
235
+ if (!import_expo_server_sdk.Expo.isExpoPushToken(token)) {
236
+ invalidTokens.push(token);
237
+ continue;
238
+ }
239
+ messages.push({
240
+ body: message,
241
+ data: { ...data },
242
+ sound: "default",
243
+ title,
244
+ to: token
245
+ });
246
+ }
247
+ return { invalidTokens, messages };
248
+ }
249
+ function processChunkResults(tickets, chunk) {
250
+ let successCount = 0;
251
+ const failedTokens = [];
252
+ for (const [ticketIndex, ticket] of tickets.entries()) {
253
+ if (ticket.status === "error") {
254
+ const message = chunk[ticketIndex];
255
+ if (message) {
256
+ const tokens = extractTokensFromMessage(message);
257
+ if (ticket.details?.error === "DeviceNotRegistered") {
258
+ failedTokens.push(...tokens);
259
+ }
260
+ console.log("Push notification error", {
261
+ error: ticket.details?.error,
262
+ tokens
263
+ });
264
+ }
265
+ } else {
266
+ successCount++;
267
+ }
268
+ }
269
+ return { failedTokens, successCount };
270
+ }
271
+ async function sendChunk(chunk, chunkIndex) {
272
+ try {
273
+ const tickets = await expo.sendPushNotificationsAsync(chunk);
274
+ const { successCount, failedTokens } = processChunkResults(tickets, chunk);
275
+ console.log(
276
+ `Chunk ${chunkIndex + 1}: Sent ${successCount}/${chunk.length} notifications successfully`
277
+ );
278
+ return { failedTokens, successCount };
279
+ } catch (error) {
280
+ console.log("Error sending Expo push notification chunk", {
281
+ chunkIndex,
282
+ chunkSize: chunk.length,
283
+ error: error instanceof Error ? error.message : String(error)
284
+ });
285
+ return { failedTokens: [], successCount: 0 };
286
+ }
287
+ }
288
+ async function sendPushNotification({
289
+ data,
290
+ message,
291
+ title,
292
+ userIds
293
+ }) {
294
+ const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
295
+ const expoTokens = pushTokens.map((token) => token.token);
296
+ const { messages, invalidTokens } = createPushMessages({
297
+ data,
298
+ message,
299
+ title,
300
+ tokens: expoTokens
301
+ });
302
+ if (invalidTokens.length > 0) {
303
+ console.log(`Found ${invalidTokens.length} invalid push tokens`);
304
+ }
305
+ if (messages.length === 0) {
306
+ console.log("No valid messages to send after filtering tokens");
307
+ return;
308
+ }
309
+ const chunks = expo.chunkPushNotifications(messages);
310
+ let totalSuccessCount = 0;
311
+ const allFailedTokens = [];
312
+ for (const [chunkIndex, chunk] of chunks.entries()) {
313
+ const { successCount, failedTokens } = await sendChunk(
314
+ chunk,
315
+ chunkIndex + 1
316
+ );
317
+ totalSuccessCount += successCount;
318
+ allFailedTokens.push(...failedTokens);
319
+ }
320
+ console.log(
321
+ `Sent push notification to ${totalSuccessCount}/${messages.length} tokens across ${chunks.length} chunks`
322
+ );
323
+ if (allFailedTokens.length > 0) {
324
+ console.log(`Found ${allFailedTokens.length} failed push tokens`);
325
+ }
326
+ }
327
+ // Annotate the CommonJS export names for ESM import in node:
328
+ 0 && (module.exports = {
329
+ connectToDatabase,
330
+ createNotifications,
331
+ publishNotificationEvents,
332
+ sendPushNotification
333
+ });
334
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/service/index.ts","../../src/service/database.ts","../../src/service/timezonePlugin.ts","../../src/mongoose/Notification.ts","../../src/enums/index.ts","../../src/service/notificationService.ts","../../src/service/sendPushNotification.ts","../../src/mongoose/PushToken.ts"],"sourcesContent":["export * from \"./database\";\nexport * from \"./notificationService\";\nexport * from \"./sendPushNotification\";\n","import mongoose from \"mongoose\";\n\nimport { timezonePlugin } from \"./timezonePlugin\";\n\nmongoose.plugin(timezonePlugin); // applies to all schemas\n\n/**\n * Connect to MongoDB using Mongoose.\n * Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).\n */\nexport const connectToDatabase = async () => {\n try {\n // Check if MONGODB_URI is provided (for local Docker MongoDB)\n const mongoUri = process.env.MONGODB_URI\n ? process.env.MONGODB_URI\n : // Fallback to MongoDB Atlas connection string\n `mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_NAME}.mongodb.net/?retryWrites=true&w=majority&appName=${process.env.APP_NAME}`;\n\n await mongoose.connect(mongoUri);\n\n const connectionType = process.env.MONGODB_URI\n ? \"Local MongoDB\"\n : \"MongoDB Atlas\";\n console.log(\n `${connectionType} connected from server/src/service/database.ts`,\n );\n } catch (err) {\n console.error(\"Error connecting to MongoDB:\", err);\n throw err; // You can throw the error if you want to stop the server in case of connection failure\n }\n};\n","// src/mongo/plugins/timezonePlugin.ts\nimport dayjs from \"dayjs\";\nimport timezone from \"dayjs/plugin/timezone\";\nimport utc from \"dayjs/plugin/utc\";\nimport { Schema } from \"mongoose\";\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\nexport function timezonePlugin(schema: Schema) {\n if (!schema.get(\"timestamps\")) return;\n\n const transform = (_doc: any, ret: any) => {\n if (ret.createdAt)\n ret.createdAt = dayjs(ret.createdAt).tz(\"Pacific/Auckland\").format(); // ISO with +13:00 or +12:00 offset\n if (ret.updatedAt)\n ret.updatedAt = dayjs(ret.updatedAt).tz(\"Pacific/Auckland\").format();\n return ret;\n };\n\n schema.set(\"toJSON\", { transform });\n schema.set(\"toObject\", { transform });\n}\n","import mongoose from \"mongoose\";\n\nimport { EnumNotificationResourceType, EnumNotificationType } from \"src/enums\";\nimport {\n CreateBulkNotificationInput,\n NotificationType,\n ObjectId,\n} from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\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 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 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 = mongoose.model<SchemaNotificationType>(\n \"Notification\",\n schema,\n);\n","export enum EnumInviteStatus {\n ACCEPTED = \"Accepted\",\n COMPLETED = \"Completed\",\n EXPIRED = \"Expired\",\n NO_STATUS = \"No_Status\",\n PAID = \"Paid\",\n PENDING = \"Pending\",\n REJECTED = \"Rejected\",\n UNAVAILABLE = \"Unavailable\",\n WAITING = \"Waiting\",\n}\n\nexport enum EnumChatType {\n GROUP = \"group\",\n PRIVATE = \"private\",\n RELATION = \"relation\",\n}\n\nexport enum EnumPaymentMethod {\n CASH = \"cash\",\n EFTPOS = \"eftpos\",\n BANK_TRANSFER = \"bank_transfer\",\n PAYPAL = \"paypal\",\n STRIPE = \"stripe\",\n}\n\nexport enum EnumFoodFlavor {\n SALTY = \"Salty\",\n SAVOURY = \"Savoury\",\n SPICY = \"Spicy\",\n SWEET = \"Sweet\",\n}\n\nexport enum EnumResourceType {\n EVENT = \"event\",\n VENDOR = \"vendor\",\n}\n\nexport enum EnumEventType {\n EXPO = \"Expo\",\n FAIR = \"Fair\",\n FESTIVAL = \"Festival\",\n MARKET = \"Market\",\n}\n\nexport enum EnumVendorType {\n STALLHOLDER = \"Stallholder\",\n SHOP = \"Shop\",\n CHARITY = \"Charity\",\n}\n\nexport enum EnumOSPlatform {\n ANDROID = \"android\",\n IOS = \"ios\",\n WEB = \"web\",\n}\n\nexport enum EnumRelationResource {\n EVENT_INVITE_VENDOR = \"event_invite_vendor\",\n VENDOR_APPLICATION_TO_EVENT = \"vendor_application_to_event\",\n}\n\nexport enum EnumNotificationResourceType {\n ADDED_AS_PARTNER_EVENT = \"added_as_partner_event\",\n ADDED_AS_PARTNER_VENDOR = \"added_as_partner_vendor\",\n APPROVED_EVENT = \"approved_event\",\n APPROVED_VENDOR = \"approved_vendor\",\n CREATED_EVENT = \"created_event\",\n CREATED_VENDOR = \"created_vendor\",\n EVENT_INVITE_VENDOR = EnumRelationResource.EVENT_INVITE_VENDOR,\n EVENT_STARTING_SOON = \"event_starting_soon\",\n NEW_CHAT_MESSAGE = \"new_chat_message\",\n VENDOR_APPLICATION_TO_EVENT = EnumRelationResource.VENDOR_APPLICATION_TO_EVENT,\n}\n\nexport enum EnumNotificationType {\n EVENT = EnumResourceType.EVENT,\n VENDOR = EnumResourceType.VENDOR,\n RELATION = \"relation\",\n CHAT = \"chat\",\n SYSTEM = \"system\",\n}\n\nexport enum EnumRegions {\n Auckland = \"Auckland\",\n BayOfPlentyGisborne = \"Bay of Plenty & Gisborne\",\n Canterbury = \"Canterbury\",\n HawkesBay = \"Hawke's Bay\",\n ManawatuWanganui = \"Manawatu-Wanganui\",\n MarlboroughNelson = \"Marlborough & Nelson\",\n Northland = \"Northland\",\n SouthlandOtago = \"Southland & Otago\",\n Taranaki = \"Taranaki\",\n Waikato = \"Waikato\",\n Wellington = \"Wellington\",\n TasmanWestCoast = \"Tasman & West Coast\",\n}\n\nexport enum ImageTypeEnum {\n AVATAR = \"avatar\",\n COVER = \"cover\",\n IMAGE = \"image\",\n LOGO = \"logo\",\n}\n\nexport enum EnumUserLicence {\n PRO_EVENT = \"pro_event\",\n PRO_PLUS_EVENT = \"pro_plus_event\",\n PRO_PLUS_VENDOR = \"pro_plus_vendor\",\n PRO_VENDOR = \"pro_vendor\",\n STANDARD_EVENT = \"standard_event\",\n STANDARD_VENDOR = \"standard_vendor\",\n}\n\nexport enum EnumUserRole {\n ADMIN = \"admin\",\n CUSTOMER = \"customer\",\n MARKETING = \"marketing\",\n MODERATOR = \"moderator\",\n SUPPORT = \"support\",\n}\n\nexport enum EnumSocialMedia {\n FACEBOOK = \"facebook\",\n INSTAGRAM = \"instagram\",\n TIKTOK = \"tiktok\",\n TWITTER = \"twitter\",\n WEBSITE = \"website\",\n YOUTUBE = \"youtube\",\n}\n","import {\n SchemaCreateBulkNotificationInput,\n SchemaNotificationType,\n NotificationModel,\n} from \"src/mongoose/Notification\";\nimport { EnumPubSubEvents, GraphQLContext, ObjectId } from \"src/types\";\n\n// Helper function to publish notification subscription events\nexport async function publishNotificationEvents(\n userId: ObjectId,\n context: GraphQLContext,\n) {\n try {\n // Get user's notifications for the subscription\n const userNotifications = await NotificationModel.find({\n userId,\n }).sort({ createdAt: -1 });\n\n // Get notification count\n const [total, unread] = await Promise.all([\n NotificationModel.countDocuments({ userId }),\n NotificationModel.countDocuments({ isRead: false, userId }),\n ]);\n\n // Publish both events\n context.pubsub.publish(EnumPubSubEvents.GET_NOTIFICATIONS, {\n getNotifications: userNotifications,\n getNotificationsUserId: userId,\n });\n\n context.pubsub.publish(EnumPubSubEvents.GET_NOTIFICATIONS_COUNT, {\n getNotificationsCount: { total, unread, userId },\n });\n\n console.log(`Published notification events for user: ${String(userId)}`);\n } catch (error) {\n console.error(\n `Failed to publish notification events for user ${String(userId)}:`,\n error,\n );\n }\n}\n\n/**\n * Create notifications in the database for multiple users\n * This is typically called when sending push notifications\n */\nexport async function createNotifications(\n payload: SchemaCreateBulkNotificationInput,\n context: GraphQLContext,\n): Promise<SchemaNotificationType[]> {\n const { data, message, title, type, userIds } = payload;\n try {\n const notifications = userIds.map((userId) => ({\n data,\n isRead: false,\n message,\n title,\n type,\n userId,\n }));\n\n // Save notifications to database\n const savedNotifications =\n await NotificationModel.insertMany(notifications);\n console.log(\n `Created ${savedNotifications.length} notifications for ${userIds.length} users`,\n );\n\n const uniqueUserIds = [...new Set(userIds)];\n for (const userId of uniqueUserIds) {\n await publishNotificationEvents(userId, context);\n }\n\n return savedNotifications;\n } catch (error) {\n console.error(\"Failed to create notifications:\", error);\n return [];\n //throw new Error(`Failed to create notifications: ${error}`);\n }\n}\n","import { Expo, ExpoPushMessage, ExpoPushTicket } from \"expo-server-sdk\";\n\nimport { PushTokenModel } from \"src/mongoose/PushToken\";\nimport { NotificationDataType, ObjectId } from \"src/types\";\n\nconst expo = new Expo();\n\n/**\n * Safely extract tokens from ExpoPushMessage handling both string and array cases\n */\nfunction extractTokensFromMessage(message: ExpoPushMessage): string[] {\n return Array.isArray(message.to) ? message.to : [message.to];\n}\n\ninterface CreatePushMessagesOptions {\n tokens: string[];\n message: string;\n title: string;\n data: NotificationDataType;\n}\n\n/**\n * Create push messages from valid tokens\n */\nfunction createPushMessages({\n tokens,\n message,\n title,\n data,\n}: CreatePushMessagesOptions): {\n messages: ExpoPushMessage[];\n invalidTokens: string[];\n} {\n const messages: ExpoPushMessage[] = [];\n const invalidTokens: string[] = [];\n\n for (const token of tokens) {\n if (!Expo.isExpoPushToken(token)) {\n invalidTokens.push(token);\n continue;\n }\n\n messages.push({\n body: message,\n data: { ...data },\n sound: \"default\",\n title,\n to: token,\n });\n }\n\n return { invalidTokens, messages };\n}\n\n/**\n * Process chunk results and extract failed tokens\n */\nfunction processChunkResults(\n tickets: ExpoPushTicket[],\n chunk: ExpoPushMessage[],\n): { successCount: number; failedTokens: string[] } {\n let successCount = 0;\n const failedTokens: string[] = [];\n\n for (const [ticketIndex, ticket] of tickets.entries()) {\n if (ticket.status === \"error\") {\n const message = chunk[ticketIndex];\n if (message) {\n const tokens = extractTokensFromMessage(message);\n if (ticket.details?.error === \"DeviceNotRegistered\") {\n failedTokens.push(...tokens);\n }\n console.log(\"Push notification error\", {\n error: ticket.details?.error,\n tokens,\n });\n }\n } else {\n successCount++;\n }\n }\n\n return { failedTokens, successCount };\n}\n\n/**\n * Send a single chunk of push notifications\n */\nasync function sendChunk(\n chunk: ExpoPushMessage[],\n chunkIndex: number,\n): Promise<{ successCount: number; failedTokens: string[] }> {\n try {\n const tickets = await expo.sendPushNotificationsAsync(chunk);\n const { successCount, failedTokens } = processChunkResults(tickets, chunk);\n\n console.log(\n `Chunk ${chunkIndex + 1}: Sent ${successCount}/${chunk.length} notifications successfully`,\n );\n\n return { failedTokens, successCount };\n } catch (error) {\n console.log(\"Error sending Expo push notification chunk\", {\n chunkIndex,\n chunkSize: chunk.length,\n error: error instanceof Error ? error.message : String(error),\n });\n return { failedTokens: [], successCount: 0 };\n }\n}\n\ninterface SendPushNotificationOptions {\n data: NotificationDataType;\n message: string;\n title: string;\n userIds: ObjectId[];\n}\n\nexport async function sendPushNotification({\n data,\n message,\n title,\n userIds,\n}: SendPushNotificationOptions) {\n const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });\n const expoTokens = pushTokens.map((token) => token.token);\n\n const { messages, invalidTokens } = createPushMessages({\n data,\n message,\n title,\n tokens: expoTokens,\n });\n\n // Log invalid tokens\n if (invalidTokens.length > 0) {\n console.log(`Found ${invalidTokens.length} invalid push tokens`);\n }\n\n if (messages.length === 0) {\n console.log(\"No valid messages to send after filtering tokens\");\n return;\n }\n\n // Send notifications in chunks\n const chunks = expo.chunkPushNotifications(messages);\n let totalSuccessCount = 0;\n const allFailedTokens: string[] = [];\n\n for (const [chunkIndex, chunk] of chunks.entries()) {\n const { successCount, failedTokens } = await sendChunk(\n chunk,\n chunkIndex + 1,\n );\n totalSuccessCount += successCount;\n allFailedTokens.push(...failedTokens);\n }\n\n // Log final results\n console.log(\n `Sent push notification to ${totalSuccessCount}/${messages.length} tokens across ${chunks.length} chunks`,\n );\n\n if (allFailedTokens.length > 0) {\n console.log(`Found ${allFailedTokens.length} failed push tokens`);\n }\n}\n","import mongoose from \"mongoose\";\n\nimport { EnumOSPlatform } from \"src/enums\";\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\ntype PushTokenType = {\n _id: string;\n createdAt: Date;\n platform: EnumOSPlatform;\n token: string;\n updatedAt: Date;\n userId: string;\n};\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: { required: true, type: mongoose.Schema.Types.ObjectId },\n },\n { timestamps: true },\n);\n\nex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QAAM,aAAa,MAAM,eAAe,KAAK,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,CAAC;AACzE,QAAM,aAAa,WAAW,IAAI,CAAC,UAAU,MAAM,KAAK;AAExD,QAAM,EAAE,UAAU,cAAc,IAAI,mBAAmB;AAAA,IACrD;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,MAAI,cAAc,SAAS,GAAG;AAC5B,YAAQ,IAAI,SAAS,cAAc,MAAM,sBAAsB;AAAA,EACjE;AAEA,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,IAAI,kDAAkD;AAC9D;AAAA,EACF;AAGA,QAAM,SAAS,KAAK,uBAAuB,QAAQ;AACnD,MAAI,oBAAoB;AACxB,QAAM,kBAA4B,CAAC;AAEnC,aAAW,CAAC,YAAY,KAAK,KAAK,OAAO,QAAQ,GAAG;AAClD,UAAM,EAAE,cAAc,aAAa,IAAI,MAAM;AAAA,MAC3C;AAAA,MACA,aAAa;AAAA,IACf;AACA,yBAAqB;AACrB,oBAAgB,KAAK,GAAG,YAAY;AAAA,EACtC;AAGA,UAAQ;AAAA,IACN,6BAA6B,iBAAiB,IAAI,SAAS,MAAM,kBAAkB,OAAO,MAAM;AAAA,EAClG;AAEA,MAAI,gBAAgB,SAAS,GAAG;AAC9B,YAAQ,IAAI,SAAS,gBAAgB,MAAM,qBAAqB;AAAA,EAClE;AACF;","names":["dayjs","utc","timezone","schema","mongoose","import_mongoose","EnumOSPlatform","EnumNotificationResourceType","EnumNotificationType","mongoose","import_mongoose","MongooseSchema","mongoose","schema"]}
@@ -0,0 +1,27 @@
1
+ import { q as ObjectId, J as GraphQLContext, G as SchemaCreateBulkNotificationInput, H as SchemaNotificationType, K as NotificationDataType } from '../global-_ZHkOcnR.mjs';
2
+ import 'mongoose';
3
+ import 'react-hook-form';
4
+ import '../enums/index.mjs';
5
+
6
+ /**
7
+ * Connect to MongoDB using Mongoose.
8
+ * Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).
9
+ */
10
+ declare const connectToDatabase: () => Promise<void>;
11
+
12
+ declare function publishNotificationEvents(userId: ObjectId, context: GraphQLContext): Promise<void>;
13
+ /**
14
+ * Create notifications in the database for multiple users
15
+ * This is typically called when sending push notifications
16
+ */
17
+ declare function createNotifications(payload: SchemaCreateBulkNotificationInput, context: GraphQLContext): Promise<SchemaNotificationType[]>;
18
+
19
+ interface SendPushNotificationOptions {
20
+ data: NotificationDataType;
21
+ message: string;
22
+ title: string;
23
+ userIds: ObjectId[];
24
+ }
25
+ declare function sendPushNotification({ data, message, title, userIds, }: SendPushNotificationOptions): Promise<void>;
26
+
27
+ export { connectToDatabase, createNotifications, publishNotificationEvents, sendPushNotification };
@@ -0,0 +1,27 @@
1
+ import { q as ObjectId, J as GraphQLContext, G as SchemaCreateBulkNotificationInput, H as SchemaNotificationType, K as NotificationDataType } from '../global-4lS-fh61.js';
2
+ import 'mongoose';
3
+ import 'react-hook-form';
4
+ import '../enums/index.js';
5
+
6
+ /**
7
+ * Connect to MongoDB using Mongoose.
8
+ * Supports both local MongoDB (via MONGODB_URI) and MongoDB Atlas (via individual env vars).
9
+ */
10
+ declare const connectToDatabase: () => Promise<void>;
11
+
12
+ declare function publishNotificationEvents(userId: ObjectId, context: GraphQLContext): Promise<void>;
13
+ /**
14
+ * Create notifications in the database for multiple users
15
+ * This is typically called when sending push notifications
16
+ */
17
+ declare function createNotifications(payload: SchemaCreateBulkNotificationInput, context: GraphQLContext): Promise<SchemaNotificationType[]>;
18
+
19
+ interface SendPushNotificationOptions {
20
+ data: NotificationDataType;
21
+ message: string;
22
+ title: string;
23
+ userIds: ObjectId[];
24
+ }
25
+ declare function sendPushNotification({ data, message, title, userIds, }: SendPushNotificationOptions): Promise<void>;
26
+
27
+ export { connectToDatabase, createNotifications, publishNotificationEvents, sendPushNotification };