@lyxa.ai/core 1.0.138 → 1.0.140

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 (44) hide show
  1. package/dist/index.js +3 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/libraries/bullmq/bull-mq-service.d.ts +9 -0
  4. package/dist/libraries/bullmq/bull-mq-service.js +42 -0
  5. package/dist/libraries/bullmq/bull-mq-service.js.map +1 -0
  6. package/dist/libraries/index.d.ts +2 -0
  7. package/dist/libraries/index.js +4 -0
  8. package/dist/libraries/index.js.map +1 -1
  9. package/dist/libraries/mongo/models/chat-room.model.d.ts +0 -6
  10. package/dist/libraries/mongo/models/chat-room.model.js +0 -20
  11. package/dist/libraries/mongo/models/chat-room.model.js.map +1 -1
  12. package/dist/libraries/mongo/models/embedded/chat-participant.model.d.ts +2 -1
  13. package/dist/libraries/mongo/models/embedded/chat-participant.model.js +2 -1
  14. package/dist/libraries/mongo/models/embedded/chat-participant.model.js.map +1 -1
  15. package/dist/libraries/mongo/models/message.model.d.ts +2 -4
  16. package/dist/libraries/mongo/models/message.model.js +1 -11
  17. package/dist/libraries/mongo/models/message.model.js.map +1 -1
  18. package/dist/libraries/mongo/models/shop-review.model.d.ts +2 -0
  19. package/dist/libraries/mongo/models/shop-review.model.js +6 -0
  20. package/dist/libraries/mongo/models/shop-review.model.js.map +1 -1
  21. package/dist/libraries/mongo/models/ticket.model.d.ts +2 -6
  22. package/dist/libraries/mongo/models/ticket.model.js +1 -68
  23. package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
  24. package/dist/libraries/redis/index.js +3 -1
  25. package/dist/libraries/redis/index.js.map +1 -1
  26. package/dist/utilities/enum.d.ts +1 -1
  27. package/dist/utilities/enum.js +8 -8
  28. package/dist/utilities/enum.js.map +1 -1
  29. package/package.json +2 -1
  30. package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +0 -9
  31. package/dist/libraries/mongo/models/app-screen-setting.model.js +0 -72
  32. package/dist/libraries/mongo/models/app-screen-setting.model.js.map +0 -1
  33. package/dist/libraries/mongo/models/order-finance.model.d.ts +0 -22
  34. package/dist/libraries/mongo/models/order-finance.model.js +0 -83
  35. package/dist/libraries/mongo/models/order-finance.model.js.map +0 -1
  36. package/dist/libraries/mongo/models/order-payment.model.d.ts +0 -17
  37. package/dist/libraries/mongo/models/order-payment.model.js +0 -84
  38. package/dist/libraries/mongo/models/order-payment.model.js.map +0 -1
  39. package/dist/libraries/mongo/models/providers/courier-order-finance.model.d.ts +0 -7
  40. package/dist/libraries/mongo/models/providers/courier-order-finance.model.js +0 -26
  41. package/dist/libraries/mongo/models/providers/courier-order-finance.model.js.map +0 -1
  42. package/dist/libraries/mongo/models/providers/regular-order-finance.model.d.ts +0 -25
  43. package/dist/libraries/mongo/models/providers/regular-order-finance.model.js +0 -95
  44. package/dist/libraries/mongo/models/providers/regular-order-finance.model.js.map +0 -1
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ const SubscriptionRegistry_1 = require("./libraries/event/registry/SubscriptionR
26
26
  const map_1 = require("./libraries/map");
27
27
  const settings_1 = require("./libraries/cache/settings");
28
28
  const fcmService_1 = require("./libraries/firebase/fcmService");
29
+ const bull_mq_service_1 = require("./libraries/bullmq/bull-mq-service");
29
30
  var EnvironmentConfigurationType_2 = require("./libraries/configuration/types/EnvironmentConfigurationType");
30
31
  Object.defineProperty(exports, "EnvironmentConfigurationType", { enumerable: true, get: function () { return EnvironmentConfigurationType_2.EnvironmentConfigurationType; } });
31
32
  var mongo_2 = require("./libraries/mongo");
@@ -60,6 +61,8 @@ async function registerLibraries(options) {
60
61
  typedi_1.Container.set(redis_1.RedisService, redisInstance);
61
62
  const secretInstance = new secrets_1.SecretManagerService(configurationInstance, redisInstance);
62
63
  typedi_1.Container.set(secrets_1.SecretManagerService, secretInstance);
64
+ const bullMQInstance = new bull_mq_service_1.BullMQService(redisInstance);
65
+ typedi_1.Container.set(bull_mq_service_1.BullMQService, bullMQInstance);
63
66
  const mongoUrl = await getLibraries().getSecretsService().getKey('MONGO_URL');
64
67
  await mongoose_1.default.connect(mongoUrl, { dbName: `lyxa-${options.environment}-${options.tenet}` });
65
68
  mongoose_1.default.set('debug', getLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType_1.EnvironmentConfigurationType.DEV);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;AA0BA,sCAyBC;AAED,8CAsEC;AAED,oCAEC;AA9HD,qFAAqF;AACrF,IAAA,0CAAqB,GAAE,CAAC;AAExB,2CAA6C;AAC7C,mCAAmC;AACnC,wDAAgC;AAChC,6DAAuF;AACvF,+GAA4G;AAC5G,+CAAgD;AAChD,6CAAiD;AACjD,6CAAyD;AACzD,iDAA2D;AAC3D,uDAAgE;AAChE,+CAAmD;AACnD,mDAAuD;AACvD,6CAAmE;AACnE,0FAAuF;AACvF,yCAAgE;AAChE,yDAAmE;AACnE,gEAA6D;AAG7D,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAAyD;AAAhD,6GAAA,oBAAoB,OAAA;AAEtB,KAAK,UAAU,aAAa,CAAC,OAA8B;IACjE,IAAI,CAAC;QACJ,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEjC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAE/E,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;YACnC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YAChG,OAAO,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACxC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACvC,O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GAAG,IAAI,uBAAU,EAAE,CAAC;IAC5C,kBAAS,CAAC,GAAG,CAAC,uBAAU,EAAE,kBAAkB,CAAC,CAAC;IAE9C,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAEtC,MAAM,IAAA,oBAAY,EAAC,kFAAkF,CAAC,CAAC;IACvG,MAAM,gBAAgB,GAAG,2CAAoB,CAAC,mBAAmB,EAAE,CAAC;IAEpE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEtD,KAAK,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAC3E,IAAI,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,kBAAS,CAAC,GAAG,CAAC,iBAAwB,CAAC,CAAC;YACnD,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAA,wBAAgB,EAAC,OAAO,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;YAC/C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Apply the soft delete plugin globally before any connections or models\nimport { applySoftDeletePlugin } from './libraries/mongo/plugins/soft-delete-plugin';\napplySoftDeletePlugin();\n\nimport { LibraryManager } from './libraries';\nimport { Container } from 'typedi';\nimport mongoose from 'mongoose';\nimport { ConfigurationOptions, ConfigurationService } from './libraries/configuration';\nimport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nimport { LyxaLogger } from './libraries/logger';\nimport { RedisService } from './libraries/redis';\nimport { initGlobalConnection } from './libraries/mongo';\nimport { SecretManagerService } from './libraries/secrets';\nimport { MicroServiceDispatcher } from './libraries/dispatcher';\nimport { TwilioService } from './libraries/twilio';\nimport { FirebaseService } from './libraries/firebase';\nimport { initEventBus, subscribeToEvent } from './libraries/event';\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\nimport { MapService, GoogleMapsService } from './libraries/map';\nimport { CachedSettingsService } from './libraries/cache/settings';\nimport { FCMService } from './libraries/firebase/fcmService';\n\nexport { ConfigurationOptions } from './libraries/configuration';\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nexport { initGlobalConnection } from './libraries/mongo';\n\nexport async function bootstrapCore(options?: ConfigurationOptions) {\n\ttry {\n\t\tawait registerLibraries(options);\n\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\n\n\t\tconst gracefulShutdown = async () => {\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\n\t\t\tprocess.exit();\n\t\t};\n\n\t\tprocess.on('SIGTERM', gracefulShutdown);\n\t\tprocess.on('SIGINT', gracefulShutdown);\n\t\tprocess.on('uncaughtException', err => {\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\n\t\t\tgracefulShutdown();\n\t\t});\n\t\tprocess.on('exit', code => {\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\n\t\t});\n\n\t\tconsole.log('Created hooks.');\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function registerLibraries(options?: ConfigurationOptions) {\n\t// Setup configuration.\n\tconst configurationInstance = new ConfigurationService(options);\n\tContainer.set(ConfigurationService, configurationInstance);\n\n\t// Setup redis.\n\tconst redisInstance = new RedisService(configurationInstance.options.redisURL!);\n\tContainer.set(RedisService, redisInstance);\n\n\t// Setup secret\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\n\tContainer.set(SecretManagerService, secretInstance);\n\n\tconst mongoUrl = await getLibraries().getSecretsService().getKey('MONGO_URL');\n\n\tawait mongoose.connect(mongoUrl!, { dbName: `lyxa-${options!.environment}-${options!.tenet}` });\n\tmongoose.set(\n\t\t'debug',\n\t\tgetLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\n\t);\n\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\n\n\t// Setup logger\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\n\tContainer.set(LyxaLogger, loggerInstance);\n\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t// Setup microservice dispatcher\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\n\n\t// Setup twilio\n\tconst twilioServiceInstance = new TwilioService();\n\tContainer.set(TwilioService, twilioServiceInstance);\n\n\t// Setup map service\n\tconst googleMapsKey = await getLibraries().getSecretsService().getKey('GOOGLE_MAPS_API_KEY');\n\tconst googleMapService = new GoogleMapsService(googleMapsKey as string);\n\tconst mapServiceInstance = new MapService(googleMapService);\n\tContainer.set(MapService, mapServiceInstance);\n\n\tconst settingsServiceInstance = new CachedSettingsService(redisInstance);\n\tContainer.set(CachedSettingsService, settingsServiceInstance);\n\n\t// Setup fcm service\n\tconst fcmServiceInstance = new FCMService();\n\tContainer.set(FCMService, fcmServiceInstance);\n\n\tconsole.log('Initialized everything');\n\n\tawait initEventBus('amqps://adlvedna:oY_X4qH1AphtB83YNcf9DHMO3UVmX23s@dog.lmq.cloudamqp.com/adlvedna');\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\n\n\tconst instantiatedServices = new Map<Function, any>();\n\n\tfor (const { eventId, targetConstructor, methodName } of allSubscriptions) {\n\t\tlet instance = instantiatedServices.get(targetConstructor);\n\t\tif (!instance) {\n\t\t\tinstance = Container.get(targetConstructor as any);\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\n\t\t}\n\n\t\tawait subscribeToEvent(eventId, async payload => {\n\t\t\treturn instance[methodName](payload);\n\t\t});\n\t}\n}\n\nexport function getLibraries(): LibraryManager {\n\treturn Container.get(LibraryManager);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;AA2BA,sCAyBC;AAED,8CA2EC;AAED,oCAEC;AApID,qFAAqF;AACrF,IAAA,0CAAqB,GAAE,CAAC;AAExB,2CAA6C;AAC7C,mCAAmC;AACnC,wDAAgC;AAChC,6DAAuF;AACvF,+GAA4G;AAC5G,+CAAgD;AAChD,6CAAiD;AACjD,6CAAyD;AACzD,iDAA2D;AAC3D,uDAAgE;AAChE,+CAAmD;AACnD,mDAAuD;AACvD,6CAAmE;AACnE,0FAAuF;AACvF,yCAAgE;AAChE,yDAAmE;AACnE,gEAA6D;AAC7D,wEAAmE;AAGnE,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAAyD;AAAhD,6GAAA,oBAAoB,OAAA;AAEtB,KAAK,UAAU,aAAa,CAAC,OAA8B;IACjE,IAAI,CAAC;QACJ,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEjC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAE/E,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;YACnC,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YAChG,OAAO,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACxC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACvC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG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,kBAAS,CAAC,GAAG,CAAC,gCAAqB,EAAE,uBAAuB,CAAC,CAAC;IAG9D,MAAM,kBAAkB,GAAG,IAAI,uBAAU,EAAE,CAAC;IAC5C,kBAAS,CAAC,GAAG,CAAC,uBAAU,EAAE,kBAAkB,CAAC,CAAC;IAE9C,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAEtC,MAAM,IAAA,oBAAY,EAAC,kFAAkF,CAAC,CAAC;IACvG,MAAM,gBAAgB,GAAG,2CAAoB,CAAC,mBAAmB,EAAE,CAAC;IAEpE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEtD,KAAK,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAC3E,IAAI,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,kBAAS,CAAC,GAAG,CAAC,iBAAwB,CAAC,CAAC;YACnD,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAA,wBAAgB,EAAC,OAAO,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;YAC/C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Apply the soft delete plugin globally before any connections or models\nimport { applySoftDeletePlugin } from './libraries/mongo/plugins/soft-delete-plugin';\napplySoftDeletePlugin();\n\nimport { LibraryManager } from './libraries';\nimport { Container } from 'typedi';\nimport mongoose from 'mongoose';\nimport { ConfigurationOptions, ConfigurationService } from './libraries/configuration';\nimport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nimport { LyxaLogger } from './libraries/logger';\nimport { RedisService } from './libraries/redis';\nimport { initGlobalConnection } from './libraries/mongo';\nimport { SecretManagerService } from './libraries/secrets';\nimport { MicroServiceDispatcher } from './libraries/dispatcher';\nimport { TwilioService } from './libraries/twilio';\nimport { FirebaseService } from './libraries/firebase';\nimport { initEventBus, subscribeToEvent } from './libraries/event';\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\nimport { MapService, GoogleMapsService } from './libraries/map';\nimport { CachedSettingsService } from './libraries/cache/settings';\nimport { FCMService } from './libraries/firebase/fcmService';\nimport { BullMQService } from './libraries/bullmq/bull-mq-service';\n\nexport { ConfigurationOptions } from './libraries/configuration';\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\nexport { initGlobalConnection } from './libraries/mongo';\n\nexport async function bootstrapCore(options?: ConfigurationOptions) {\n\ttry {\n\t\tawait registerLibraries(options);\n\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\n\n\t\tconst gracefulShutdown = async () => {\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\n\t\t\tprocess.exit();\n\t\t};\n\n\t\tprocess.on('SIGTERM', gracefulShutdown);\n\t\tprocess.on('SIGINT', gracefulShutdown);\n\t\tprocess.on('uncaughtException', err => {\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\n\t\t\tgracefulShutdown();\n\t\t});\n\t\tprocess.on('exit', code => {\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\n\t\t});\n\n\t\tconsole.log('Created hooks.');\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n}\n\nexport async function registerLibraries(options?: ConfigurationOptions) {\n\t// Setup configuration.\n\tconst configurationInstance = new ConfigurationService(options);\n\tContainer.set(ConfigurationService, configurationInstance);\n\n\t// Setup redis.\n\tconst redisInstance = new RedisService(configurationInstance.options.redisURL!);\n\tContainer.set(RedisService, redisInstance);\n\n\t// Setup secret\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\n\tContainer.set(SecretManagerService, secretInstance);\n\n\t// Setup BullMQ\n\n\tconst bullMQInstance = new BullMQService(redisInstance);\n\tContainer.set(BullMQService, bullMQInstance);\n\n\tconst mongoUrl = await getLibraries().getSecretsService().getKey('MONGO_URL');\n\n\tawait mongoose.connect(mongoUrl!, { dbName: `lyxa-${options!.environment}-${options!.tenet}` });\n\tmongoose.set(\n\t\t'debug',\n\t\tgetLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\n\t);\n\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\n\n\t// Setup logger\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\n\tContainer.set(LyxaLogger, loggerInstance);\n\n\t// Setup firebase\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\n\tContainer.set(FirebaseService, firebaseInstance);\n\n\t// Setup microservice dispatcher\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\n\n\t// Setup twilio\n\tconst twilioServiceInstance = new TwilioService();\n\tContainer.set(TwilioService, twilioServiceInstance);\n\n\t// Setup map service\n\tconst googleMapsKey = await getLibraries().getSecretsService().getKey('GOOGLE_MAPS_API_KEY');\n\tconst googleMapService = new GoogleMapsService(googleMapsKey as string);\n\tconst mapServiceInstance = new MapService(googleMapService);\n\tContainer.set(MapService, mapServiceInstance);\n\n\tconst settingsServiceInstance = new CachedSettingsService(redisInstance);\n\tContainer.set(CachedSettingsService, settingsServiceInstance);\n\n\t// Setup fcm service\n\tconst fcmServiceInstance = new FCMService();\n\tContainer.set(FCMService, fcmServiceInstance);\n\n\tconsole.log('Initialized everything');\n\n\tawait initEventBus('amqps://adlvedna:oY_X4qH1AphtB83YNcf9DHMO3UVmX23s@dog.lmq.cloudamqp.com/adlvedna');\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\n\n\tconst instantiatedServices = new Map<Function, any>();\n\n\tfor (const { eventId, targetConstructor, methodName } of allSubscriptions) {\n\t\tlet instance = instantiatedServices.get(targetConstructor);\n\t\tif (!instance) {\n\t\t\tinstance = Container.get(targetConstructor as any);\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\n\t\t}\n\n\t\tawait subscribeToEvent(eventId, async payload => {\n\t\t\treturn instance[methodName](payload);\n\t\t});\n\t}\n}\n\nexport function getLibraries(): LibraryManager {\n\treturn Container.get(LibraryManager);\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { Queue, Worker, Job, WorkerOptions } from 'bullmq';
2
+ import { RedisService } from '../redis/index';
3
+ export declare class BullMQService {
4
+ private redisService;
5
+ private connection;
6
+ constructor(redisService: RedisService);
7
+ createQueue(queueName: string): Queue;
8
+ createWorker<T>(queueName: string, processor: (job: Job<T>) => Promise<void>, options?: WorkerOptions): Worker;
9
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BullMQService = void 0;
16
+ const typedi_1 = require("typedi");
17
+ const bullmq_1 = require("bullmq");
18
+ const index_1 = require("../redis/index");
19
+ let BullMQService = class BullMQService {
20
+ redisService;
21
+ connection;
22
+ constructor(redisService) {
23
+ this.redisService = redisService;
24
+ this.connection = { connection: this.redisService.redisClient };
25
+ }
26
+ createQueue(queueName) {
27
+ return new bullmq_1.Queue(queueName, this.connection);
28
+ }
29
+ createWorker(queueName, processor, options) {
30
+ return new bullmq_1.Worker(queueName, processor, {
31
+ ...this.connection,
32
+ ...options,
33
+ });
34
+ }
35
+ };
36
+ exports.BullMQService = BullMQService;
37
+ exports.BullMQService = BullMQService = __decorate([
38
+ (0, typedi_1.Service)(),
39
+ __param(0, (0, typedi_1.Inject)(() => index_1.RedisService)),
40
+ __metadata("design:paramtypes", [index_1.RedisService])
41
+ ], BullMQService);
42
+ //# sourceMappingURL=bull-mq-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bull-mq-service.js","sourceRoot":"/","sources":["libraries/bullmq/bull-mq-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,mCAAyC;AACzC,mCAAyE;AACzE,0CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGuB;IAFxC,UAAU,CAAe;IAEjC,YAAgD,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QACzE,IAAI,CAAC,UAAU,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACjE,CAAC;IAKM,WAAW,CAAC,SAAiB;QACnC,OAAO,IAAI,cAAK,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAKM,YAAY,CAClB,SAAiB,EACjB,SAAyC,EACzC,OAAuB;QAEvB,OAAO,IAAI,eAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YACvC,GAAG,IAAI,CAAC,UAAU;YAClB,GAAG,OAAO;SACV,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA3BY,sCAAa;wBAAb,aAAa;IADzB,IAAA,gBAAO,GAAE;IAII,WAAA,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,oBAAY,CAAC,CAAA;qCAAuB,oBAAY;GAH9D,aAAa,CA2BzB","sourcesContent":["// lyxa-core/libraries/bullmq/BullMQService.ts\n\nimport { Service, Inject } from 'typedi';\nimport { Queue, Worker, Job, QueueOptions, WorkerOptions } from 'bullmq';\nimport { RedisService } from '../redis/index';\n\n@Service()\nexport class BullMQService {\n\tprivate connection: QueueOptions;\n\n\tconstructor(@Inject(() => RedisService) private redisService: RedisService) {\n\t\tthis.connection = { connection: this.redisService.redisClient };\n\t}\n\n\t/**\n\t * Creates a new queue.\n\t */\n\tpublic createQueue(queueName: string): Queue {\n\t\treturn new Queue(queueName, this.connection);\n\t}\n\n\t/**\n\t * Creates a worker to process jobs from a given queue.\n\t */\n\tpublic createWorker<T>(\n\t\tqueueName: string,\n\t\tprocessor: (job: Job<T>) => Promise<void>,\n\t\toptions?: WorkerOptions\n\t): Worker {\n\t\treturn new Worker(queueName, processor, {\n\t\t\t...this.connection,\n\t\t\t...options,\n\t\t});\n\t}\n}\n"]}
@@ -10,6 +10,7 @@ import { TokenRepository } from './auth/repository';
10
10
  import { MapService } from './map';
11
11
  import { CachedSettingsService } from './cache/settings';
12
12
  import { FCMService } from './firebase/fcmService';
13
+ import { BullMQService } from './bullmq/bull-mq-service';
13
14
  export declare class LibraryManager {
14
15
  getLogger(): LyxaLogger;
15
16
  getMicroServiceDispatcher(): MicroServiceDispatcher;
@@ -24,4 +25,5 @@ export declare class LibraryManager {
24
25
  getMapService(): MapService;
25
26
  getCachedSettingsService(): CachedSettingsService;
26
27
  getFCMService(): FCMService;
28
+ getBullMQService(): BullMQService;
27
29
  }
@@ -20,6 +20,7 @@ const repository_1 = require("./auth/repository");
20
20
  const map_1 = require("./map");
21
21
  const settings_1 = require("./cache/settings");
22
22
  const fcmService_1 = require("./firebase/fcmService");
23
+ const bull_mq_service_1 = require("./bullmq/bull-mq-service");
23
24
  let LibraryManager = class LibraryManager {
24
25
  getLogger() {
25
26
  return typedi_1.Container.get(logger_1.LyxaLogger);
@@ -60,6 +61,9 @@ let LibraryManager = class LibraryManager {
60
61
  getFCMService() {
61
62
  return typedi_1.Container.get(fcmService_1.FCMService);
62
63
  }
64
+ getBullMQService() {
65
+ return typedi_1.Container.get(bull_mq_service_1.BullMQService);
66
+ }
63
67
  };
64
68
  exports.LibraryManager = LibraryManager;
65
69
  exports.LibraryManager = LibraryManager = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA4C;AAC5C,qCAAyC;AACzC,qCAAsC;AACtC,6CAAsD;AACtD,uCAAiD;AACjD,mCAAuC;AACvC,mDAAuD;AACvD,qCAAyC;AACzC,yCAA6C;AAC7C,kDAAoD;AACpD,+BAAmC;AACnC,+CAAyD;AACzD,sDAAmD;AAG5C,IAAM,cAAc,GAApB,MAAM,cAAc;IACnB,SAAS;QACf,OAAO,kBAAS,CAAC,GAAG,CAAC,mBAAU,CAAC,CAAC;IAClC,CAAC;IACM,yBAAyB;QAC/B,OAAO,kBAAS,CAAC,GAAG,CAAC,mCAAsB,CAAC,CAAC;IAC9C,CAAC;IACM,gBAAgB;QACtB,OAAO,kBAAS,CAAC,GAAG,CAAC,sBAAa,CAAC,CAAC;IACrC,CAAC;IACM,iBAAiB;QACvB,OAAO,kBAAS,CAAC,GAAG,CAAC,8BAAoB,CAAC,CAAC;IAC5C,CAAC;IACM,eAAe;QACrB,OAAO,kBAAS,CAAC,GAAG,CAAC,oBAAY,CAAC,CAAC;IACpC,CAAC;IACM,uBAAuB;QAC7B,OAAO,kBAAS,CAAC,GAAG,CAAC,oCAAoB,CAAC,CAAC;IAC5C,CAAC;IACM,kBAAkB;QACxB,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAe,CAAC,CAAC;IACvC,CAAC;IACM,sBAAsB;QAC5B,OAAO,kBAAS,CAAC,GAAG,CAAC,4BAAe,CAAC,CAAC;IACvC,CAAC;IACM,sBAAsB;QAC5B,OAAO,IAAI,sBAAa,EAAE,CAAC;IAC5B,CAAC;IACM,qBAAqB;QAC3B,OAAO,IAAI,sBAAa,CAAC,OAAO,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClF,CAAC;IACM,aAAa;QACnB,OAAO,kBAAS,CAAC,GAAG,CAAC,gBAAU,CAAC,CAAC;IAClC,CAAC;IACM,wBAAwB;QAC9B,OAAO,kBAAS,CAAC,GAAG,CAAC,gCAAqB,CAAC,CAAC;IAC7C,CAAC;IACM,aAAa;QACnB,OAAO,kBAAS,CAAC,GAAG,CAAC,uBAAU,CAAC,CAAC;IAClC,CAAC;CACD,CAAA;AAxCY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,gBAAO,GAAE;GACG,cAAc,CAwC1B","sourcesContent":["import { Container, Service } from 'typedi';\nimport { TwilioService } from './twilio';\nimport { LyxaLogger } from './logger';\nimport { MicroServiceDispatcher } from './dispatcher';\nimport { SecretManagerService } from './secrets';\nimport { RedisService } from './redis';\nimport { ConfigurationService } from './configuration';\nimport { UploadService } from './upload';\nimport { FirebaseService } from './firebase';\nimport { TokenRepository } from './auth/repository';\nimport { MapService } from './map';\nimport { CachedSettingsService } from './cache/settings';\nimport { FCMService } from './firebase/fcmService';\n\n@Service()\nexport class LibraryManager {\n\tpublic getLogger(): LyxaLogger {\n\t\treturn Container.get(LyxaLogger);\n\t}\n\tpublic getMicroServiceDispatcher(): MicroServiceDispatcher {\n\t\treturn Container.get(MicroServiceDispatcher);\n\t}\n\tpublic getTwilioService(): TwilioService {\n\t\treturn Container.get(TwilioService);\n\t}\n\tpublic getSecretsService(): SecretManagerService {\n\t\treturn Container.get(SecretManagerService);\n\t}\n\tpublic getRedisService(): RedisService {\n\t\treturn Container.get(RedisService);\n\t}\n\tpublic getConfigurationService(): ConfigurationService {\n\t\treturn Container.get(ConfigurationService);\n\t}\n\tpublic getFirebaseService(): FirebaseService {\n\t\treturn Container.get(FirebaseService);\n\t}\n\tpublic getAuthTokenRepository(): TokenRepository {\n\t\treturn Container.get(TokenRepository);\n\t}\n\tpublic getGlobalUploadService(): UploadService {\n\t\treturn new UploadService();\n\t}\n\tpublic getTenetUploadService(): UploadService {\n\t\treturn new UploadService('lyxa-' + this.getConfigurationService().options.tenet);\n\t}\n\tpublic getMapService(): MapService {\n\t\treturn Container.get(MapService);\n\t}\n\tpublic getCachedSettingsService(): CachedSettingsService {\n\t\treturn Container.get(CachedSettingsService);\n\t}\n\tpublic getFCMService(): FCMService {\n\t\treturn Container.get(FCMService);\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA4C;AAC5C,qCAAyC;AACzC,qCAAsC;AACtC,6CAAsD;AACtD,uCAAiD;AACjD,mCAAuC;AACvC,mDAAuD;AACvD,qCAAyC;AACzC,yCAA6C;AAC7C,kDAAoD;AACpD,+BAAmC;AACnC,+CAAyD;AACzD,sDAAmD;AACnD,8DAAyD;AAGlD,IAAM,cAAc,GAApB,MAAM,cAAc;IACnB,SAAS;QACf,OAAO,kBAAS,CAAC,GAAG,CAAC,mBAAU,CAAC,CAAC;IAClC,CAAC;IACM,yBAAyB;QAC/B,OAAO,kBAAS,CAAC,GAAG,CAAC,mCAAsB,CAAC,CAAC;IAC9C,CAAC;IACM,gBAAgB;QACtB,OAAO,kBAAS,CAAC,GAAG,CAAC,sBAAa,CAAC,CAAC;IACrC,CAAC;IACM,iBAAiB;QACvB,OAAO,kBAAS,CAAC,GAAG,CAAC,8BAAoB,CAAC,CAAC;IAC5C,CAAC;IACM,eAAe;QACrB,OAAO,kBAAS,CAAC,GAAG,CAAC,oBAAY,CAAC,CAAC;IACpC,CAAC;IACM,uBAAuB;QAC7B,OAAO,kBAAS,CAAC,GAAG,CAAC,oCAAoB,CAAC,CAAC;IAC5C,CAAC;IACM,kBAAkB;QACxB,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAe,CAAC,CAAC;IACvC,CAAC;IACM,sBAAsB;QAC5B,OAAO,kBAAS,CAAC,GAAG,CAAC,4BAAe,CAAC,CAAC;IACvC,CAAC;IACM,sBAAsB;QAC5B,OAAO,IAAI,sBAAa,EAAE,CAAC;IAC5B,CAAC;IACM,qBAAqB;QAC3B,OAAO,IAAI,sBAAa,CAAC,OAAO,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClF,CAAC;IACM,aAAa;QACnB,OAAO,kBAAS,CAAC,GAAG,CAAC,gBAAU,CAAC,CAAC;IAClC,CAAC;IACM,wBAAwB;QAC9B,OAAO,kBAAS,CAAC,GAAG,CAAC,gCAAqB,CAAC,CAAC;IAC7C,CAAC;IACM,aAAa;QACnB,OAAO,kBAAS,CAAC,GAAG,CAAC,uBAAU,CAAC,CAAC;IAClC,CAAC;IACM,gBAAgB;QACtB,OAAO,kBAAS,CAAC,GAAG,CAAC,+BAAa,CAAC,CAAC;IACrC,CAAC;CACD,CAAA;AA3CY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,gBAAO,GAAE;GACG,cAAc,CA2C1B","sourcesContent":["import { Container, Service } from 'typedi';\nimport { TwilioService } from './twilio';\nimport { LyxaLogger } from './logger';\nimport { MicroServiceDispatcher } from './dispatcher';\nimport { SecretManagerService } from './secrets';\nimport { RedisService } from './redis';\nimport { ConfigurationService } from './configuration';\nimport { UploadService } from './upload';\nimport { FirebaseService } from './firebase';\nimport { TokenRepository } from './auth/repository';\nimport { MapService } from './map';\nimport { CachedSettingsService } from './cache/settings';\nimport { FCMService } from './firebase/fcmService';\nimport { BullMQService } from './bullmq/bull-mq-service';\n\n@Service()\nexport class LibraryManager {\n\tpublic getLogger(): LyxaLogger {\n\t\treturn Container.get(LyxaLogger);\n\t}\n\tpublic getMicroServiceDispatcher(): MicroServiceDispatcher {\n\t\treturn Container.get(MicroServiceDispatcher);\n\t}\n\tpublic getTwilioService(): TwilioService {\n\t\treturn Container.get(TwilioService);\n\t}\n\tpublic getSecretsService(): SecretManagerService {\n\t\treturn Container.get(SecretManagerService);\n\t}\n\tpublic getRedisService(): RedisService {\n\t\treturn Container.get(RedisService);\n\t}\n\tpublic getConfigurationService(): ConfigurationService {\n\t\treturn Container.get(ConfigurationService);\n\t}\n\tpublic getFirebaseService(): FirebaseService {\n\t\treturn Container.get(FirebaseService);\n\t}\n\tpublic getAuthTokenRepository(): TokenRepository {\n\t\treturn Container.get(TokenRepository);\n\t}\n\tpublic getGlobalUploadService(): UploadService {\n\t\treturn new UploadService();\n\t}\n\tpublic getTenetUploadService(): UploadService {\n\t\treturn new UploadService('lyxa-' + this.getConfigurationService().options.tenet);\n\t}\n\tpublic getMapService(): MapService {\n\t\treturn Container.get(MapService);\n\t}\n\tpublic getCachedSettingsService(): CachedSettingsService {\n\t\treturn Container.get(CachedSettingsService);\n\t}\n\tpublic getFCMService(): FCMService {\n\t\treturn Container.get(FCMService);\n\t}\n\tpublic getBullMQService(): BullMQService {\n\t\treturn Container.get(BullMQService);\n\t}\n}\n"]}
@@ -1,16 +1,10 @@
1
- import { Ref } from '@typegoose/typegoose';
2
1
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { Ticket } from './ticket.model';
4
- import { Order } from './order.model';
5
2
  import { ChatParticipant } from './embedded/chat-participant.model';
6
3
  import { ChatroomType } from '../../../utilities/enum';
7
4
  export declare class Chatroom extends TimeStamps {
8
5
  type: ChatroomType;
9
6
  participants: ChatParticipant[];
10
- ticket?: Ref<Ticket>;
11
- order?: Ref<Order>;
12
7
  isActive?: boolean;
13
8
  lastMessageAt?: Date;
14
9
  messageCount?: number;
15
- unreadCount?: number;
16
10
  }
@@ -12,19 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Chatroom = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const ticket_model_1 = require("./ticket.model");
16
- const order_model_1 = require("./order.model");
17
15
  const chat_participant_model_1 = require("./embedded/chat-participant.model");
18
16
  const enum_1 = require("../../../utilities/enum");
19
17
  let Chatroom = class Chatroom extends defaultClasses_1.TimeStamps {
20
18
  type;
21
19
  participants;
22
- ticket;
23
- order;
24
20
  isActive;
25
21
  lastMessageAt;
26
22
  messageCount;
27
- unreadCount;
28
23
  };
29
24
  exports.Chatroom = Chatroom;
30
25
  __decorate([
@@ -35,14 +30,6 @@ __decorate([
35
30
  (0, typegoose_1.prop)({ type: () => [chat_participant_model_1.ChatParticipant], required: true }),
36
31
  __metadata("design:type", Array)
37
32
  ], Chatroom.prototype, "participants", void 0);
38
- __decorate([
39
- (0, typegoose_1.prop)({ ref: () => ticket_model_1.Ticket }),
40
- __metadata("design:type", Object)
41
- ], Chatroom.prototype, "ticket", void 0);
42
- __decorate([
43
- (0, typegoose_1.prop)({ ref: () => order_model_1.Order }),
44
- __metadata("design:type", Object)
45
- ], Chatroom.prototype, "order", void 0);
46
33
  __decorate([
47
34
  (0, typegoose_1.prop)({ type: Boolean, default: true }),
48
35
  __metadata("design:type", Boolean)
@@ -55,10 +42,6 @@ __decorate([
55
42
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
56
43
  __metadata("design:type", Number)
57
44
  ], Chatroom.prototype, "messageCount", void 0);
58
- __decorate([
59
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
60
- __metadata("design:type", Number)
61
- ], Chatroom.prototype, "unreadCount", void 0);
62
45
  exports.Chatroom = Chatroom = __decorate([
63
46
  (0, typegoose_1.modelOptions)({
64
47
  schemaOptions: {
@@ -69,10 +52,7 @@ exports.Chatroom = Chatroom = __decorate([
69
52
  (0, typegoose_1.index)({ type: 1, isActive: 1 }),
70
53
  (0, typegoose_1.index)({ 'participants.ref': 1, 'participants.type': 1 }),
71
54
  (0, typegoose_1.index)({ ticket: 1 }),
72
- (0, typegoose_1.index)({ order: 1 }),
73
55
  (0, typegoose_1.index)({ createdAt: -1 }),
74
- (0, typegoose_1.index)({ lastMessageAt: -1 }),
75
- (0, typegoose_1.index)({ lastMessageAt: -1, isActive: 1 }),
76
56
  (0, typegoose_1.index)({ messageCount: -1 }),
77
57
  (0, typegoose_1.index)({ 'participants.lastReadAt': 1 })
78
58
  ], Chatroom);
@@ -1 +1 @@
1
- {"version":3,"file":"chat-room.model.js","sourceRoot":"/","sources":["libraries/mongo/models/chat-room.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,iDAAwC;AACxC,+CAAsC;AACtC,8EAAoE;AACpE,kDAAuD;AAiBhD,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IAEvC,IAAI,CAAgB;IAGpB,YAAY,CAAqB;IAGjC,MAAM,CAAe;IAGrB,KAAK,CAAc;IAGnB,QAAQ,CAAW;IAGnB,aAAa,CAAQ;IAGrB,YAAY,CAAU;IAGtB,WAAW,CAAU;CACrB,CAAA;AAxBY,4BAAQ;AAEpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,mBAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACzB;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,wCAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACvB;AAGjC;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;wCACP;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;uCACR;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CACpB;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACL,IAAI;+CAAC;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACb;AAGtB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6CACd;mBAvBT,QAAQ;IAfpB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,WAAW;YACvB,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC/B,IAAA,iBAAK,EAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,CAAC;IACxD,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpB,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACnB,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5B,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzC,IAAA,iBAAK,EAAC,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,yBAAyB,EAAE,CAAC,EAAE,CAAC;GAC3B,QAAQ,CAwBpB","sourcesContent":["import { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Ticket } from './ticket.model';\nimport { Order } from './order.model';\nimport { ChatParticipant } from './embedded/chat-participant.model';\nimport { ChatroomType } from '../../../utilities/enum';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'chatrooms',\n\t\ttimestamps: true,\n\t},\n})\n@index({ type: 1, isActive: 1 })\n@index({ 'participants.ref': 1, 'participants.type': 1 })\n@index({ ticket: 1 })\n@index({ order: 1 })\n@index({ createdAt: -1 })\n@index({ lastMessageAt: -1 })\n@index({ lastMessageAt: -1, isActive: 1 })\n@index({ messageCount: -1 })\n@index({ 'participants.lastReadAt': 1 })\nexport class Chatroom extends TimeStamps {\n\t@prop({ enum: ChatroomType, required: true })\n\ttype!: ChatroomType;\n\n\t@prop({ type: () => [ChatParticipant], required: true })\n\tparticipants!: ChatParticipant[];\n\n\t@prop({ ref: () => Ticket })\n\tticket?: Ref<Ticket>;\n\n\t@prop({ ref: () => Order })\n\torder?: Ref<Order>; // For user-rider chats\n\n\t@prop({ type: Boolean, default: true })\n\tisActive?: boolean;\n\n\t@prop({ type: Date })\n\tlastMessageAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tmessageCount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tunreadCount?: number;\n}\n"]}
1
+ {"version":3,"file":"chat-room.model.js","sourceRoot":"/","sources":["libraries/mongo/models/chat-room.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiE;AACjE,4EAAqE;AACrE,8EAAoE;AACpE,kDAAuD;AAchD,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IAEvC,IAAI,CAAgB;IAGpB,YAAY,CAAqB;IAGjC,QAAQ,CAAW;IAGnB,aAAa,CAAQ;IAGrB,YAAY,CAAU;CACtB,CAAA;AAfY,4BAAQ;AAEpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,mBAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACzB;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,wCAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACvB;AAGjC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CACpB;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACL,IAAI;+CAAC;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACb;mBAdV,QAAQ;IAZpB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,WAAW;YACvB,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC/B,IAAA,iBAAK,EAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,CAAC;IACxD,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpB,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,yBAAyB,EAAE,CAAC,EAAE,CAAC;GAC3B,QAAQ,CAepB","sourcesContent":["import { prop, modelOptions, index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ChatParticipant } from './embedded/chat-participant.model';\nimport { ChatroomType } from '../../../utilities/enum';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'chatrooms',\n\t\ttimestamps: true,\n\t},\n})\n@index({ type: 1, isActive: 1 })\n@index({ 'participants.ref': 1, 'participants.type': 1 })\n@index({ ticket: 1 })\n@index({ createdAt: -1 })\n@index({ messageCount: -1 })\n@index({ 'participants.lastReadAt': 1 })\nexport class Chatroom extends TimeStamps {\n\t@prop({ enum: ChatroomType, required: true })\n\ttype!: ChatroomType;\n\n\t@prop({ type: () => [ChatParticipant], required: true })\n\tparticipants!: ChatParticipant[];\n\n\t@prop({ type: Boolean, default: true })\n\tisActive?: boolean;\n\n\t@prop({ type: Date })\n\tlastMessageAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tmessageCount?: number;\n}\n"]}
@@ -3,9 +3,10 @@ import { User } from '../user.model';
3
3
  import { Admin } from '../admin.model';
4
4
  import { Shop } from '../shop.model';
5
5
  import { Rider } from '../rider.model';
6
+ import { UserRef } from '../../../../utilities/enum';
6
7
  export declare class ChatParticipant {
7
8
  ref: Ref<User | Admin | Shop | Rider>;
8
- type: string;
9
+ type: UserRef;
9
10
  joinedAt?: Date;
10
11
  lastReadAt?: Date;
11
12
  isActive?: boolean;
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ChatParticipant = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
+ const enum_1 = require("../../../../utilities/enum");
14
15
  class ChatParticipant {
15
16
  ref;
16
17
  type;
@@ -25,7 +26,7 @@ __decorate([
25
26
  __metadata("design:type", Object)
26
27
  ], ChatParticipant.prototype, "ref", void 0);
27
28
  __decorate([
28
- (0, typegoose_1.prop)({ required: true, enum: ['User', 'Admin', 'Shop', 'Rider'] }),
29
+ (0, typegoose_1.prop)({ required: true, enum: enum_1.UserRef }),
29
30
  __metadata("design:type", String)
30
31
  ], ChatParticipant.prototype, "type", void 0);
31
32
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"chat-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/chat-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AAMjD,MAAa,eAAe;IAE3B,GAAG,CAAoC;IAGvC,IAAI,CAAU;IAGd,QAAQ,CAAQ;IAGhB,UAAU,CAAQ;IAGlB,QAAQ,CAAW;IAGnB,MAAM,CAAQ;CACd;AAlBD,0CAkBC;AAhBA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;;4CACH;AAGvC;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;;6CACrD;AAGd;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BACrC,IAAI;iDAAC;AAGhB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACR,IAAI;mDAAC;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACpB;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACZ,IAAI;+CAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { User } from '../user.model';\nimport { Admin } from '../admin.model';\nimport { Shop } from '../shop.model';\nimport { Rider } from '../rider.model';\n\nexport class ChatParticipant {\n\t@prop({ required: true, refPath: 'type' })\n\tref!: Ref<User | Admin | Shop | Rider>;\n\n\t@prop({ required: true, enum: ['User', 'Admin', 'Shop', 'Rider'] })\n\ttype!: string;\n\n\t@prop({ type: Date, default: () => new Date() })\n\tjoinedAt?: Date;\n\n\t@prop({ type: Date })\n\tlastReadAt?: Date;\n\n\t@prop({ type: Boolean, default: true })\n\tisActive?: boolean;\n\n\t@prop({ type: Date })\n\tleftAt?: Date;\n}\n"]}
1
+ {"version":3,"file":"chat-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/chat-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AAKjD,qDAAqD;AAErD,MAAa,eAAe;IAE3B,GAAG,CAAoC;IAGvC,IAAI,CAAW;IAGf,QAAQ,CAAQ;IAGhB,UAAU,CAAQ;IAGlB,QAAQ,CAAW;IAGnB,MAAM,CAAQ;CACd;AAlBD,0CAkBC;AAhBA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;;4CACH;AAGvC;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;6CACzB;AAGf;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BACrC,IAAI;iDAAC;AAGhB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACR,IAAI;mDAAC;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACpB;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACZ,IAAI;+CAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { User } from '../user.model';\nimport { Admin } from '../admin.model';\nimport { Shop } from '../shop.model';\nimport { Rider } from '../rider.model';\nimport { UserRef } from '../../../../utilities/enum';\n\nexport class ChatParticipant {\n\t@prop({ required: true, refPath: 'type' })\n\tref!: Ref<User | Admin | Shop | Rider>;\n\n\t@prop({ required: true, enum: UserRef })\n\ttype!: UserRef;\n\n\t@prop({ type: Date, default: () => new Date() })\n\tjoinedAt?: Date;\n\n\t@prop({ type: Date })\n\tlastReadAt?: Date;\n\n\t@prop({ type: Boolean, default: true })\n\tisActive?: boolean;\n\n\t@prop({ type: Date })\n\tleftAt?: Date;\n}\n"]}
@@ -3,16 +3,14 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { User } from './user.model';
4
4
  import { Admin } from './admin.model';
5
5
  import { Shop } from './shop.model';
6
- import { MessageSender } from '../../../utilities/enum';
6
+ import { UserRef } from '../../../utilities/enum';
7
7
  import { Rider } from './rider.model';
8
8
  import { Chatroom } from './chat-room.model';
9
9
  export declare class Message extends TimeStamps {
10
10
  chatroom: Ref<Chatroom>;
11
11
  content: string;
12
- senderType: MessageSender;
12
+ senderType: UserRef;
13
13
  sender: Ref<User | Admin | Shop | Rider>;
14
14
  isRead?: boolean;
15
15
  readAt?: Date;
16
- attachmentUrl?: string;
17
- messageType?: string;
18
16
  }
@@ -21,8 +21,6 @@ let Message = class Message extends defaultClasses_1.TimeStamps {
21
21
  sender;
22
22
  isRead;
23
23
  readAt;
24
- attachmentUrl;
25
- messageType;
26
24
  };
27
25
  exports.Message = Message;
28
26
  __decorate([
@@ -34,7 +32,7 @@ __decorate([
34
32
  __metadata("design:type", String)
35
33
  ], Message.prototype, "content", void 0);
36
34
  __decorate([
37
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.MessageSender }),
35
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.UserRef }),
38
36
  __metadata("design:type", String)
39
37
  ], Message.prototype, "senderType", void 0);
40
38
  __decorate([
@@ -49,14 +47,6 @@ __decorate([
49
47
  (0, typegoose_1.prop)({ type: Date }),
50
48
  __metadata("design:type", Date)
51
49
  ], Message.prototype, "readAt", void 0);
52
- __decorate([
53
- (0, typegoose_1.prop)({ type: String }),
54
- __metadata("design:type", String)
55
- ], Message.prototype, "attachmentUrl", void 0);
56
- __decorate([
57
- (0, typegoose_1.prop)({ type: String, enum: ['TEXT', 'IMAGE', 'FILE'] }),
58
- __metadata("design:type", String)
59
- ], Message.prototype, "messageType", void 0);
60
50
  exports.Message = Message = __decorate([
61
51
  (0, typegoose_1.modelOptions)({
62
52
  schemaOptions: {
@@ -1 +1 @@
1
- {"version":3,"file":"message.model.js","sourceRoot":"/","sources":["libraries/mongo/models/message.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AAIrE,kDAAwD;AAExD,uDAA6C;AAUtC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,QAAQ,CAAiB;IAGzB,OAAO,CAAU;IAGjB,UAAU,CAAiB;IAG3B,MAAM,CAAoC;IAG1C,MAAM,CAAW;IAGjB,MAAM,CAAQ;IAGd,aAAa,CAAU;IAGvB,WAAW,CAAU;CAC5B,CAAA;AAxBY,0BAAO;AAEZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;yCACd;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACf;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,CAAC;;2CAC1B;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;;uCACiB;AAG1C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;uCAChB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACL,IAAI;uCAAC;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACO;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;;4CAC5B;kBAvBhB,OAAO;IARnB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,UAAU;SACtB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACrC,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IACnC,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;GACrB,OAAO,CAwBnB","sourcesContent":["import { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Admin } from './admin.model';\nimport { Shop } from './shop.model';\nimport { MessageSender } from '../../../utilities/enum';\nimport { Rider } from './rider.model';\nimport { Chatroom } from './chat-room.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'messages',\n\t},\n})\n@index({ chatroom: 1, createdAt: -1 })\n@index({ sender: 1, senderType: 1 })\n@index({ isRead: 1, chatroom: 1 })\nexport class Message extends TimeStamps {\n\t@prop({ required: true, ref: () => Chatroom })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ required: true, type: String })\n\tpublic content!: string;\n\n\t@prop({ required: true, type: String, enum: MessageSender })\n\tpublic senderType!: MessageSender;\n\n\t@prop({ refPath: 'senderType' })\n\tpublic sender!: Ref<User | Admin | Shop | Rider>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRead?: boolean;\n\n\t@prop({ type: Date })\n\tpublic readAt?: Date;\n\n\t@prop({ type: String })\n\tpublic attachmentUrl?: string;\n\n\t@prop({ type: String, enum: ['TEXT', 'IMAGE', 'FILE'] })\n\tpublic messageType?: string;\n}\n"]}
1
+ {"version":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iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;GACrB,OAAO,CAkBnB","sourcesContent":["import { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Admin } from './admin.model';\nimport { Shop } from './shop.model';\nimport { UserRef } from '../../../utilities/enum';\nimport { Rider } from './rider.model';\nimport { Chatroom } from './chat-room.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'messages',\n\t},\n})\n@index({ chatroom: 1, createdAt: -1 })\n@index({ sender: 1, senderType: 1 })\n@index({ isRead: 1, chatroom: 1 })\nexport class Message extends TimeStamps {\n\t@prop({ required: true, ref: () => Chatroom })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ required: true, type: String })\n\tpublic content!: string;\n\n\t@prop({ required: true, type: String, enum: UserRef })\n\tpublic senderType!: UserRef;\n\n\t@prop({ refPath: 'senderType' })\n\tpublic sender!: Ref<User | Admin | Shop | Rider>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRead?: boolean;\n\n\t@prop({ type: Date })\n\tpublic readAt?: Date;\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { BaseReview } from './base/base-review.model';
3
3
  import { Shop } from './shop.model';
4
+ import { Parent } from './parent.model';
4
5
  export declare class ShopReview extends BaseReview {
5
6
  shop: Ref<Shop>;
7
+ parent: Ref<Parent>;
6
8
  }
@@ -13,14 +13,20 @@ exports.ShopReview = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const base_review_model_1 = require("./base/base-review.model");
15
15
  const shop_model_1 = require("./shop.model");
16
+ const parent_model_1 = require("./parent.model");
16
17
  let ShopReview = class ShopReview extends base_review_model_1.BaseReview {
17
18
  shop;
19
+ parent;
18
20
  };
19
21
  exports.ShopReview = ShopReview;
20
22
  __decorate([
21
23
  (0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop }),
22
24
  __metadata("design:type", Object)
23
25
  ], ShopReview.prototype, "shop", void 0);
26
+ __decorate([
27
+ (0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent }),
28
+ __metadata("design:type", Object)
29
+ ], ShopReview.prototype, "parent", void 0);
24
30
  exports.ShopReview = ShopReview = __decorate([
25
31
  (0, typegoose_1.Index)({ shop: 1 }),
26
32
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'shopReviews' } })
@@ -1 +1 @@
1
- {"version":3,"file":"shop-review.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop-review.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,gEAAsD;AACtD,6CAAoC;AAI7B,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAU;IAElC,IAAI,CAAa;CACxB,CAAA;AAHY,gCAAU;AAEf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;wCAClB;qBAFZ,UAAU;IAFtB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,CAAC;GAClD,UAAU,CAGtB","sourcesContent":["import { modelOptions, prop, Ref, Index } from '@typegoose/typegoose';\nimport { BaseReview } from './base/base-review.model';\nimport { Shop } from './shop.model';\n\n@Index({ shop: 1 })\n@modelOptions({ schemaOptions: { collection: 'shopReviews' } })\nexport class ShopReview extends BaseReview {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n}\n"]}
1
+ {"version":3,"file":"shop-review.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop-review.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,gEAAsD;AACtD,6CAAoC;AACpC,iDAAwC;AAIjC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAU;IAElC,IAAI,CAAa;IAGjB,MAAM,CAAe;CAC5B,CAAA;AANY,gCAAU;AAEf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;wCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;0CAChB;qBALhB,UAAU;IAFtB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,CAAC;GAClD,UAAU,CAMtB","sourcesContent":["import { modelOptions, prop, Ref, Index } from '@typegoose/typegoose';\nimport { BaseReview } from './base/base-review.model';\nimport { Shop } from './shop.model';\nimport { Parent } from './parent.model';\n\n@Index({ shop: 1 })\n@modelOptions({ schemaOptions: { collection: 'shopReviews' } })\nexport class ShopReview extends BaseReview {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent!: Ref<Parent>;\n}\n"]}
@@ -4,16 +4,14 @@ import { User } from './user.model';
4
4
  import { Shop } from './shop.model';
5
5
  import { Order } from './order.model';
6
6
  import { Admin } from './admin.model';
7
- import { TicketType, TicketStatus } from '../../../utilities/enum';
7
+ import { TicketType, TicketStatus, UserRef } from '../../../utilities/enum';
8
8
  import { Chatroom } from './chat-room.model';
9
9
  export declare class Ticket extends TimeStamps {
10
10
  ticketId: string;
11
11
  type: TicketType;
12
12
  status: TicketStatus;
13
13
  client: Ref<User | Shop>;
14
- clientType: string;
15
- subject: string;
16
- description?: string;
14
+ clientType: UserRef;
17
15
  order?: Ref<Order>;
18
16
  assignedAgent?: Ref<Admin>;
19
17
  assignedAt?: Date;
@@ -23,7 +21,5 @@ export declare class Ticket extends TimeStamps {
23
21
  closedAt?: Date;
24
22
  resolutionTimeMinutes?: number;
25
23
  customerRating?: number;
26
- customerFeedback?: string;
27
24
  agentScore?: number;
28
- tags?: string[];
29
25
  }
@@ -1,43 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23
7
  };
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
8
  var __metadata = (this && this.__metadata) || function (k, v) {
42
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
10
  };
@@ -55,8 +22,6 @@ let Ticket = class Ticket extends defaultClasses_1.TimeStamps {
55
22
  status;
56
23
  client;
57
24
  clientType;
58
- subject;
59
- description;
60
25
  order;
61
26
  assignedAgent;
62
27
  assignedAt;
@@ -66,9 +31,7 @@ let Ticket = class Ticket extends defaultClasses_1.TimeStamps {
66
31
  closedAt;
67
32
  resolutionTimeMinutes;
68
33
  customerRating;
69
- customerFeedback;
70
34
  agentScore;
71
- tags;
72
35
  };
73
36
  exports.Ticket = Ticket;
74
37
  __decorate([
@@ -88,17 +51,9 @@ __decorate([
88
51
  __metadata("design:type", Object)
89
52
  ], Ticket.prototype, "client", void 0);
90
53
  __decorate([
91
- (0, typegoose_1.prop)({ required: true, type: String, enum: ['User', 'Shop'] }),
54
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.UserRef }),
92
55
  __metadata("design:type", String)
93
56
  ], Ticket.prototype, "clientType", void 0);
94
- __decorate([
95
- (0, typegoose_1.prop)({ type: String, required: true }),
96
- __metadata("design:type", String)
97
- ], Ticket.prototype, "subject", void 0);
98
- __decorate([
99
- (0, typegoose_1.prop)({ type: String }),
100
- __metadata("design:type", String)
101
- ], Ticket.prototype, "description", void 0);
102
57
  __decorate([
103
58
  (0, typegoose_1.prop)({ ref: () => order_model_1.Order }),
104
59
  __metadata("design:type", Object)
@@ -135,33 +90,11 @@ __decorate([
135
90
  (0, typegoose_1.prop)({ type: Number, min: 1, max: 5 }),
136
91
  __metadata("design:type", Number)
137
92
  ], Ticket.prototype, "customerRating", void 0);
138
- __decorate([
139
- (0, typegoose_1.prop)({ type: String }),
140
- __metadata("design:type", String)
141
- ], Ticket.prototype, "customerFeedback", void 0);
142
93
  __decorate([
143
94
  (0, typegoose_1.prop)({ type: Number }),
144
95
  __metadata("design:type", Number)
145
96
  ], Ticket.prototype, "agentScore", void 0);
146
- __decorate([
147
- (0, typegoose_1.prop)({ type: [String], default: [] }),
148
- __metadata("design:type", Array)
149
- ], Ticket.prototype, "tags", void 0);
150
97
  exports.Ticket = Ticket = __decorate([
151
- (0, typegoose_1.pre)('save', async function (next) {
152
- if (this.isNew && !this.ticketId) {
153
- const { CounterModel } = await Promise.resolve().then(() => __importStar(require('.')));
154
- try {
155
- const counter = await CounterModel.findOneAndUpdate({ counterType: 'ticket' }, { $inc: { value: 1 } }, { new: true, upsert: true });
156
- const currentDate = new Date().toISOString().slice(0, 10).replace(/-/g, '');
157
- this.ticketId = `TKT-${currentDate}-${String(counter.value).padStart(4, '0')}`;
158
- }
159
- catch (error) {
160
- return next(error);
161
- }
162
- }
163
- next();
164
- }),
165
98
  (0, typegoose_1.modelOptions)({
166
99
  schemaOptions: {
167
100
  collection: 'tickets',
@@ -1 +1 @@
1
- {"version":3,"file":"ticket.model.js","sourceRoot":"/","sources":["libraries/mongo/models/ticket.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAiF;AACjF,4EAAqE;AAGrE,+CAAsC;AACtC,+CAAsC;AACtC,kDAAmE;AACnE,uDAA6C;AAgCtC,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,QAAQ,CAAU;IAGlB,IAAI,CAAc;IAGlB,MAAM,CAAgB;IAGtB,MAAM,CAAoB;IAG1B,UAAU,CAAU;IAGpB,OAAO,CAAU;IAGjB,WAAW,CAAU;IAGrB,KAAK,CAAc;IAGnB,aAAa,CAAc;IAG3B,UAAU,CAAQ;IAGlB,kBAAkB,CAAU;IAG5B,QAAQ,CAAiB;IAGzB,UAAU,CAAQ;IAGlB,Q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C,EAAE,EAAE,EACtB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAC3B,CAAC;gBAEF,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC5E,IAAI,CAAC,QAAQ,GAAG,OAAO,WAAW,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;YAChF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC1C,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9C,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;GACV,MAAM,CAyDlB","sourcesContent":["import { prop, Ref, index, modelOptions, pre, post } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Order } from './order.model';\nimport { Admin } from './admin.model';\nimport { TicketType, TicketStatus } from '../../../utilities/enum';\nimport { Chatroom } from './chat-room.model';\n\n@pre<Ticket>('save', async function (next) {\n\tif (this.isNew && !this.ticketId) {\n\t\tconst { CounterModel } = await import('.');\n\n\t\ttry {\n\t\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t\t{ counterType: 'ticket' },\n\t\t\t\t{ $inc: { value: 1 } },\n\t\t\t\t{ new: true, upsert: true }\n\t\t\t);\n\n\t\t\tconst currentDate = new Date().toISOString().slice(0, 10).replace(/-/g, '');\n\t\t\tthis.ticketId = `TKT-${currentDate}-${String(counter.value).padStart(4, '0')}`;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'tickets',\n\t\ttimestamps: true,\n\t},\n})\n@index({ assignedAgent: 1, status: 1 })\n@index({ type: 1, status: 1, priority: 1 })\n@index({ client: 1, clientType: 1, status: 1 })\n@index({ createdAt: -1 })\n@index({ chatroom: 1 })\nexport class Ticket extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic ticketId!: string;\n\n\t@prop({ required: true, type: String, enum: TicketType })\n\tpublic type!: TicketType;\n\n\t@prop({ required: true, type: String, enum: TicketStatus, default: TicketStatus.PENDING })\n\tpublic status!: TicketStatus;\n\n\t@prop({ refPath: 'clientType', required: true })\n\tpublic client!: Ref<User | Shop>;\n\n\t@prop({ required: true, type: String, enum: ['User', 'Shop'] })\n\tpublic clientType!: string;\n\n\t@prop({ type: String, required: true })\n\tpublic subject!: string;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n\n\t@prop({ ref: () => Order })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Admin })\n\tpublic assignedAgent?: Ref<Admin>;\n\n\t@prop({ type: Date })\n\tpublic assignedAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic assignmentAttempts?: number;\n\n\t@prop({ ref: () => Chatroom, required: true })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ type: Date })\n\tpublic resolvedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic closedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic resolutionTimeMinutes?: number;\n\n\t@prop({ type: Number, min: 1, max: 5 })\n\tpublic customerRating?: number;\n\n\t@prop({ type: String })\n\tpublic customerFeedback?: string;\n\n\t@prop({ type: Number })\n\tpublic agentScore?: number;\n\n\t@prop({ type: [String], default: [] })\n\tpublic tags?: string[];\n}\n"]}
1
+ {"version":3,"file":"ticket.model.js","sourceRoot":"/","sources":["libraries/mongo/models/ticket.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiF;AACjF,4EAAqE;AAGrE,+CAAsC;AACtC,+CAAsC;AACtC,kDAA4E;AAC5E,uDAA6C;AAatC,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,QAAQ,CAAU;IAGlB,IAAI,CAAc;IAGlB,MAAM,CAAgB;IAGtB,MAAM,CAAoB;IAG1B,UAAU,CAAW;IAGrB,KAAK,CAAc;IAGnB,aAAa,CAAc;IAG3B,UAAU,CAAQ;IAGlB,kBAAkB,CAAU;IAG5B,QAAQ,CAAiB;IAGzB,UAAU,CAAQ;IAGlB,QAAQ,CAAQ;IAGhB,qBAAqB,CAAU;IAG/B,cAAc,CAAU;IAGxB,UAAU,CAAU;CAC3B,CAAA;AA7CY,wBAAM;AAEX;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;wCAC5B;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAU,EAAE,CAAC;;oCAChC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAA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EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACI;iBA5Cf,MAAM;IAXlB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC1C,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9C,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;GACV,MAAM,CA6ClB","sourcesContent":["import { prop, Ref, index, modelOptions, pre, post } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Order } from './order.model';\nimport { Admin } from './admin.model';\nimport { TicketType, TicketStatus, UserRef } from '../../../utilities/enum';\nimport { Chatroom } from './chat-room.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'tickets',\n\t\ttimestamps: true,\n\t},\n})\n@index({ assignedAgent: 1, status: 1 })\n@index({ type: 1, status: 1, priority: 1 })\n@index({ client: 1, clientType: 1, status: 1 })\n@index({ createdAt: -1 })\n@index({ chatroom: 1 })\nexport class Ticket extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic ticketId!: string;\n\n\t@prop({ required: true, type: String, enum: TicketType })\n\tpublic type!: TicketType;\n\n\t@prop({ required: true, type: String, enum: TicketStatus, default: TicketStatus.PENDING })\n\tpublic status!: TicketStatus;\n\n\t@prop({ refPath: 'clientType', required: true })\n\tpublic client!: Ref<User | Shop>;\n\n\t@prop({ required: true, type: String, enum: UserRef })\n\tpublic clientType!: UserRef;\n\n\t@prop({ ref: () => Order })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Admin })\n\tpublic assignedAgent?: Ref<Admin>;\n\n\t@prop({ type: Date })\n\tpublic assignedAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic assignmentAttempts?: number;\n\n\t@prop({ ref: () => Chatroom, required: true })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ type: Date })\n\tpublic resolvedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic closedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic resolutionTimeMinutes?: number;\n\n\t@prop({ type: Number, min: 1, max: 5 })\n\tpublic customerRating?: number;\n\n\t@prop({ type: Number })\n\tpublic agentScore?: number;\n}\n"]}
@@ -18,7 +18,9 @@ const typedi_1 = require("typedi");
18
18
  let RedisService = class RedisService {
19
19
  _redisClient;
20
20
  constructor(redisURL) {
21
- this._redisClient = new ioredis_1.default(redisURL);
21
+ this._redisClient = new ioredis_1.default(redisURL, {
22
+ maxRetriesPerRequest: null,
23
+ });
22
24
  }
23
25
  get redisClient() {
24
26
  return this._redisClient;