@lyxa.ai/core 1.0.20 → 1.0.21

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 (132) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/libraries/mongo/models/base/base-coupon.model.js.map +1 -1
  3. package/dist/libraries/mongo/models/cart-lineitem.model.d.ts +29 -0
  4. package/dist/libraries/mongo/models/cart-lineitem.model.js +120 -0
  5. package/dist/libraries/mongo/models/cart-lineitem.model.js.map +1 -0
  6. package/dist/libraries/mongo/models/cart-participant.model.d.ts +2 -2
  7. package/dist/libraries/mongo/models/cart-participant.model.js +2 -2
  8. package/dist/libraries/mongo/models/cart-participant.model.js.map +1 -1
  9. package/dist/libraries/mongo/models/cart-perticipant.model.d.ts +22 -0
  10. package/dist/libraries/mongo/models/cart-perticipant.model.js +104 -0
  11. package/dist/libraries/mongo/models/cart-perticipant.model.js.map +1 -0
  12. package/dist/libraries/mongo/models/cart.model.d.ts +5 -7
  13. package/dist/libraries/mongo/models/cart.model.js +13 -29
  14. package/dist/libraries/mongo/models/cart.model.js.map +1 -1
  15. package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
  16. package/dist/libraries/mongo/models/embedded/attribute-map.model.js.map +1 -1
  17. package/dist/libraries/mongo/models/embedded/business-development-setting.model.js.map +1 -1
  18. package/dist/libraries/mongo/models/embedded/charge-setting.model.js.map +1 -1
  19. package/dist/libraries/mongo/models/embedded/charge.model.js.map +1 -1
  20. package/dist/libraries/mongo/models/embedded/courier-setting.model.js.map +1 -1
  21. package/dist/libraries/mongo/models/embedded/currency-setting.model.js.map +1 -1
  22. package/dist/libraries/mongo/models/embedded/currency.model.js.map +1 -1
  23. package/dist/libraries/mongo/models/embedded/featured-item.mode.js.map +1 -1
  24. package/dist/libraries/mongo/models/embedded/line-item-attribute.model.d.ts +7 -0
  25. package/dist/libraries/mongo/models/{shop-review.js → embedded/line-item-attribute.model.js} +15 -14
  26. package/dist/libraries/mongo/models/embedded/line-item-attribute.model.js.map +1 -0
  27. package/dist/libraries/mongo/models/embedded/order-cancel.model.d.ts +7 -0
  28. package/dist/libraries/mongo/models/{providers/google-auth-identity.model.js → embedded/order-cancel.model.js} +18 -9
  29. package/dist/libraries/mongo/models/embedded/order-cancel.model.js.map +1 -0
  30. package/dist/libraries/mongo/models/embedded/order-pricing.model.d.ts +18 -0
  31. package/dist/libraries/mongo/models/embedded/order-pricing.model.js +97 -0
  32. package/dist/libraries/mongo/models/embedded/order-pricing.model.js.map +1 -0
  33. package/dist/libraries/mongo/models/embedded/otp-fields.model.js.map +1 -1
  34. package/dist/libraries/mongo/models/embedded/package.model.js.map +1 -1
  35. package/dist/libraries/mongo/models/embedded/parent-document.model.js.map +1 -1
  36. package/dist/libraries/mongo/models/embedded/payment-attempt.model.d.ts +10 -0
  37. package/dist/libraries/mongo/models/embedded/payment-attempt.model.js +60 -0
  38. package/dist/libraries/mongo/models/embedded/payment-attempt.model.js.map +1 -0
  39. package/dist/libraries/mongo/models/embedded/payment-details.model.d.ts +9 -0
  40. package/dist/libraries/mongo/models/embedded/payment-details.model.js +52 -0
  41. package/dist/libraries/mongo/models/embedded/payment-details.model.js.map +1 -0
  42. package/dist/libraries/mongo/models/embedded/payment-infromation.model.d.ts +1 -0
  43. package/dist/libraries/mongo/models/embedded/payment-infromation.model.js +5 -0
  44. package/dist/libraries/mongo/models/embedded/payment-infromation.model.js.map +1 -1
  45. package/dist/libraries/mongo/models/embedded/payout-setting.model.js.map +1 -1
  46. package/dist/libraries/mongo/models/embedded/price.model.js.map +1 -1
  47. package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
  48. package/dist/libraries/mongo/models/embedded/referral-discount-config.model.js.map +1 -1
  49. package/dist/libraries/mongo/models/embedded/rider-setting.model.js.map +1 -1
  50. package/dist/libraries/mongo/models/embedded/service-fee-setting.model.js.map +1 -1
  51. package/dist/libraries/mongo/models/embedded/shop-document.model.js.map +1 -1
  52. package/dist/libraries/mongo/models/embedded/status-timeline.model.d.ts +14 -0
  53. package/dist/libraries/mongo/models/embedded/status-timeline.model.js +59 -0
  54. package/dist/libraries/mongo/models/embedded/status-timeline.model.js.map +1 -0
  55. package/dist/libraries/mongo/models/embedded/subscription-summary.model.js.map +1 -1
  56. package/dist/libraries/mongo/models/line-item.model.d.ts +9 -8
  57. package/dist/libraries/mongo/models/line-item.model.js +17 -16
  58. package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
  59. package/dist/libraries/mongo/models/order-delivery.model.d.ts +24 -0
  60. package/dist/libraries/mongo/models/order-delivery.model.js +119 -0
  61. package/dist/libraries/mongo/models/order-delivery.model.js.map +1 -0
  62. package/dist/libraries/mongo/models/order-payment.model.d.ts +21 -0
  63. package/dist/libraries/mongo/models/order-payment.model.js +96 -0
  64. package/dist/libraries/mongo/models/order-payment.model.js.map +1 -0
  65. package/dist/libraries/mongo/models/order-pricing.model.d.ts +18 -0
  66. package/dist/libraries/mongo/models/order-pricing.model.js +88 -0
  67. package/dist/libraries/mongo/models/order-pricing.model.js.map +1 -0
  68. package/dist/libraries/mongo/models/order.model.d.ts +15 -0
  69. package/dist/libraries/mongo/models/order.model.js +60 -7
  70. package/dist/libraries/mongo/models/order.model.js.map +1 -1
  71. package/dist/libraries/mongo/models/payout.model.js.map +1 -1
  72. package/dist/libraries/mongo/models/providers/courier-order.model.d.ts +23 -0
  73. package/dist/libraries/mongo/models/providers/courier-order.model.js +89 -0
  74. package/dist/libraries/mongo/models/providers/courier-order.model.js.map +1 -0
  75. package/dist/libraries/mongo/models/providers/regular-order.model.d.ts +23 -0
  76. package/dist/libraries/mongo/models/providers/regular-order.model.js +85 -0
  77. package/dist/libraries/mongo/models/providers/regular-order.model.js.map +1 -0
  78. package/dist/libraries/mongo/models/rating-setting.model.d.ts +1 -0
  79. package/dist/libraries/mongo/models/rating-setting.model.js +11 -2
  80. package/dist/libraries/mongo/models/rating-setting.model.js.map +1 -1
  81. package/dist/libraries/mongo/models/shared/address.model.d.ts +4 -0
  82. package/dist/libraries/mongo/models/shared/address.model.js +14 -1
  83. package/dist/libraries/mongo/models/shared/address.model.js.map +1 -1
  84. package/dist/libraries/mongo/models/shared/duration.model.js.map +1 -1
  85. package/dist/libraries/mongo/models/shop.model.d.ts +1 -1
  86. package/dist/libraries/mongo/models/shop.model.js +2 -2
  87. package/dist/libraries/mongo/models/shop.model.js.map +1 -1
  88. package/dist/libraries/mongo/models/transaction.model.js.map +1 -1
  89. package/dist/utilities/enum.d.ts +51 -5
  90. package/dist/utilities/enum.js +57 -4
  91. package/dist/utilities/enum.js.map +1 -1
  92. package/dist/utilities/pagination.d.ts +4 -2
  93. package/dist/utilities/pagination.js +42 -5
  94. package/dist/utilities/pagination.js.map +1 -1
  95. package/dist/utilities/transformers.d.ts +1 -1
  96. package/dist/utilities/transformers.js +0 -12
  97. package/dist/utilities/transformers.js.map +1 -1
  98. package/dist/utilities/validation/common-validation.d.ts +182 -64
  99. package/dist/utilities/validation/common-validation.js +24 -13
  100. package/dist/utilities/validation/common-validation.js.map +1 -1
  101. package/dist/utilities/validation/global-validation.d.ts +40 -20
  102. package/dist/utilities/validation/global-validation.js +5 -3
  103. package/dist/utilities/validation/global-validation.js.map +1 -1
  104. package/package.json +1 -1
  105. package/dist/libraries/mongo/models/areeba-card.model.d.ts +0 -17
  106. package/dist/libraries/mongo/models/areeba-card.model.js +0 -73
  107. package/dist/libraries/mongo/models/areeba-card.model.js.map +0 -1
  108. package/dist/libraries/mongo/models/auth-identity.model.d.ts +0 -8
  109. package/dist/libraries/mongo/models/auth-identity.model.js +0 -33
  110. package/dist/libraries/mongo/models/auth-identity.model.js.map +0 -1
  111. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +0 -6
  112. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js +0 -25
  113. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +0 -1
  114. package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +0 -9
  115. package/dist/libraries/mongo/models/providers/email-auth-identity.model.js +0 -36
  116. package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +0 -1
  117. package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +0 -6
  118. package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +0 -1
  119. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +0 -8
  120. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js +0 -31
  121. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +0 -1
  122. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.d.ts +0 -10
  123. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js +0 -28
  124. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +0 -1
  125. package/dist/libraries/mongo/models/role.model.ts.d.ts +0 -8
  126. package/dist/libraries/mongo/models/role.model.ts.js +0 -37
  127. package/dist/libraries/mongo/models/role.model.ts.js.map +0 -1
  128. package/dist/libraries/mongo/models/shop-review.d.ts +0 -7
  129. package/dist/libraries/mongo/models/shop-review.js.map +0 -1
  130. package/dist/libraries/mongo/models/zone.model..d.ts +0 -15
  131. package/dist/libraries/mongo/models/zone.model..js +0 -64
  132. package/dist/libraries/mongo/models/zone.model..js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;AAoBA,sCAyBC;AAED,8CAyDC;AAED,oCAEC;AA5GD,2CAA2C;AAC3C,mCAAiC;AACjC,wDAAgC;AAChC,6DAAqF;AACrF,+GAA0G;AAC1G,+CAA8C;AAC9C,6CAA+C;AAC/C,6CAAuD;AACvD,iDAAyD;AACzD,uDAA8D;AAC9D,+CAAiD;AACjD,mDAAqD;AACrD,6CAAiE;AACjE,0FAAqF;AAIrF,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAA4G;AAAnG,6GAAA,oBAAoB,OAA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AGtE,MAAM,qBAAqB,GAAG,IAAI,sBAAa,EAAE,CAAC;IAClD,kBAAS,CAAC,GAAG,CAAC,sBAAa,EAAE,qBAAqB,CAAC,CAAC;IAEpD,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":["import {LibraryManager} from './libraries';\r\nimport {Container} from 'typedi';\r\nimport mongoose from 'mongoose';\r\nimport {ConfigurationOptions, ConfigurationService} from './libraries/configuration';\r\nimport {EnvironmentConfigurationType} from './libraries/configuration/types/EnvironmentConfigurationType';\r\nimport {LyxaLogger} from './libraries/logger';\r\nimport {RedisService} from './libraries/redis';\r\nimport {initGlobalConnection} from './libraries/mongo';\r\nimport {SecretManagerService} from './libraries/secrets';\r\nimport {MicroServiceDispatcher} from './libraries/dispatcher';\r\nimport {TwilioService} from './libraries/twilio';\r\nimport {FirebaseService} from './libraries/firebase';\r\nimport {initEventBus, subscribeToEvent} from './libraries/event';\r\nimport {SubscriptionRegistry} from './libraries/event/registry/SubscriptionRegistry';\r\nimport {ShopModel} from \"./libraries/mongo/models\";\r\n\r\nexport { ConfigurationOptions } from './libraries/configuration';\r\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\r\nexport { initGlobalConnection, createGlobalModel, createGlobalDiscriminatorModel } from './libraries/mongo';\r\n\r\nexport async function bootstrapCore(options?: ConfigurationOptions) {\r\n\ttry {\r\n\t\tawait registerLibraries(options);\r\n\r\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\r\n\r\n\t\tconst gracefulShutdown = async () => {\r\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\r\n\t\t\tprocess.exit()\r\n\t\t};\r\n\r\n\t\tprocess.on('SIGTERM', gracefulShutdown);\r\n\t\tprocess.on('SIGINT', gracefulShutdown);\r\n\t\tprocess.on('uncaughtException', err => {\r\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\r\n\t\t\tgracefulShutdown();\r\n\t\t});\r\n\t\tprocess.on('exit', (code) => {\r\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\r\n\t\t});\r\n\r\n\t\tconsole.log('Created hooks.');\r\n\t} catch (e) {\r\n\t\tconsole.error(e);\r\n\t}\r\n}\r\n\r\nexport async function registerLibraries(options?: ConfigurationOptions) {\r\n\t// Setup configuration.\r\n\tconst configurationInstance = new ConfigurationService(options);\r\n\tContainer.set(ConfigurationService, configurationInstance);\r\n\r\n\t// Setup redis.\r\n\tconst redisInstance = new RedisService(configurationInstance.options.redisURL!);\r\n\tContainer.set(RedisService, redisInstance);\r\n\r\n\t// Setup secret\r\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\r\n\tContainer.set(SecretManagerService, secretInstance);\r\n\r\n\tconst mongoUrl = await getLibraries().getSecretsService().getKey('MONGO_URL');\r\n\r\n\tawait mongoose.connect(mongoUrl!, { dbName: `lyxa-${options!.environment}-${options!.tenet}` });\r\n\tmongoose.set(\r\n\t\t'debug',\r\n\t\tgetLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\r\n\t);\r\n\r\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\r\n\r\n\t// Setup logger\r\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\r\n\tContainer.set(LyxaLogger, loggerInstance);\r\n\r\n\t// Setup firebase\r\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\r\n\tContainer.set(FirebaseService, firebaseInstance);\r\n\r\n\t// Setup microservice dispatcher\r\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\r\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\r\n\r\n\t// Setup twilio\r\n\tconst twilioServiceInstance = new TwilioService();\r\n\tContainer.set(TwilioService, twilioServiceInstance);\r\n\r\n\tconsole.log('Initialized everything');\r\n\r\n\tawait initEventBus('amqps://vgyuplrd:wto6vUYnb4zeBI5lntKT4gj7rT8n1vwg@dog.lmq.cloudamqp.com/vgyuplrd');\r\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\r\n\r\n\tconst instantiatedServices = new Map<Function, any>();\r\n\r\n\tfor (const { eventId, targetConstructor, methodName } of allSubscriptions) {\r\n\t\tlet instance = instantiatedServices.get(targetConstructor);\r\n\t\tif (!instance) {\r\n\t\t\tinstance = Container.get(targetConstructor as any);\r\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\r\n\t\t}\r\n\r\n\t\tawait subscribeToEvent(eventId, async payload => {\r\n\t\t\treturn instance[methodName](payload);\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function getLibraries(): LibraryManager {\r\n\treturn Container.get(LibraryManager);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tC,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { LibraryManager } from './libraries';\r\nimport { Container } from 'typedi';\r\nimport mongoose from 'mongoose';\r\nimport { ConfigurationOptions, ConfigurationService } from './libraries/configuration';\r\nimport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\r\nimport { LyxaLogger } from './libraries/logger';\r\nimport { RedisService } from './libraries/redis';\r\nimport { initGlobalConnection } from './libraries/mongo';\r\nimport { SecretManagerService } from './libraries/secrets';\r\nimport { MicroServiceDispatcher } from './libraries/dispatcher';\r\nimport { TwilioService } from './libraries/twilio';\r\nimport { FirebaseService } from './libraries/firebase';\r\nimport { initEventBus, subscribeToEvent } from './libraries/event';\r\nimport { SubscriptionRegistry } from './libraries/event/registry/SubscriptionRegistry';\r\nimport { AuthEntityType, signTokenPair } from './libraries/auth';\r\n\r\nexport { ConfigurationOptions } from './libraries/configuration';\r\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\r\nexport { initGlobalConnection, createGlobalModel, createGlobalDiscriminatorModel } from './libraries/mongo';\r\n\r\nexport async function bootstrapCore(options?: ConfigurationOptions) {\r\n\ttry {\r\n\t\tawait registerLibraries(options);\r\n\r\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\r\n\r\n\t\tconst gracefulShutdown = async () => {\r\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\r\n\t\t\tprocess.exit()\r\n\t\t};\r\n\r\n\t\tprocess.on('SIGTERM', gracefulShutdown);\r\n\t\tprocess.on('SIGINT', gracefulShutdown);\r\n\t\tprocess.on('uncaughtException', err => {\r\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\r\n\t\t\tgracefulShutdown();\r\n\t\t});\r\n\t\tprocess.on('exit', (code) => {\r\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\r\n\t\t});\r\n\r\n\t\tconsole.log('Created hooks.');\r\n\t} catch (e) {\r\n\t\tconsole.error(e);\r\n\t}\r\n}\r\n\r\nexport async function registerLibraries(options?: ConfigurationOptions) {\r\n\t// Setup configuration.\r\n\tconst configurationInstance = new ConfigurationService(options);\r\n\tContainer.set(ConfigurationService, configurationInstance);\r\n\r\n\t// Setup redis.\r\n\tconst redisInstance = new RedisService(configurationInstance.options.redisURL!);\r\n\tContainer.set(RedisService, redisInstance);\r\n\r\n\t// Setup secret\r\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\r\n\tContainer.set(SecretManagerService, secretInstance);\r\n\r\n\tconst mongoUrl = await getLibraries().getSecretsService().getKey('MONGO_URL');\r\n\r\n\tawait mongoose.connect(mongoUrl!, { dbName: `lyxa-${options!.environment}-${options!.tenet}` });\r\n\tmongoose.set(\r\n\t\t'debug',\r\n\t\tgetLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\r\n\t);\r\n\r\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\r\n\r\n\t// Setup logger\r\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\r\n\tContainer.set(LyxaLogger, loggerInstance);\r\n\r\n\t// Setup firebase\r\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\r\n\tContainer.set(FirebaseService, firebaseInstance);\r\n\r\n\t// Setup microservice dispatcher\r\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\r\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\r\n\r\n\t// Setup twilio\r\n\tconst twilioServiceInstance = new TwilioService();\r\n\tContainer.set(TwilioService, twilioServiceInstance);\r\n\r\n\tconsole.log('Initialized everything');\r\n\r\n\tawait initEventBus('amqps://vgyuplrd:wto6vUYnb4zeBI5lntKT4gj7rT8n1vwg@dog.lmq.cloudamqp.com/vgyuplrd');\r\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\r\n\r\n\tconst instantiatedServices = new Map<Function, any>();\r\n\r\n\tfor (const { eventId, targetConstructor, methodName } of allSubscriptions) {\r\n\t\tlet instance = instantiatedServices.get(targetConstructor);\r\n\t\tif (!instance) {\r\n\t\t\tinstance = Container.get(targetConstructor as any);\r\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\r\n\t\t}\r\n\r\n\t\tawait subscribeToEvent(eventId, async payload => {\r\n\t\t\treturn instance[methodName](payload);\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function getLibraries(): LibraryManager {\r\n\treturn Container.get(LibraryManager);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"base-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/base/base-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuF;AACvF,6DAAoD;AACpD,kDAAyC;AAEzC,MAAa,UAAW,SAAQ,qBAAM;IAE9B,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,gBAAgB,CAAiB;IAGjC,QAAQ,CAAY;IAGpB,UAAU,CAAiB;IAG3B,eAAe,CAAiB;IAGhC,aAAa,CAAiB;IAG9B,cAAc,CAAW;IAGzB,MAAM,CAAU;IAGhB,gBAAgB,CAA0B;CACjD;AA9BD,gCA8BC;AA5BO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;6CAC3B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oDACE;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACvB,yBAAQ;4CAAC;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CACJ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDACC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACD;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kDACR;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;0CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAAsB,EAAE,CAAC;;oDACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { CouponExpirationReason, Status, ValueType } from '../../../../utilities/enum';\r\nimport { Duration } from '../shared/duration.model';\r\nimport { Coupon } from '../coupon.model';\r\n\r\nexport class BaseCoupon extends Coupon {\r\n\t@prop({ required: true, type: String, enum: ValueType })\r\n\tpublic valueType!: ValueType;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic value!: number;\r\n\r\n\t@prop({ type: Number, default: null }) // applicable when valueType percentage\r\n\tpublic maxDiscountLimit?: number | null;\r\n\r\n\t@prop({ required: true, type: Duration })\r\n\tpublic duration!: Duration;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic spendLimit?: number | null;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic totalOrderLimit?: number | null;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic minOrderValue?: number | null;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic forNewUserOnly?: boolean;\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ type: String, enum: CouponExpirationReason })\r\n\tpublic expirationReason?: CouponExpirationReason;\r\n}\r\n"]}
1
+ {"version":3,"file":"base-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/base/base-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuF;AACvF,6DAAoD;AACpD,kDAAyC;AAEzC,MAAa,UAAW,SAAQ,qBAAM;IAE9B,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,gBAAgB,CAAiB;IAGjC,QAAQ,CAAY;IAGpB,UAAU,CAAiB;IAG3B,eAAe,CAAiB;IAGhC,aAAa,CAAiB;IAG9B,cAAc,CAAW;IAGzB,MAAM,CAAU;IAGhB,gBAAgB,CAA0B;CACjD;AA9BD,gCA8BC;AA5BO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;6CAC3B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oDACE;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACvB,yBAAQ;4CAAC;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CACJ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDACC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACD;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kDACR;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;0CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAAsB,EAAE,CAAC;;oDACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { CouponExpirationReason, Status, ValueType } from '../../../../utilities/enum';\nimport { Duration } from '../shared/duration.model';\nimport { Coupon } from '../coupon.model';\n\nexport class BaseCoupon extends Coupon {\n\t@prop({ required: true, type: String, enum: ValueType })\n\tpublic valueType!: ValueType;\n\n\t@prop({ required: true, type: Number })\n\tpublic value!: number;\n\n\t@prop({ type: Number, default: null }) // applicable when valueType percentage\n\tpublic maxDiscountLimit?: number | null;\n\n\t@prop({ required: true, type: Duration })\n\tpublic duration!: Duration;\n\n\t@prop({ type: Number, default: null })\n\tpublic spendLimit?: number | null;\n\n\t@prop({ type: Number, default: null })\n\tpublic totalOrderLimit?: number | null;\n\n\t@prop({ type: Number, default: null })\n\tpublic minOrderValue?: number | null;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic forNewUserOnly?: boolean;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: String, enum: CouponExpirationReason })\n\tpublic expirationReason?: CouponExpirationReason;\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
+ import { CoreUser } from './core-user.model';
3
+ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
4
+ import { Cart } from './cart.model';
5
+ import { Product } from './product.model';
6
+ import { Attribute } from './attribute.model';
7
+ import { AttributeItem } from './embedded/attribute-item.model';
8
+ export declare class Portion {
9
+ price: number;
10
+ size?: string;
11
+ unit?: string;
12
+ }
13
+ export declare class AddOn {
14
+ attribute: Ref<Attribute>;
15
+ attributeItem: AttributeItem;
16
+ price: number;
17
+ }
18
+ export declare class LineItem extends TimeStamps {
19
+ cart: Ref<Cart>;
20
+ user?: Ref<CoreUser>;
21
+ product: Ref<Product>;
22
+ quantity: number;
23
+ unitPrice: number;
24
+ portion?: Portion;
25
+ addOns?: AddOn[];
26
+ removedIngredients?: string[];
27
+ specialInstructions?: string;
28
+ }
29
+ export declare const LineItemModel: ReturnModelType<typeof LineItem>;
@@ -0,0 +1,120 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LineItemModel = exports.LineItem = exports.AddOn = exports.Portion = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const core_user_model_1 = require("./core-user.model");
15
+ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
16
+ const cart_model_1 = require("./cart.model");
17
+ const product_model_1 = require("./product.model");
18
+ const attribute_model_1 = require("./attribute.model");
19
+ const attribute_item_model_1 = require("./embedded/attribute-item.model");
20
+ class Portion {
21
+ price;
22
+ size;
23
+ unit;
24
+ }
25
+ exports.Portion = Portion;
26
+ __decorate([
27
+ (0, typegoose_1.prop)({ required: true }),
28
+ __metadata("design:type", Number)
29
+ ], Portion.prototype, "price", void 0);
30
+ __decorate([
31
+ (0, typegoose_1.prop)(),
32
+ __metadata("design:type", String)
33
+ ], Portion.prototype, "size", void 0);
34
+ __decorate([
35
+ (0, typegoose_1.prop)(),
36
+ __metadata("design:type", String)
37
+ ], Portion.prototype, "unit", void 0);
38
+ class AddOn {
39
+ attribute;
40
+ attributeItem;
41
+ price;
42
+ }
43
+ exports.AddOn = AddOn;
44
+ __decorate([
45
+ (0, typegoose_1.prop)({ required: true, ref: () => attribute_model_1.Attribute }),
46
+ __metadata("design:type", Object)
47
+ ], AddOn.prototype, "attribute", void 0);
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ required: true }),
50
+ __metadata("design:type", attribute_item_model_1.AttributeItem)
51
+ ], AddOn.prototype, "attributeItem", void 0);
52
+ __decorate([
53
+ (0, typegoose_1.prop)({ required: true, default: 0 }),
54
+ __metadata("design:type", Number)
55
+ ], AddOn.prototype, "price", void 0);
56
+ let LineItem = class LineItem extends defaultClasses_1.TimeStamps {
57
+ cart;
58
+ user;
59
+ product;
60
+ quantity;
61
+ unitPrice;
62
+ portion;
63
+ addOns;
64
+ removedIngredients;
65
+ specialInstructions;
66
+ };
67
+ exports.LineItem = LineItem;
68
+ __decorate([
69
+ (0, typegoose_1.prop)({ required: true, ref: () => cart_model_1.Cart }),
70
+ __metadata("design:type", Object)
71
+ ], LineItem.prototype, "cart", void 0);
72
+ __decorate([
73
+ (0, typegoose_1.prop)({ required: false, ref: () => core_user_model_1.CoreUser }),
74
+ __metadata("design:type", Object)
75
+ ], LineItem.prototype, "user", void 0);
76
+ __decorate([
77
+ (0, typegoose_1.prop)({ required: true, ref: () => product_model_1.Product }),
78
+ __metadata("design:type", Object)
79
+ ], LineItem.prototype, "product", void 0);
80
+ __decorate([
81
+ (0, typegoose_1.prop)({ required: true, min: 1, default: 1 }),
82
+ __metadata("design:type", Number)
83
+ ], LineItem.prototype, "quantity", void 0);
84
+ __decorate([
85
+ (0, typegoose_1.prop)(),
86
+ __metadata("design:type", Number)
87
+ ], LineItem.prototype, "unitPrice", void 0);
88
+ __decorate([
89
+ (0, typegoose_1.prop)({ type: () => Portion }),
90
+ __metadata("design:type", Portion)
91
+ ], LineItem.prototype, "portion", void 0);
92
+ __decorate([
93
+ (0, typegoose_1.prop)({ type: () => [AddOn], default: [] }),
94
+ __metadata("design:type", Array)
95
+ ], LineItem.prototype, "addOns", void 0);
96
+ __decorate([
97
+ (0, typegoose_1.prop)({ type: () => [String], default: [] }),
98
+ __metadata("design:type", Array)
99
+ ], LineItem.prototype, "removedIngredients", void 0);
100
+ __decorate([
101
+ (0, typegoose_1.prop)(),
102
+ __metadata("design:type", String)
103
+ ], LineItem.prototype, "specialInstructions", void 0);
104
+ exports.LineItem = LineItem = __decorate([
105
+ (0, typegoose_1.modelOptions)({
106
+ schemaOptions: {
107
+ collection: 'lineItems',
108
+ toJSON: { virtuals: true },
109
+ toObject: { virtuals: true },
110
+ },
111
+ options: {
112
+ allowMixed: typegoose_1.Severity.ALLOW,
113
+ },
114
+ }),
115
+ (0, typegoose_1.index)({ cart: 1 }),
116
+ (0, typegoose_1.index)({ cart: 1, user: 1 }),
117
+ (0, typegoose_1.index)({ product: 1 })
118
+ ], LineItem);
119
+ exports.LineItemModel = (0, typegoose_1.getModelForClass)(LineItem);
120
+ //# sourceMappingURL=cart-lineitem.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-lineitem.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-lineitem.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,uDAA6C;AAC7C,4EAAqE;AACrE,6CAAoC;AACpC,mDAA0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,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { CoreUser } from './core-user.model';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { Product } from './product.model';\r\nimport { Attribute } from './attribute.model';\r\nimport { AttributeItem } from './embedded/attribute-item.model';\r\n\r\nexport class Portion {\r\n\t@prop({ required: true })\r\n\tpublic price!: number;\r\n\r\n\t@prop()\r\n\tpublic size?: string;\r\n\r\n\t@prop()\r\n\tpublic unit?: string;\r\n}\r\n\r\nexport class AddOn {\r\n\t@prop({ required: true, ref: () => Attribute })\r\n\tpublic attribute!: Ref<Attribute>;\r\n\r\n\t@prop({ required: true })\r\n\tpublic attributeItem!: AttributeItem;\r\n\r\n\t@prop({ required: true, default: 0 })\r\n\tpublic price!: number;\r\n}\r\n\r\n/**\r\n * LineItem model - Represents individual items in a cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'lineItems',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1 })\r\n@index({ cart: 1, user: 1 })\r\n@index({ product: 1 })\r\nexport class LineItem extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: false, ref: () => CoreUser })\r\n\tpublic user?: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, ref: () => Product })\r\n\tpublic product!: Ref<Product>;\r\n\r\n\t@prop({ required: true, min: 1, default: 1 })\r\n\tpublic quantity!: number;\r\n\r\n\t@prop()\r\n\tpublic unitPrice!: number;\r\n\r\n\t@prop({ type: () => Portion })\r\n\tpublic portion?: Portion;\r\n\r\n\t@prop({ type: () => [AddOn], default: [] })\r\n\tpublic addOns?: AddOn[];\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic removedIngredients?: string[];\r\n\r\n\t@prop()\r\n\tpublic specialInstructions?: string;\r\n}\r\n\r\nexport const LineItemModel: ReturnModelType<typeof LineItem> = getModelForClass(LineItem);\r\n"]}
@@ -1,12 +1,12 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { Cart } from './cart.model';
4
- import { CoreUser } from './core-user.model';
5
4
  import { PaymentMethod } from '../../../utilities/enum';
