@lyxa.ai/core 1.0.18 → 1.0.20
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.
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/libraries/mongo/models/admin-access-control.model.js +13 -2
- package/dist/libraries/mongo/models/admin-access-control.model.js.map +1 -1
- package/dist/libraries/mongo/models/areeba-card.model.d.ts +17 -0
- package/dist/libraries/mongo/models/areeba-card.model.js +73 -0
- package/dist/libraries/mongo/models/areeba-card.model.js.map +1 -0
- package/dist/libraries/mongo/models/attribute.model.d.ts +1 -1
- package/dist/libraries/mongo/models/attribute.model.js +3 -2
- package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
- package/dist/libraries/mongo/models/auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/auth-identity.model.js +33 -0
- package/dist/libraries/mongo/models/auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/base/base-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/card.model.d.ts +24 -0
- package/dist/libraries/mongo/models/card.model.js +109 -0
- package/dist/libraries/mongo/models/card.model.js.map +1 -0
- package/dist/libraries/mongo/models/{cart-perticipant.model.d.ts → cart-participant.model.d.ts} +3 -8
- package/dist/libraries/mongo/models/{cart-perticipant.model.js → cart-participant.model.js} +5 -28
- package/dist/libraries/mongo/models/cart-participant.model.js.map +1 -0
- package/dist/libraries/mongo/models/cart.model.d.ts +6 -3
- package/dist/libraries/mongo/models/cart.model.js +19 -4
- package/dist/libraries/mongo/models/cart.model.js.map +1 -1
- package/dist/libraries/mongo/models/category.model.d.ts +1 -2
- package/dist/libraries/mongo/models/category.model.js +2 -7
- package/dist/libraries/mongo/models/category.model.js.map +1 -1
- package/dist/libraries/mongo/models/core-auth-identity.model.d.ts +1 -2
- package/dist/libraries/mongo/models/core-auth-identity.model.js +1 -3
- package/dist/libraries/mongo/models/core-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/core-user.model.d.ts +0 -2
- package/dist/libraries/mongo/models/core-user.model.js +2 -4
- package/dist/libraries/mongo/models/core-user.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/addon.model.d.ts +8 -0
- package/dist/libraries/mongo/models/embedded/addon.model.js +34 -0
- package/dist/libraries/mongo/models/embedded/addon.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-map.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/business-development-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/charge-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/charge.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/courier-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/currency-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/currency.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/featured-item.mode.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/otp-fields.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/package.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/parent-document.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/payment-infromation.model.d.ts +6 -0
- package/dist/libraries/mongo/models/embedded/payment-infromation.model.js +38 -0
- package/dist/libraries/mongo/models/embedded/payment-infromation.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/payout-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/portion.model.d.ts +5 -0
- package/dist/libraries/mongo/models/embedded/portion.model.js +32 -0
- package/dist/libraries/mongo/models/embedded/portion.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/price.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/referral-discount-config.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/rider-equipment.model.d.ts +4 -0
- package/dist/libraries/mongo/models/embedded/rider-equipment.model.js +27 -0
- package/dist/libraries/mongo/models/embedded/rider-equipment.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/rider-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/service-fee-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/shop-document.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/subscription-summary.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/zone-geometry.mode.d.ts +2 -1
- package/dist/libraries/mongo/models/embedded/zone-geometry.mode.js +2 -1
- package/dist/libraries/mongo/models/embedded/zone-geometry.mode.js.map +1 -1
- package/dist/libraries/mongo/models/faq.model.d.ts +0 -1
- package/dist/libraries/mongo/models/faq.model.js +0 -5
- package/dist/libraries/mongo/models/faq.model.js.map +1 -1
- package/dist/libraries/mongo/models/index.d.ts +46 -29
- package/dist/libraries/mongo/models/index.js +48 -31
- package/dist/libraries/mongo/models/index.js.map +1 -1
- package/dist/libraries/mongo/models/{cart-lineitem.model.d.ts → line-item.model.d.ts} +3 -14
- package/dist/libraries/mongo/models/{cart-lineitem.model.js → line-item.model.js} +7 -44
- package/dist/libraries/mongo/models/line-item.model.js.map +1 -0
- package/dist/libraries/mongo/models/order.model.d.ts +2 -1
- package/dist/libraries/mongo/models/order.model.js +30 -2
- package/dist/libraries/mongo/models/order.model.js.map +1 -1
- package/dist/libraries/mongo/models/payout.model.js.map +1 -1
- package/dist/libraries/mongo/models/product.model.js +1 -3
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js +25 -0
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/areeba-card.model.d.ts +14 -0
- package/dist/libraries/mongo/models/providers/areeba-card.model.js +69 -0
- package/dist/libraries/mongo/models/providers/areeba-card.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.d.ts +0 -2
- package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.js +1 -4
- package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.d.ts +0 -2
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js +1 -4
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.d.ts +0 -2
- package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.js +1 -4
- package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.d.ts +0 -2
- package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.js +1 -4
- package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +9 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js +36 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js +25 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js +31 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.d.ts +10 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js +28 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +1 -0
- package/dist/libraries/mongo/models/request-area.model.d.ts +2 -2
- package/dist/libraries/mongo/models/request-area.model.js +2 -2
- package/dist/libraries/mongo/models/request-area.model.js.map +1 -1
- package/dist/libraries/mongo/models/rider-timeout.model.d.ts +10 -0
- package/dist/libraries/mongo/models/rider-timeout.model.js +47 -0
- package/dist/libraries/mongo/models/rider-timeout.model.js.map +1 -0
- package/dist/libraries/mongo/models/rider-tracking.model.d.ts +10 -0
- package/dist/libraries/mongo/models/rider-tracking.model.js +47 -0
- package/dist/libraries/mongo/models/rider-tracking.model.js.map +1 -0
- package/dist/libraries/mongo/models/rider.model.d.ts +50 -1
- package/dist/libraries/mongo/models/rider.model.js +238 -2
- package/dist/libraries/mongo/models/rider.model.js.map +1 -1
- package/dist/libraries/mongo/models/role.model.ts.d.ts +8 -0
- package/dist/libraries/mongo/models/role.model.ts.js +37 -0
- package/dist/libraries/mongo/models/role.model.ts.js.map +1 -0
- package/dist/libraries/mongo/models/shared/address.model.d.ts +2 -3
- package/dist/libraries/mongo/models/shared/address.model.js +10 -12
- package/dist/libraries/mongo/models/shared/address.model.js.map +1 -1
- package/dist/libraries/mongo/models/shared/duration.model.js.map +1 -1
- package/dist/libraries/mongo/models/shared/geo-location.model.d.ts +4 -0
- package/dist/libraries/mongo/models/shared/geo-location.model.js +27 -0
- package/dist/libraries/mongo/models/shared/geo-location.model.js.map +1 -0
- package/dist/libraries/mongo/models/shop-category.model.d.ts +1 -0
- package/dist/libraries/mongo/models/shop-category.model.js +7 -1
- package/dist/libraries/mongo/models/shop-category.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-review.d.ts +7 -0
- package/dist/libraries/mongo/models/shop-review.js +28 -0
- package/dist/libraries/mongo/models/shop-review.js.map +1 -0
- package/dist/libraries/mongo/models/transaction.model.js.map +1 -1
- package/dist/libraries/mongo/models/user.model.d.ts +30 -0
- package/dist/libraries/mongo/models/user.model.js +129 -0
- package/dist/libraries/mongo/models/user.model.js.map +1 -0
- package/dist/libraries/mongo/models/zone.model..d.ts +15 -0
- package/dist/libraries/mongo/models/zone.model..js +64 -0
- package/dist/libraries/mongo/models/zone.model..js.map +1 -0
- package/dist/libraries/mongo/models/zone.model.d.ts +5 -5
- package/dist/libraries/mongo/models/zone.model.js +11 -11
- package/dist/libraries/mongo/models/zone.model.js.map +1 -1
- package/dist/libraries/mongo/plugins/soft-delete-plugin.d.ts +8 -5
- package/dist/libraries/mongo/plugins/soft-delete-plugin.js +28 -0
- package/dist/libraries/mongo/plugins/soft-delete-plugin.js.map +1 -1
- package/dist/utilities/enum.d.ts +36 -4
- package/dist/utilities/enum.js +47 -6
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/pagination.d.ts +1 -0
- package/dist/utilities/pagination.js +4 -1
- package/dist/utilities/pagination.js.map +1 -1
- package/dist/utilities/response.js +1 -1
- package/dist/utilities/response.js.map +1 -1
- package/dist/utilities/transformers.d.ts +14 -3
- package/dist/utilities/transformers.js +49 -6
- package/dist/utilities/transformers.js.map +1 -1
- package/dist/utilities/validation/common-validation.d.ts +244 -16
- package/dist/utilities/validation/common-validation.js +30 -6
- package/dist/utilities/validation/common-validation.js.map +1 -1
- package/dist/utilities/validation/global-validation.d.ts +9 -0
- package/dist/utilities/validation/global-validation.js +1 -1
- package/dist/utilities/validation/global-validation.js.map +1 -1
- package/package.json +2 -2
- package/dist/libraries/mongo/models/cart-lineitem.model.js.map +0 -1
- package/dist/libraries/mongo/models/cart-perticipant.model.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ async function bootstrapCore(options) {
|
|
|
33
33
|
getLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');
|
|
34
34
|
const gracefulShutdown = async () => {
|
|
35
35
|
getLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');
|
|
36
|
+
process.exit();
|
|
36
37
|
};
|
|
37
38
|
process.on('SIGTERM', gracefulShutdown);
|
|
38
39
|
process.on('SIGINT', gracefulShutdown);
|
|
@@ -40,6 +41,9 @@ async function bootstrapCore(options) {
|
|
|
40
41
|
getLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);
|
|
41
42
|
gracefulShutdown();
|
|
42
43
|
});
|
|
44
|
+
process.on('exit', (code) => {
|
|
45
|
+
getLibraries().getLogger().logger.info(`Exiting with code: ${code}`);
|
|
46
|
+
});
|
|
43
47
|
console.log('Created hooks.');
|
|
44
48
|
}
|
|
45
49
|
catch (e) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;AAoBA,
|
|
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,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAAE,uHAAA,8BAA8B,OAAA;AAEzE,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,CAAA;QACf,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACxC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,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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);\r\n}\r\n"]}
|
|
@@ -18,6 +18,10 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
|
18
18
|
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
19
19
|
const enum_1 = require("../../../utilities/enum");
|
|
20
20
|
const admin_model_1 = require("./admin.model");
|
|
21
|
+
async function hashPassword(password) {
|
|
22
|
+
const salt = await bcryptjs_1.default.genSalt(10);
|
|
23
|
+
return bcryptjs_1.default.hash(password, salt);
|
|
24
|
+
}
|
|
21
25
|
let AdminAccessControl = class AdminAccessControl extends defaultClasses_1.TimeStamps {
|
|
22
26
|
email;
|
|
23
27
|
password;
|
|
@@ -44,8 +48,15 @@ __decorate([
|
|
|
44
48
|
exports.AdminAccessControl = AdminAccessControl = __decorate([
|
|
45
49
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
46
50
|
if (this.isModified('password')) {
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
this.password = await hashPassword(this.password);
|
|
52
|
+
}
|
|
53
|
+
next();
|
|
54
|
+
}),
|
|
55
|
+
(0, typegoose_1.pre)('findOneAndUpdate', async function (next) {
|
|
56
|
+
const update = this.getUpdate();
|
|
57
|
+
if (update?.password) {
|
|
58
|
+
update.password = await hashPassword(update.password);
|
|
59
|
+
this.setUpdate(update);
|
|
49
60
|
}
|
|
50
61
|
next();
|
|
51
62
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-access-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/admin-access-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoE;AACpE,4EAAqE;AACrE,wDAA8B;AAC9B,kDAAoD;AACpD,+CAAsC;
|
|
1
|
+
{"version":3,"file":"admin-access-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/admin-access-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoE;AACpE,4EAAqE;AACrE,wDAA8B;AAC9B,kDAAoD;AACpD,+CAAsC;AAGtC,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,IAAI,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAmBM,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,2BAAU;IAE1C,KAAK,CAAU;IAGf,QAAQ,CAAU;IAGlB,KAAK,CAAc;IAGnB,IAAI,CAAa;CACxB,CAAA;AAZY,gDAAkB;AAEvB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;iDAC/B;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;iDACjB;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;gDAChC;6BAXZ,kBAAkB;IAjB9B,IAAA,eAAG,EAAqB,MAAM,EAAE,KAAK,WAAW,IAAI;QACpD,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IAED,IAAA,eAAG,EAAiC,kBAAkB,EAAE,KAAK,WAAU,IAAI;QAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAyB,CAAC;QACvD,IAAI,MAAM,EAAE,QAAQ,EAAE,CAAC;YACrB,MAAM,CAAC,QAAQ,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,EAAE,CAAC;IACN,CAAC,CAAC;IAEH,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,EAAE,CAAC;GAC1D,kBAAkB,CAY9B","sourcesContent":["import { modelOptions, prop, pre, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport bcrypt from 'bcryptjs';\r\nimport { AdminRole } from '../../../utilities/enum';\r\nimport { Admin } from './admin.model';\r\nimport { Query } from 'mongoose';\r\n\r\nasync function hashPassword(password: string): Promise<string> {\r\n\tconst salt = await bcrypt.genSalt(10);\r\n\treturn bcrypt.hash(password, salt);\r\n}\r\n\r\n@pre<AdminAccessControl>('save', async function (next) {\r\n\tif (this.isModified('password')) {\r\n\t\tthis.password = await hashPassword(this.password);\r\n\t}\r\n\tnext();\r\n})\r\n\r\n@pre<Query<any, AdminAccessControl>>('findOneAndUpdate', async function(next) {\r\n\tconst update = this.getUpdate() as Record<string, any>;\r\n\tif (update?.password) {\r\n\t update.password = await hashPassword(update.password);\r\n\t this.setUpdate(update);\r\n\t}\r\n\tnext();\r\n })\r\n\r\n@modelOptions({ schemaOptions: { collection: 'adminAccessControls' } })\r\nexport class AdminAccessControl extends TimeStamps {\r\n\t@prop({ required: true, type: String, unique: true })\r\n\tpublic email!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic password!: string;\r\n\r\n\t@prop({ required: true, ref: () => Admin })\r\n\tpublic admin!: Ref<Admin>;\r\n\r\n\t@prop({ required: true, type: String, enum: AdminRole })\r\n\tpublic role!: AdminRole;\r\n}\r\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Card } from "./card.model";
|
|
2
|
+
export declare enum AreebaCardStatus {
|
|
3
|
+
PENDING = "PENDING",
|
|
4
|
+
ACTIVE = "ACTIVE"
|
|
5
|
+
}
|
|
6
|
+
export declare class AreebaCard extends Card {
|
|
7
|
+
orderId?: string;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
brand?: string;
|
|
10
|
+
expiry?: string;
|
|
11
|
+
fundingMethod?: string;
|
|
12
|
+
nameOnCard?: string;
|
|
13
|
+
number?: string;
|
|
14
|
+
scheme?: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
status?: AreebaCardStatus;
|
|
17
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.AreebaCard = exports.AreebaCardStatus = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const card_model_1 = require("./card.model");
|
|
15
|
+
var AreebaCardStatus;
|
|
16
|
+
(function (AreebaCardStatus) {
|
|
17
|
+
AreebaCardStatus["PENDING"] = "PENDING";
|
|
18
|
+
AreebaCardStatus["ACTIVE"] = "ACTIVE";
|
|
19
|
+
})(AreebaCardStatus || (exports.AreebaCardStatus = AreebaCardStatus = {}));
|
|
20
|
+
class AreebaCard extends card_model_1.Card {
|
|
21
|
+
orderId;
|
|
22
|
+
sessionId;
|
|
23
|
+
brand;
|
|
24
|
+
expiry;
|
|
25
|
+
fundingMethod;
|
|
26
|
+
nameOnCard;
|
|
27
|
+
number;
|
|
28
|
+
scheme;
|
|
29
|
+
token;
|
|
30
|
+
status;
|
|
31
|
+
}
|
|
32
|
+
exports.AreebaCard = AreebaCard;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AreebaCard.prototype, "orderId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], AreebaCard.prototype, "sessionId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], AreebaCard.prototype, "brand", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], AreebaCard.prototype, "expiry", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], AreebaCard.prototype, "fundingMethod", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], AreebaCard.prototype, "nameOnCard", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], AreebaCard.prototype, "number", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], AreebaCard.prototype, "scheme", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], AreebaCard.prototype, "token", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typegoose_1.prop)({ type: String, enum: AreebaCardStatus, default: AreebaCardStatus.PENDING }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], AreebaCard.prototype, "status", void 0);
|
|
73
|
+
//# sourceMappingURL=areeba-card.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areeba-card.model.js","sourceRoot":"/","sources":["libraries/mongo/models/areeba-card.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0C;AAC1C,6C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{Card} from \"./card.model\";\r\n\r\nexport enum AreebaCardStatus {\r\n PENDING = \"PENDING\",\r\n ACTIVE = \"ACTIVE\"\r\n}\r\n\r\nexport class AreebaCard extends Card {\r\n @prop({ type: String })\r\n public orderId?: string;\r\n\r\n @prop({ type: String })\r\n public sessionId?: string;\r\n\r\n @prop({ type: String })\r\n public brand?: string;\r\n\r\n @prop({ type: String })\r\n public expiry?: string;\r\n\r\n @prop({ type: String })\r\n public fundingMethod?: string;\r\n\r\n @prop({ type: String })\r\n public nameOnCard?: string;\r\n\r\n @prop({ type: String })\r\n public number?: string;\r\n\r\n @prop({ type: String })\r\n public scheme?: string;\r\n\r\n @prop({ type: String })\r\n public token?: string;\r\n\r\n @prop({ type: String, enum: AreebaCardStatus, default: AreebaCardStatus.PENDING })\r\n public status?: AreebaCardStatus;\r\n}\r\n"]}
|
|
@@ -55,10 +55,11 @@ __decorate([
|
|
|
55
55
|
__metadata("design:type", Number)
|
|
56
56
|
], Attribute.prototype, "maximumRequiredItems", void 0);
|
|
57
57
|
__decorate([
|
|
58
|
-
(0, typegoose_1.prop)({ type: [attribute_item_model_1.AttributeItem]
|
|
58
|
+
(0, typegoose_1.prop)({ required: true, type: [attribute_item_model_1.AttributeItem] }),
|
|
59
59
|
__metadata("design:type", Array)
|
|
60
60
|
], Attribute.prototype, "items", void 0);
|
|
61
61
|
exports.Attribute = Attribute = __decorate([
|
|
62
|
-
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'attributes' } })
|
|
62
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'attributes' } }),
|
|
63
|
+
(0, typegoose_1.Index)({ shop: 1, name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })
|
|
63
64
|
], Attribute);
|
|
64
65
|
//# sourceMappingURL=attribute.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/attribute.model.ts"],"names":[],"mappings":";;;;;;;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AE,CAAC;;wCACjB;oBAzBnB,SAAS;IAFrB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,CAAC;IAC7D,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;GAC/E,SAAS,CA0BrB","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { AttributeItem } from './embedded/attribute-item.model';\r\nimport { AttributeItemSelectionType } from '../../../utilities/enum';\r\nimport { Shop } from './shop.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'attributes' } })\r\n@Index({ shop: 1, name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\r\nexport class Attribute extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Shop })\r\n\tpublic shop!: Ref<Shop>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isRequired?: boolean;\r\n\r\n\t@prop({\r\n\t\trequired: true,\r\n\t\ttype: String,\r\n\t\tenum: AttributeItemSelectionType,\r\n\t\tdefault: AttributeItemSelectionType.SINGLE,\r\n\t})\r\n\tpublic selectionType!: AttributeItemSelectionType;\r\n\r\n\t@prop({ type: Number, min: 0, default: 0 })\r\n\tpublic minimumRequiredItems?: number;\r\n\r\n\t@prop({ type: Number, min: 0, default: 0 })\r\n\tpublic maximumRequiredItems?: number;\r\n\r\n\t@prop({ required: true, type: [AttributeItem] })\r\n\tpublic items!: AttributeItem[];\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref, ReturnModelType } from '@typegoose/typegoose';
|
|
2
|
+
import { AuthIdentityType } from '../../../utilities/enum';
|
|
3
|
+
import { User } from './user.model';
|
|
4
|
+
export declare class AuthIdentity {
|
|
5
|
+
user: Ref<User>;
|
|
6
|
+
type: AuthIdentityType;
|
|
7
|
+
}
|
|
8
|
+
export declare const AuthIdentityModel: ReturnModelType<typeof AuthIdentity>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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.AuthIdentityModel = exports.AuthIdentity = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../utilities/enum");
|
|
15
|
+
const user_model_1 = require("./user.model");
|
|
16
|
+
let AuthIdentity = class AuthIdentity {
|
|
17
|
+
user;
|
|
18
|
+
type;
|
|
19
|
+
};
|
|
20
|
+
exports.AuthIdentity = AuthIdentity;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
|
|
23
|
+
__metadata("design:type", Object)
|
|
24
|
+
], AuthIdentity.prototype, "user", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.AuthIdentityType }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], AuthIdentity.prototype, "type", void 0);
|
|
29
|
+
exports.AuthIdentity = AuthIdentity = __decorate([
|
|
30
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'authIdentities', discriminatorKey: 'type' } })
|
|
31
|
+
], AuthIdentity);
|
|
32
|
+
exports.AuthIdentityModel = (0, typegoose_1.getModelForClass)(AuthIdentity);
|
|
33
|
+
//# sourceMappingURL=auth-identity.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-identity.model.js","sourceRoot":"/","sources":["libraries/mongo/models/auth-identity.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,kDAA2D;AAC3D,6CAAoC;AAG7B,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,IAAI,CAAa;IAGjB,IAAI,CAAoB;CAC/B,CAAA;AANY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;0CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAgB,EAAE,CAAC;;0CAChC;uBALnB,YAAY;IADxB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,CAAC;GAC/E,YAAY,CAMxB;AAEY,QAAA,iBAAiB,GAAyC,IAAA,4BAAgB,EAAC,YAAY,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { AuthIdentityType } from '../../../utilities/enum';\r\nimport { User } from './user.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'authIdentities', discriminatorKey: 'type' } })\r\nexport class AuthIdentity {\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ required: true, type: String, enum: AuthIdentityType })\r\n\tpublic type!: AuthIdentityType;\r\n}\r\n\r\nexport const AuthIdentityModel: ReturnModelType<typeof AuthIdentity> = getModelForClass(AuthIdentity);\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';\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"]}
|
|
1
|
+
{"version":3,"file":"base-coupon.model.js","sourceRoot":"/","s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A,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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
+
import { CoreUser } from './core-user.model';
|
|
4
|
+
import { Parent } from './parent.model';
|
|
5
|
+
import { CardType, CardUserType } from '../../../utilities/enum';
|
|
6
|
+
export declare class Card extends TimeStamps {
|
|
7
|
+
cardType: CardType;
|
|
8
|
+
coreUser?: Ref<CoreUser>;
|
|
9
|
+
parent?: Ref<Parent>;
|
|
10
|
+
userType?: CardUserType;
|
|
11
|
+
nameOfCard?: string;
|
|
12
|
+
card_number: string;
|
|
13
|
+
cvv: string;
|
|
14
|
+
expiry_month: string;
|
|
15
|
+
expiry_year: string;
|
|
16
|
+
expiryDateString?: string;
|
|
17
|
+
expiryDate?: Date;
|
|
18
|
+
currency?: string;
|
|
19
|
+
defaultCard?: boolean;
|
|
20
|
+
cardTypeString?: string;
|
|
21
|
+
security?: string;
|
|
22
|
+
pins?: string[];
|
|
23
|
+
mode?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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.Card = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
+
const core_user_model_1 = require("./core-user.model");
|
|
16
|
+
const parent_model_1 = require("./parent.model");
|
|
17
|
+
const enum_1 = require("../../../utilities/enum");
|
|
18
|
+
let Card = class Card extends defaultClasses_1.TimeStamps {
|
|
19
|
+
cardType;
|
|
20
|
+
coreUser;
|
|
21
|
+
parent;
|
|
22
|
+
userType;
|
|
23
|
+
nameOfCard;
|
|
24
|
+
card_number;
|
|
25
|
+
cvv;
|
|
26
|
+
expiry_month;
|
|
27
|
+
expiry_year;
|
|
28
|
+
expiryDateString;
|
|
29
|
+
expiryDate;
|
|
30
|
+
currency;
|
|
31
|
+
defaultCard;
|
|
32
|
+
cardTypeString;
|
|
33
|
+
security;
|
|
34
|
+
pins;
|
|
35
|
+
mode;
|
|
36
|
+
};
|
|
37
|
+
exports.Card = Card;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.CardType }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], Card.prototype, "cardType", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typegoose_1.prop)({ ref: () => core_user_model_1.CoreUser }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], Card.prototype, "coreUser", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typegoose_1.prop)({ ref: () => parent_model_1.Parent }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], Card.prototype, "parent", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.CardUserType }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], Card.prototype, "userType", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], Card.prototype, "nameOfCard", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typegoose_1.prop)({ type: String, required: true }),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], Card.prototype, "card_number", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typegoose_1.prop)({ type: String, required: true }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], Card.prototype, "cvv", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typegoose_1.prop)({ type: String, required: true }),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], Card.prototype, "expiry_month", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typegoose_1.prop)({ type: String, required: true }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], Card.prototype, "expiry_year", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], Card.prototype, "expiryDateString", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
80
|
+
__metadata("design:type", Date)
|
|
81
|
+
], Card.prototype, "expiryDate", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typegoose_1.prop)({ type: String, required: true, default: 'NGN' }),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], Card.prototype, "currency", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
88
|
+
__metadata("design:type", Boolean)
|
|
89
|
+
], Card.prototype, "defaultCard", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], Card.prototype, "cardTypeString", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], Card.prototype, "security", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typegoose_1.prop)({ type: () => [String] }),
|
|
100
|
+
__metadata("design:type", Array)
|
|
101
|
+
], Card.prototype, "pins", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], Card.prototype, "mode", void 0);
|
|
106
|
+
exports.Card = Card = __decorate([
|
|
107
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'cards', timestamps: true, discriminatorKey: 'cardType' } })
|
|
108
|
+
], Card);
|
|
109
|
+
//# sourceMappingURL=card.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.model.js","sourceRoot":"/","sources":["libraries/mongo/models/card.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,uDAA6C;AAC7C,iDAAwC;AACxC,kDAAiE;AAG1D,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,QAAQ,CAAW;IAGnB,QAAQ,CAAiB;IAGzB,MAAM,CAAe;IAGrB,QAAQ,CAAgB;IAGxB,UAAU,CAAU;IAGpB,WAAW,CAAU;IAGrB,GAAG,CAAU;IAGb,YAAY,CAAU;IAGtB,WAAW,CAAU;IAGrB,gBAAgB,CAAU;IAG1B,UAAU,CAAQ;IAGlB,QAAQ,CAAU;IAGlB,WAAW,CAAW;IAGtB,cAAc,CAAU;IAGxB,QAAQ,CAAU;IAGlB,IAAI,CAAY;IAGhB,IAAI,CAAU;CACrB,CAAA;AAnDY,oBAAI;AAET;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;sCACb;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;sCACE;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;oCACA;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAY,EAAE,CAAC;;sCACZ;AAGxB;IADN,IAAA,gBAAI,EA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AAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,CAAC;GAC5F,IAAI,CAmDhB","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CoreUser } from './core-user.model';\r\nimport { Parent } from './parent.model';\r\nimport { CardType, CardUserType } from '../../../utilities/enum';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'cards', timestamps: true, discriminatorKey: 'cardType' } })\r\nexport class Card extends TimeStamps {\r\n\t@prop({ type: String, enum: CardType })\r\n\tpublic cardType: CardType;\r\n\r\n\t@prop({ ref: () => CoreUser })\r\n\tpublic coreUser?: Ref<CoreUser>;\r\n\r\n\t@prop({ ref: () => Parent })\r\n\tpublic parent?: Ref<Parent>;\r\n\r\n\t@prop({ type: String, enum: CardUserType })\r\n\tpublic userType?: CardUserType;\r\n\r\n\t@prop({ type: String })\r\n\tpublic nameOfCard?: string;\r\n\r\n\t@prop({ type: String, required: true })\r\n\tpublic card_number!: string;\r\n\r\n\t@prop({ type: String, required: true })\r\n\tpublic cvv!: string;\r\n\r\n\t@prop({ type: String, required: true })\r\n\tpublic expiry_month!: string;\r\n\r\n\t@prop({ type: String, required: true })\r\n\tpublic expiry_year!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic expiryDateString?: string;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic expiryDate?: Date;\r\n\r\n\t@prop({ type: String, required: true, default: 'NGN' })\r\n\tpublic currency?: string;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic defaultCard?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic cardTypeString?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic security?: string;\r\n\r\n\t@prop({ type: () => [String] })\r\n\tpublic pins?: string[];\r\n\r\n\t@prop({ type: String })\r\n\tpublic mode?: string;\r\n}\r\n"]}
|
package/dist/libraries/mongo/models/{cart-perticipant.model.d.ts → cart-participant.model.d.ts}
RENAMED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { Ref
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
2
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
3
|
import { Cart } from './cart.model';
|
|
4
4
|
import { CoreUser } from './core-user.model';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
paymentGateway: PaymentGateway;
|
|
8
|
-
referenceId?: string;
|
|
9
|
-
transactionId?: string;
|
|
10
|
-
}
|
|
5
|
+
import { PaymentMethod } from '../../../utilities/enum';
|
|
6
|
+
import { PaymentInformation } from './embedded/payment-infromation.model';
|
|
11
7
|
export declare class CartParticipant extends TimeStamps {
|
|
12
8
|
cart: Ref<Cart>;
|
|
13
9
|
user: Ref<CoreUser>;
|
|
@@ -19,4 +15,3 @@ export declare class CartParticipant extends TimeStamps {
|
|
|
19
15
|
paymentMethod?: PaymentMethod;
|
|
20
16
|
paymentInformation?: PaymentInformation;
|
|
21
17
|
}
|
|
22
|
-
export declare const CartParticipantModel: ReturnModelType<typeof CartParticipant>;
|
|
@@ -9,35 +9,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
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
16
|
const core_user_model_1 = require("./core-user.model");
|
|
17
17
|
const enum_1 = require("../../../utilities/enum");
|
|
18
|
-
|
|
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);
|
|
18
|
+
const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
|
|
41
19
|
let CartParticipant = class CartParticipant extends defaultClasses_1.TimeStamps {
|
|
42
20
|
cart;
|
|
43
21
|
user;
|
|
@@ -83,8 +61,8 @@ __decorate([
|
|
|
83
61
|
__metadata("design:type", String)
|
|
84
62
|
], CartParticipant.prototype, "paymentMethod", void 0);
|
|
85
63
|
__decorate([
|
|
86
|
-
(0, typegoose_1.prop)({ type: () => PaymentInformation }),
|
|
87
|
-
__metadata("design:type", PaymentInformation)
|
|
64
|
+
(0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation }),
|
|
65
|
+
__metadata("design:type", payment_infromation_model_1.PaymentInformation)
|
|
88
66
|
], CartParticipant.prototype, "paymentInformation", void 0);
|
|
89
67
|
exports.CartParticipant = CartParticipant = __decorate([
|
|
90
68
|
(0, typegoose_1.modelOptions)({
|
|
@@ -100,5 +78,4 @@ exports.CartParticipant = CartParticipant = __decorate([
|
|
|
100
78
|
(0, typegoose_1.index)({ cart: 1, user: 1 }, { unique: true }),
|
|
101
79
|
(0, typegoose_1.index)({ cart: 1 })
|
|
102
80
|
], CartParticipant);
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=cart-perticipant.model.js.map
|
|
81
|
+
//# sourceMappingURL=cart-participant.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,4EAAqE;AACrE,6CAAoC;AACpC,uDAA6C;AAC7C,kDAAwD;AACxD,oFAA0E;AAiBnE,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,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 {\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,9 +1,10 @@
|
|
|
1
|
-
import { Ref
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
2
|
import { CoreUser } from './core-user.model';
|
|
3
3
|
import { Shop } from './shop.model';
|
|
4
4
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
5
|
-
import { CartStatus } from '../../../utilities/enum';
|
|
5
|
+
import { CartStatus, ValueType } from '../../../utilities/enum';
|
|
6
6
|
import { UserAddress } from './shared/address.model';
|
|
7
|
+
import { Coupon } from './coupon.model';
|
|
7
8
|
export declare class Cart extends TimeStamps {
|
|
8
9
|
title?: string;
|
|
9
10
|
slug: string;
|
|
@@ -15,5 +16,7 @@ export declare class Cart extends TimeStamps {
|
|
|
15
16
|
paymentPreference?: string;
|
|
16
17
|
spendingLimitForGuest?: number;
|
|
17
18
|
status: CartStatus;
|
|
19
|
+
coupon?: Ref<Coupon>;
|
|
20
|
+
discountValueType?: ValueType;
|
|
21
|
+
discountValue: number;
|
|
18
22
|
}
|
|
19
|
-
export declare const CartModel: ReturnModelType<typeof Cart>;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.Cart = void 0;
|
|
16
16
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
17
17
|
const core_user_model_1 = require("./core-user.model");
|
|
18
18
|
const shop_model_1 = require("./shop.model");
|
|
@@ -20,7 +20,8 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
|
20
20
|
const enum_1 = require("../../../utilities/enum");
|
|
21
21
|
const address_model_1 = require("./shared/address.model");
|
|
22
22
|
const slugify_1 = __importDefault(require("slugify"));
|
|
23
|
-
const
|
|
23
|
+
const crypto_1 = require("crypto");
|
|
24
|
+
const coupon_model_1 = require("./coupon.model");
|
|
24
25
|
let Cart = class Cart extends defaultClasses_1.TimeStamps {
|
|
25
26
|
title;
|
|
26
27
|
slug;
|
|
@@ -32,6 +33,9 @@ let Cart = class Cart extends defaultClasses_1.TimeStamps {
|
|
|
32
33
|
paymentPreference;
|
|
33
34
|
spendingLimitForGuest;
|
|
34
35
|
status;
|
|
36
|
+
coupon;
|
|
37
|
+
discountValueType;
|
|
38
|
+
discountValue;
|
|
35
39
|
};
|
|
36
40
|
exports.Cart = Cart;
|
|
37
41
|
__decorate([
|
|
@@ -79,6 +83,18 @@ __decorate([
|
|
|
79
83
|
}),
|
|
80
84
|
__metadata("design:type", String)
|
|
81
85
|
], Cart.prototype, "status", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typegoose_1.prop)({ ref: () => coupon_model_1.Coupon }),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], 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);
|
|
82
98
|
exports.Cart = Cart = __decorate([
|
|
83
99
|
(0, typegoose_1.modelOptions)({
|
|
84
100
|
schemaOptions: {
|
|
@@ -107,11 +123,10 @@ exports.Cart = Cart = __decorate([
|
|
|
107
123
|
else {
|
|
108
124
|
baseSlug = this.isGroupOrder ? 'group-order' : 'cart';
|
|
109
125
|
}
|
|
110
|
-
const uniqueId = (0,
|
|
126
|
+
const uniqueId = (0, crypto_1.randomBytes)(8).toString('hex');
|
|
111
127
|
this.slug = `${baseSlug}-${uniqueId}`;
|
|
112
128
|
}
|
|
113
129
|
next();
|
|
114
130
|
})
|
|
115
131
|
], Cart);
|
|
116
|
-
exports.CartModel = (0, typegoose_1.getModelForClass)(Cart);
|
|
117
132
|
//# sourceMappingURL=cart.model.js.map
|