6
5
  import { PaymentInformation } from './embedded/payment-infromation.model';
6
+ import { User } from './user.model';
7
7
  export declare class CartParticipant extends TimeStamps {
8
8
  cart: Ref<Cart>;
9
- user: Ref<CoreUser>;
9
+ user: Ref<User>;
10
10
  joinedAt: Date;
11
11
  isReady: boolean;
12
12
  isPaid: boolean;
@@ -13,9 +13,9 @@ exports.CartParticipant = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  const cart_model_1 = require("./cart.model");
16
- const core_user_model_1 = require("./core-user.model");
17
16
  const enum_1 = require("../../../utilities/enum");
18
17
  const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
18
+ const user_model_1 = require("./user.model");
19
19
  let CartParticipant = class CartParticipant extends defaultClasses_1.TimeStamps {
20
20
  cart;
21
21
  user;
@@ -33,7 +33,7 @@ __decorate([
33
33
  __metadata("design:type", Object)
34
34
  ], CartParticipant.prototype, "cart", void 0);
35
35
  __decorate([
36
- (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
36
+ (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
37
37
  __metadata("design:type", Object)
38
38
  ], CartParticipant.prototype, "user", void 0);
39
39
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"cart-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-participant.model.ts"],"names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Ae;IAZ3B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,kBAAkB;YAC9B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;GACN,eAAe,CA2B3B","sourcesContent":["import {\r\n\tprop,\r\n\tgetModelForClass,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { CoreUser } from './core-user.model';\r\nimport { PaymentMethod } from '../../../utilities/enum';\r\nimport { PaymentInformation } from './embedded/payment-infromation.model';\r\n\r\n/**\r\n * CartParticipant model - Tracks users participating in a group cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'cartParticipants',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1, user: 1 }, { unique: true })\r\n@index({ cart: 1 })\r\nexport class CartParticipant extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ default: () => new Date() })\r\n\tpublic joinedAt!: Date;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isReady!: boolean;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isPaid!: boolean;\r\n\r\n\t@prop()\r\n\tpublic readyAt?: Date;\r\n\r\n\t@prop({ default: 0 })\r\n\tpublic spentAmount!: number;\r\n\r\n\t@prop({ enum: PaymentMethod, type: String })\r\n\tpublic paymentMethod?: PaymentMethod;\r\n\r\n\t@prop({ type: () => PaymentInformation })\r\n\tpublic paymentInformation?: PaymentInformation;\r\n}"]}
1
+ {"version":3,"file":"cart-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6CAAoC;AACpC,kDAAwD;AACxD,oFAA0E;AAC1E,6CAAoC;AAiB7B,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,QAAQ,CAAQ;IAGhB,OAAO,CAAW;IAGlB,MAAM,CAAW;IAGjB,OAAO,CAAQ;IAGf,WAAW,CAAU;IAGrB,aAAa,CAAiB;IAG9B,kBAAkB,CAAsB;CAC/C,CAAA;AA3BY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;6CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;6CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAClB,IAAI;iDAAC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;gDACA;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;+CACD;AAGjB;IADN,IAAA,gBAAI,GAAE;8BACU,IAAI;gDAAC;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oDACO;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,oBAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACP;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8CAAkB,EAAE,CAAC;8BACb,8CAAkB;2DAAC;0BA1BnC,eAAe;IAZ3B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,kBAAkB;YAC9B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;GACN,eAAe,CA2B3B","sourcesContent":["import { prop, Ref, index, modelOptions, Severity } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { PaymentMethod } from '../../../utilities/enum';\r\nimport { PaymentInformation } from './embedded/payment-infromation.model';\r\nimport { User } from './user.model';\r\n\r\n/**\r\n * CartParticipant model - Tracks users participating in a group cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'cartParticipants',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1, user: 1 }, { unique: true })\r\n@index({ cart: 1 })\r\nexport class CartParticipant extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ default: () => new Date() })\r\n\tpublic joinedAt!: Date;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isReady!: boolean;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isPaid!: boolean;\r\n\r\n\t@prop()\r\n\tpublic readyAt?: Date;\r\n\r\n\t@prop({ default: 0 })\r\n\tpublic spentAmount!: number;\r\n\r\n\t@prop({ enum: PaymentMethod, type: String })\r\n\tpublic paymentMethod?: PaymentMethod;\r\n\r\n\t@prop({ type: () => PaymentInformation })\r\n\tpublic paymentInformation?: PaymentInformation;\r\n}\r\n"]}
@@ -0,0 +1,22 @@
1
+ import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
+ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
+ import { Cart } from './cart.model';
4
+ import { CoreUser } from './core-user.model';
5
+ import { PaymentGateway, PaymentMethod } from '../../../utilities/enum';
6
+ export declare class PaymentInformation {
7
+ paymentGateway: PaymentGateway;
8
+ referenceId?: string;
9
+ transactionId?: string;
10
+ }
11
+ export declare class CartParticipant extends TimeStamps {
12
+ cart: Ref<Cart>;
13
+ user: Ref<CoreUser>;
14
+ joinedAt: Date;
15
+ isReady: boolean;
16
+ isPaid: boolean;
17
+ readyAt?: Date;
18
+ spentAmount: number;
19
+ paymentMethod?: PaymentMethod;
20
+ paymentInformation?: PaymentInformation;
21
+ }
22
+ export declare const CartParticipantModel: ReturnModelType<typeof CartParticipant>;
@@ -0,0 +1,104 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CartParticipantModel = exports.CartParticipant = exports.PaymentInformation = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
+ const cart_model_1 = require("./cart.model");
16
+ const core_user_model_1 = require("./core-user.model");
17
+ const enum_1 = require("../../../utilities/enum");
18
+ class PaymentInformation {
19
+ paymentGateway;
20
+ referenceId;
21
+ transactionId;
22
+ }
23
+ exports.PaymentInformation = PaymentInformation;
24
+ __decorate([
25
+ (0, typegoose_1.prop)({
26
+ required: true,
27
+ enum: enum_1.PaymentGateway,
28
+ type: String,
29
+ default: enum_1.PaymentGateway.AREEBA,
30
+ }),
31
+ __metadata("design:type", String)
32
+ ], PaymentInformation.prototype, "paymentGateway", void 0);
33
+ __decorate([
34
+ (0, typegoose_1.prop)(),
35
+ __metadata("design:type", String)
36
+ ], PaymentInformation.prototype, "referenceId", void 0);
37
+ __decorate([
38
+ (0, typegoose_1.prop)(),
39
+ __metadata("design:type", String)
40
+ ], PaymentInformation.prototype, "transactionId", void 0);
41
+ let CartParticipant = class CartParticipant extends defaultClasses_1.TimeStamps {
42
+ cart;
43
+ user;
44
+ joinedAt;
45
+ isReady;
46
+ isPaid;
47
+ readyAt;
48
+ spentAmount;
49
+ paymentMethod;
50
+ paymentInformation;
51
+ };
52
+ exports.CartParticipant = CartParticipant;
53
+ __decorate([
54
+ (0, typegoose_1.prop)({ required: true, ref: () => cart_model_1.Cart }),
55
+ __metadata("design:type", Object)
56
+ ], CartParticipant.prototype, "cart", void 0);
57
+ __decorate([
58
+ (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
59
+ __metadata("design:type", Object)
60
+ ], CartParticipant.prototype, "user", void 0);
61
+ __decorate([
62
+ (0, typegoose_1.prop)({ default: () => new Date() }),
63
+ __metadata("design:type", Date)
64
+ ], CartParticipant.prototype, "joinedAt", void 0);
65
+ __decorate([
66
+ (0, typegoose_1.prop)({ default: false }),
67
+ __metadata("design:type", Boolean)
68
+ ], CartParticipant.prototype, "isReady", void 0);
69
+ __decorate([
70
+ (0, typegoose_1.prop)({ default: false }),
71
+ __metadata("design:type", Boolean)
72
+ ], CartParticipant.prototype, "isPaid", void 0);
73
+ __decorate([
74
+ (0, typegoose_1.prop)(),
75
+ __metadata("design:type", Date)
76
+ ], CartParticipant.prototype, "readyAt", void 0);
77
+ __decorate([
78
+ (0, typegoose_1.prop)({ default: 0 }),
79
+ __metadata("design:type", Number)
80
+ ], CartParticipant.prototype, "spentAmount", void 0);
81
+ __decorate([
82
+ (0, typegoose_1.prop)({ enum: enum_1.PaymentMethod, type: String }),
83
+ __metadata("design:type", String)
84
+ ], CartParticipant.prototype, "paymentMethod", void 0);
85
+ __decorate([
86
+ (0, typegoose_1.prop)({ type: () => PaymentInformation }),
87
+ __metadata("design:type", PaymentInformation)
88
+ ], CartParticipant.prototype, "paymentInformation", void 0);
89
+ exports.CartParticipant = CartParticipant = __decorate([
90
+ (0, typegoose_1.modelOptions)({
91
+ schemaOptions: {
92
+ collection: 'cartParticipants',
93
+ toJSON: { virtuals: true },
94
+ toObject: { virtuals: true },
95
+ },
96
+ options: {
97
+ allowMixed: typegoose_1.Severity.ALLOW,
98
+ },
99
+ }),
100
+ (0, typegoose_1.index)({ cart: 1, user: 1 }, { unique: true }),
101
+ (0, typegoose_1.index)({ cart: 1 })
102
+ ], CartParticipant);
103
+ exports.CartParticipantModel = (0, typegoose_1.getModelForClass)(CartParticipant);
104
+ //# sourceMappingURL=cart-perticipant.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-perticipant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-perticipant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,4EAAqE;AACrE,6CAAoC;AACpC,uDAA6C;AAC7C,kDAAwE;AAExE,MAAa,kBAAkB;IAOvB,cAAc,CAAkB;IAGhC,WAAW,CAAU;IAGrB,aAAa,CAAU;CAC9B;AAdD,gDAcC;AAPO;IANN,IAAA,gBAAI,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,qBAAc;QACpB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,qBAAc,CAAC,MAAM;KAC9B,CAAC;;0DACqC;AAGhC;IADN,IAAA,gBAAI,GAAE;;uDACqB;AAGrB;IADN,IAAA,gBAAI,GAAE;;yDACuB;AAkBxB,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAa;IAGjB,IAAI,CAAiB;IAGrB,QAAQ,CAAQ;IAGhB,OAAO,CAAW;IAGlB,MAAM,CAAW;IAGjB,OAAO,CAAQ;IAGf,WAAW,CAAU;IAGrB,aAAa,CAAiB;IAG9B,kBAAkB,CAAsB;CAC/C,CAAA;AA3BY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;6CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;6CAClB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAClB,IAAI;iDAAC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;gDACA;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;+CACD;AAGjB;IADN,IAAA,gBAAI,GAAE;8BACU,IAAI;gDAAC;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oDACO;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,oBAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACP;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC;8BACb,kBAAkB;2DAAC;0BA1BnC,eAAe;IAZ3B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,kBAAkB;YAC9B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;GACN,eAAe,CA2B3B;AAEY,QAAA,oBAAoB,GAChC,IAAA,4BAAgB,EAAC,eAAe,CAAC,CAAC","sourcesContent":["import {\r\n\tprop,\r\n\tgetModelForClass,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { CoreUser } from './core-user.model';\r\nimport { PaymentGateway, PaymentMethod } from '../../../utilities/enum';\r\n\r\nexport class PaymentInformation {\r\n\t@prop({\r\n\t\trequired: true,\r\n\t\tenum: PaymentGateway,\r\n\t\ttype: String,\r\n\t\tdefault: PaymentGateway.AREEBA,\r\n\t})\r\n\tpublic paymentGateway!: PaymentGateway;\r\n\r\n\t@prop()\r\n\tpublic referenceId?: string;\r\n\r\n\t@prop()\r\n\tpublic transactionId?: string;\r\n}\r\n\r\n/**\r\n * CartParticipant model - Tracks users participating in a group cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'cartParticipants',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1, user: 1 }, { unique: true })\r\n@index({ cart: 1 })\r\nexport class CartParticipant extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ default: () => new Date() })\r\n\tpublic joinedAt!: Date;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isReady!: boolean;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isPaid!: boolean;\r\n\r\n\t@prop()\r\n\tpublic readyAt?: Date;\r\n\r\n\t@prop({ default: 0 })\r\n\tpublic spentAmount!: number;\r\n\r\n\t@prop({ enum: PaymentMethod, type: String })\r\n\tpublic paymentMethod?: PaymentMethod;\r\n\r\n\t@prop({ type: () => PaymentInformation })\r\n\tpublic paymentInformation?: PaymentInformation;\r\n}\r\n\r\nexport const CartParticipantModel: ReturnModelType<typeof CartParticipant> =\r\n\tgetModelForClass(CartParticipant);\r\n"]}
@@ -1,22 +1,20 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
- import { CoreUser } from './core-user.model';
3
2
  import { Shop } from './shop.model';
4
3
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
5
- import { CartStatus, ValueType } from '../../../utilities/enum';
4
+ import { CartStatus, PaymentPreference } from '../../../utilities/enum';
6
5
  import { UserAddress } from './shared/address.model';
7
6
  import { Coupon } from './coupon.model';
7
+ import { User } from './user.model';
8
8
  export declare class Cart extends TimeStamps {
9
9
  title?: string;
10
- slug: string;
11
- user: Ref<CoreUser>;
10
+ slug?: string;
11
+ user: Ref<User>;
12
12
  shop: Ref<Shop>;
13
13
  deliveryAddress?: UserAddress;
14
14
  isGroupOrder?: boolean;
15
15
  deadlineToOrder?: Date;
16
- paymentPreference?: string;
16
+ paymentPreference?: PaymentPreference;
17
17
  spendingLimitForGuest?: number;
18
18
  status: CartStatus;
19
19
  coupon?: Ref<Coupon>;
20
- discountValueType?: ValueType;
21
- discountValue: number;
22
20
  }
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Cart = void 0;
16
16
  const typegoose_1 = require("@typegoose/typegoose");
17
- const core_user_model_1 = require("./core-user.model");
18
17
  const shop_model_1 = require("./shop.model");
19
18
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
20
19
  const enum_1 = require("../../../utilities/enum");
@@ -22,6 +21,7 @@ const address_model_1 = require("./shared/address.model");
22
21
  const slugify_1 = __importDefault(require("slugify"));
23
22
  const crypto_1 = require("crypto");
24
23
  const coupon_model_1 = require("./coupon.model");
24
+ const user_model_1 = require("./user.model");
25
25
  let Cart = class Cart extends defaultClasses_1.TimeStamps {
26
26
  title;
27
27
  slug;
@@ -34,12 +34,10 @@ let Cart = class Cart extends defaultClasses_1.TimeStamps {
34
34
  spendingLimitForGuest;
35
35
  status;
36
36
  coupon;
37
- discountValueType;
38
- discountValue;
39
37
  };
40
38
  exports.Cart = Cart;
41
39
  __decorate([
42
- (0, typegoose_1.prop)({ required: false, trim: true, maxlength: 100 }),
40
+ (0, typegoose_1.prop)({ trim: true, maxlength: 100 }),
43
41
  __metadata("design:type", String)
44
42
  ], Cart.prototype, "title", void 0);
45
43
  __decorate([
@@ -47,7 +45,7 @@ __decorate([
47
45
  __metadata("design:type", String)
48
46
  ], Cart.prototype, "slug", void 0);
49
47
  __decorate([
50
- (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
48
+ (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
51
49
  __metadata("design:type", Object)
52
50
  ], Cart.prototype, "user", void 0);
53
51
  __decorate([
@@ -59,19 +57,19 @@ __decorate([
59
57
  __metadata("design:type", address_model_1.UserAddress)
60
58
  ], Cart.prototype, "deliveryAddress", void 0);
61
59
  __decorate([
62
- (0, typegoose_1.prop)({ default: false }),
60
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
63
61
  __metadata("design:type", Boolean)
64
62
  ], Cart.prototype, "isGroupOrder", void 0);
65
63
  __decorate([
66
- (0, typegoose_1.prop)(),
64
+ (0, typegoose_1.prop)({ type: Date }),
67
65
  __metadata("design:type", Date)
68
66
  ], Cart.prototype, "deadlineToOrder", void 0);
69
67
  __decorate([
70
- (0, typegoose_1.prop)({ enum: enum_1.PaymentPreference, type: String }),
68
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentPreference }),
71
69
  __metadata("design:type", String)
72
70
  ], Cart.prototype, "paymentPreference", void 0);
73
71
  __decorate([
74
- (0, typegoose_1.prop)({ default: 1, min: 1 }),
72
+ (0, typegoose_1.prop)({ type: Number, default: Infinity }),
75
73
  __metadata("design:type", Number)
76
74
  ], Cart.prototype, "spendingLimitForGuest", void 0);
77
75
  __decorate([
@@ -87,14 +85,6 @@ __decorate([
87
85
  (0, typegoose_1.prop)({ ref: () => coupon_model_1.Coupon }),
88
86
  __metadata("design:type", Object)
89
87
  ], Cart.prototype, "coupon", void 0);
90
- __decorate([
91
- (0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType, default: enum_1.ValueType.PERCENTAGE }),
92
- __metadata("design:type", String)
93
- ], Cart.prototype, "discountValueType", void 0);
94
- __decorate([
95
- (0, typegoose_1.prop)({ required: true, type: Number }),
96
- __metadata("design:type", Number)
97
- ], Cart.prototype, "discountValue", void 0);
98
88
  exports.Cart = Cart = __decorate([
99
89
  (0, typegoose_1.modelOptions)({
100
90
  schemaOptions: {
@@ -111,18 +101,12 @@ exports.Cart = Cart = __decorate([
111
101
  (0, typegoose_1.index)({ shop: 1 }),
112
102
  (0, typegoose_1.index)({ status: 1 }),
113
103
  (0, typegoose_1.pre)('save', async function (next) {
114
- if (!this.slug) {
115
- let baseSlug;
116
- if (this.title) {
117
- baseSlug = (0, slugify_1.default)(this.title, {
118
- lower: true,
119
- strict: true,
120
- trim: true,
121
- });
122
- }
123
- else {
124
- baseSlug = this.isGroupOrder ? 'group-order' : 'cart';
125
- }
104
+ if (this.title && !this.slug) {
105
+ const baseSlug = (0, slugify_1.default)(this.title, {
106
+ lower: true,
107
+ strict: true,
108
+ trim: true,
109
+ });
126
110
  const uniqueId = (0, crypto_1.randomBytes)(8).toString('hex');
127
111
  this.slug = `${baseSlug}-${uniqueId}`;
128
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAS8B;AAC9B,uDAA6C;AAC7C,6CAAoC;AACpC,4EAAqE;AACrE,kDAAmF;AACnF,0DAAqD;AACrD,sDAA8B;AAC9B,mCAAqC;AAErC,iDAAwC;AAsCjC,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,IAAI,CAAiB;IAGrB,IAAI,CAAa;IAGjB,eAAe,CAAe;IAG9B,YAAY,CAAW;IAGvB,eAAe,CAAQ;IAGvB,iBAAiB,CAAU;IAG3B,qBAAqB,CAAU;IAQ/B,MAAM,CAAc;IA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CAAC;YACvD,CAAC;YAED,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CA4ChB","sourcesContent":["import {\r\n\tprop,\r\n\tgetModelForClass,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tpre,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { CoreUser } from './core-user.model';\r\nimport { Shop } from './shop.model';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CartStatus, PaymentPreference, ValueType } from '../../../utilities/enum';\r\nimport { UserAddress } from './shared/address.model';\r\nimport slugify from 'slugify';\r\nimport { randomBytes } from 'crypto';\r\n\r\nimport { Coupon } from './coupon.model';\r\n\r\n/**\r\n * Cart configuration model using Typegoose with automatic slug generation\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'carts',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ slug: 1 }, { unique: true })\r\n@index({ user: 1 })\r\n@index({ shop: 1 })\r\n@index({ status: 1 })\r\n@pre<Cart>('save', async function (next) {\r\n\tif (!this.slug) {\r\n\t\tlet baseSlug;\r\n\r\n\t\tif (this.title) {\r\n\t\t\tbaseSlug = slugify(this.title, {\r\n\t\t\t\tlower: true,\r\n\t\t\t\tstrict: true,\r\n\t\t\t\ttrim: true,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tbaseSlug = this.isGroupOrder ? 'group-order' : 'cart';\r\n\t\t}\r\n\r\n\t\tconst uniqueId = randomBytes(8).toString('hex');\r\n\t\tthis.slug = `${baseSlug}-${uniqueId}`;\r\n\t}\r\n\tnext();\r\n})\r\nexport class Cart extends TimeStamps {\r\n\t@prop({ required: false, trim: true, maxlength: 100 })\r\n\tpublic title?: string;\r\n\r\n\t@prop({ unique: true, sparse: true })\r\n\tpublic slug!: string;\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, ref: () => Shop })\r\n\tpublic shop!: Ref<Shop>;\r\n\r\n\t@prop({ required: false, type: UserAddress })\r\n\tpublic deliveryAddress?: UserAddress;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isGroupOrder?: boolean;\r\n\r\n\t@prop()\r\n\tpublic deadlineToOrder?: Date;\r\n\r\n\t@prop({ enum: PaymentPreference, type: String })\r\n\tpublic paymentPreference?: string;\r\n\r\n\t@prop({ default: 1, min: 1 })\r\n\tpublic spendingLimitForGuest?: number;\r\n\r\n\t@prop({\r\n\t\tenum: CartStatus,\r\n\t\ttype: String,\r\n\t\tdefault: CartStatus.ACTIVE,\r\n\t\trequired: true,\r\n\t})\r\n\tpublic status!: CartStatus;\r\n\r\n\t@prop({ ref: () => Coupon })\r\n\tpublic coupon?: Ref<Coupon>;\r\n\r\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\r\n\tpublic discountValueType?: ValueType;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic discountValue!: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,6CAAoC;AACpC,4EAAqE;AACrE,kDAAmF;AACnF,0DAAqD;AACrD,sDAA8B;AAC9B,mCAAqC;AAErC,iDAAwC;AACxC,6CAAoC;AAgC7B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,IAA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{ prop, Ref, index, modelOptions, Severity, pre } from '@typegoose/typegoose';\r\nimport { Shop } from './shop.model';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CartStatus, PaymentPreference, ValueType } from '../../../utilities/enum';\r\nimport { UserAddress } from './shared/address.model';\r\nimport slugify from 'slugify';\r\nimport { randomBytes } from 'crypto';\r\n\r\nimport { Coupon } from './coupon.model';\r\nimport { User } from './user.model';\r\n\r\n/**\r\n * Cart configuration model using Typegoose with automatic slug generation\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'carts',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ slug: 1 }, { unique: true })\r\n@index({ user: 1 })\r\n@index({ shop: 1 })\r\n@index({ status: 1 })\r\n@pre<Cart>('save', async function (next) {\r\n\tif (this.title && !this.slug) {\r\n\t\tconst baseSlug = slugify(this.title, {\r\n\t\t\tlower: true,\r\n\t\t\tstrict: true,\r\n\t\t\ttrim: true,\r\n\t\t});\r\n\r\n\t\tconst uniqueId = randomBytes(8).toString('hex');\r\n\t\tthis.slug = `${baseSlug}-${uniqueId}`;\r\n\t}\r\n\tnext();\r\n})\r\nexport class Cart extends TimeStamps {\r\n\t@prop({ trim: true, maxlength: 100 })\r\n\tpublic title?: string;\r\n\r\n\t@prop({ unique: true, sparse: true })\r\n\tpublic slug?: string;\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ required: true, ref: () => Shop })\r\n\tpublic shop!: Ref<Shop>;\r\n\r\n\t@prop({ required: false, type: UserAddress })\r\n\tpublic deliveryAddress?: UserAddress;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isGroupOrder?: boolean;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic deadlineToOrder?: Date;\r\n\r\n\t@prop({ type: String, enum: PaymentPreference })\r\n\tpublic paymentPreference?: PaymentPreference;\r\n\r\n\t@prop({ type: Number, default: Infinity })\r\n\tpublic spendingLimitForGuest?: number;\r\n\r\n\t@prop({\r\n\t\tenum: CartStatus,\r\n\t\ttype: String,\r\n\t\tdefault: CartStatus.ACTIVE,\r\n\t\trequired: true,\r\n\t})\r\n\tpublic status!: CartStatus;\r\n\r\n\t@prop({ ref: () => Coupon })\r\n\tpublic coupon?: Ref<Coupon>;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class AttributeItem {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic price!: number;\r\n\r\n\t@prop({ type: Boolean, default: true })\r\n\tpublic isVisible?: boolean;\r\n}\r\n"]}
1
+ {"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class AttributeItem {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number })\n\tpublic price!: number;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-map.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-map.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAiC;AACjC,oDAAiD;AACjD,wDAA+C;AAE/C,MAAa,YAAY;IAEjB,SAAS,CAAkB;IAG3B,WAAW,CAAoB;CACtC;AAND,oCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;+CACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,gBAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;iDACd","sourcesContent":["import { Types } from 'mongoose';\r\nimport { prop, Ref } from '@typegoose/typegoose';\r\nimport { Attribute } from '../attribute.model';\r\n\r\nexport class AttributeMap {\r\n\t@prop({ required: true, ref: () => Attribute })\r\n\tpublic attribute!: Ref<Attribute>;\r\n\r\n\t@prop({ type: () => [Types.ObjectId], default: [] })\r\n\tpublic hiddenItems?: Types.ObjectId[];\r\n}\r\n"]}
1
+ {"version":3,"file":"attribute-map.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-map.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAiC;AACjC,oDAAiD;AACjD,wDAA+C;AAE/C,MAAa,YAAY;IAEjB,SAAS,CAAkB;IAG3B,WAAW,CAAoB;CACtC;AAND,oCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;+CACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,gBAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;iDACd","sourcesContent":["import { Types } from 'mongoose';\nimport { prop, Ref } from '@typegoose/typegoose';\nimport { Attribute } from '../attribute.model';\n\nexport class AttributeMap {\n\t@prop({ required: true, ref: () => Attribute })\n\tpublic attribute!: Ref<Attribute>;\n\n\t@prop({ type: () => [Types.ObjectId], default: [] })\n\tpublic hiddenItems?: Types.ObjectId[];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"business-development-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/business-development-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,0BAA0B;IAEtC,iBAAiB,CAAU;IAG3B,kBAAkB,CAAU;CAC5B;AAND,gEAMC;AAJA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qEACvB;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;sEACf","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class BusinessDevelopmentSetting {\r\n\t@prop({ type: Number, default: Infinity, min: 0 })\r\n\tmonthlyShopTarget?: number;\r\n\r\n\t@prop({ type: Number, default: 0, min: 0 })\r\n\tmonthlyRewardPrize?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"business-development-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/business-development-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,0BAA0B;IAEtC,iBAAiB,CAAU;IAG3B,kBAAkB,CAAU;CAC5B;AAND,gEAMC;AAJA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qEACvB;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;sEACf","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class BusinessDevelopmentSetting {\n\t@prop({ type: Number, default: Infinity, min: 0 })\n\tmonthlyShopTarget?: number;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tmonthlyRewardPrize?: number;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"charge-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAM,cAAc;IAEZ,IAAI,CAAU;IAGd,EAAE,CAAU;IAGZ,MAAM,CAAU;IAGhB,QAAQ,CAAU;CACzB;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CAC1B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;0CAC5B;AAGZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8CACxB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAG1B,MAAa,aAAa;IAElB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,eAAe,CAAoB;IAGnC,yBAAyB,CAAoB;CACpD;AAZD,sCAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;gDAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACT;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACV;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gEACA","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { ValueType } from '../../../../utilities/enum';\r\n\r\nclass DeliveryCharge {\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic from!: number;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic to!: number;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic charge!: number;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic riderCut!: number;\r\n}\r\n\r\nexport class ChargeSetting {\r\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\r\n\tpublic valueType?: ValueType;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic value?: number;\r\n\r\n\t@prop({ type: () => [DeliveryCharge], default: [] })\r\n\tpublic deliveryCharges?: DeliveryCharge[];\r\n\r\n\t@prop({ type: () => [DeliveryCharge], default: [] })\r\n\tpublic deliveryChargesForCourier?: DeliveryCharge[];\r\n}\r\n"]}
1
+ {"version":3,"file":"charge-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAM,cAAc;IAEZ,IAAI,CAAU;IAGd,EAAE,CAAU;IAGZ,MAAM,CAAU;IAGhB,QAAQ,CAAU;CACzB;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CAC1B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;0CAC5B;AAGZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8CACxB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAG1B,MAAa,aAAa;IAElB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,eAAe,CAAoB;IAGnC,yBAAyB,CAAoB;CACpD;AAZD,sCAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;gDAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACT;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACV;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gEACA","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ValueType } from '../../../../utilities/enum';\n\nclass DeliveryCharge {\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic from!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic to!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic charge!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic riderCut!: number;\n}\n\nexport class ChargeSetting {\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic value?: number;\n\n\t@prop({ type: () => [DeliveryCharge], default: [] })\n\tpublic deliveryCharges?: DeliveryCharge[];\n\n\t@prop({ type: () => [DeliveryCharge], default: [] })\n\tpublic deliveryChargesForCourier?: DeliveryCharge[];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"charge.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAa,MAAM;IAEX,SAAS,CAAa;IAGtB,KAAK,CAAU;CACtB;AAND,wBAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;yCAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qCACzB","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { ValueType } from '../../../../utilities/enum';\r\n\r\nexport class Charge {\r\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\r\n\tpublic valueType?: ValueType;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic value?: number;\r\n}\r\n"]}
1
+ {"version":3,"file":"charge.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAa,MAAM;IAEX,SAAS,CAAa;IAGtB,KAAK,CAAU;CACtB;AAND,wBAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;yCAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qCACzB","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ValueType } from '../../../../utilities/enum';\n\nexport class Charge {\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic value?: number;\n}\n"]}