@lyxa.ai/core 1.0.82 → 1.0.84

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 (25) hide show
  1. package/dist/libraries/cache/settings/index.d.ts +1 -2
  2. package/dist/libraries/cache/settings/index.js +2 -6
  3. package/dist/libraries/cache/settings/index.js.map +1 -1
  4. package/dist/libraries/index.d.ts +2 -0
  5. package/dist/libraries/index.js +4 -0
  6. package/dist/libraries/index.js.map +1 -1
  7. package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.d.ts +16 -0
  8. package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js +61 -0
  9. package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js.map +1 -0
  10. package/dist/libraries/mongo/models/embedded/order-finance.model.d.ts +2 -0
  11. package/dist/libraries/mongo/models/embedded/order-finance.model.js +6 -0
  12. package/dist/libraries/mongo/models/embedded/order-finance.model.js.map +1 -1
  13. package/dist/libraries/mongo/models/embedded/trip-leg.mode.d.ts +2 -2
  14. package/dist/libraries/mongo/models/embedded/trip-leg.mode.js +1 -1
  15. package/dist/libraries/mongo/models/embedded/trip-leg.mode.js.map +1 -1
  16. package/dist/utilities/currency.js +5 -4
  17. package/dist/utilities/currency.js.map +1 -1
  18. package/dist/utilities/validation/common-validation.d.ts +7 -7
  19. package/package.json +1 -1
  20. package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +0 -9
  21. package/dist/libraries/mongo/models/app-screen-setting.model.js +0 -72
  22. package/dist/libraries/mongo/models/app-screen-setting.model.js.map +0 -1
  23. package/dist/libraries/mongo/models/order-payment.model.d.ts +0 -17
  24. package/dist/libraries/mongo/models/order-payment.model.js +0 -84
  25. package/dist/libraries/mongo/models/order-payment.model.js.map +0 -1
@@ -1,8 +1,7 @@
1
1
  import { RedisService } from '../../redis';
2
2
  export declare class CachedSettingsService {
3
- private redisService;
3
+ private readonly redisService;
4
4
  constructor(redisService: RedisService);
5
5
  getSettings(): Promise<any>;
6
6
  updateSettings(): Promise<string>;
7
7
  }
8
- export declare const cachedSettingsService: CachedSettingsService;
@@ -12,12 +12,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.cachedSettingsService = exports.CachedSettingsService = void 0;
15
+ exports.CachedSettingsService = void 0;
16
16
  const typedi_1 = require("typedi");
17
17
  const redis_1 = require("../../redis");
18
18
  const models_1 = require("../../mongo/models");
19
- const redisURL = 'redis://default:8RCVCiwXRMo6isHgJanL1pE86cRt29YP@redis-12296.fcrce173.eu-west-1-1.ec2.redns.redis-cloud.com:12296';
20
- typedi_1.Container.set(redis_1.RedisService, new redis_1.RedisService(redisURL));
21
19
  const getSettingsKey = () => {
22
20
  const tenant = process.env.tenant || 'lb';
23
21
  const environment = process.env.environment || 'dev';
@@ -34,9 +32,8 @@ let CachedSettingsService = class CachedSettingsService {
34
32
  if (cached)
35
33
  return cached;
36
34
  const settings = await models_1.SettingModel.findOne({}).lean().exec();
37
- if (!settings) {
35
+ if (!settings)
38
36
  throw new Error('Settings not found');
39
- }
40
37
  await this.redisService.cacheObject(key, settings);
41
38
  return settings;
42
39
  }
@@ -52,5 +49,4 @@ exports.CachedSettingsService = CachedSettingsService = __decorate([
52
49
  __param(0, (0, typedi_1.Inject)(() => redis_1.RedisService)),
53
50
  __metadata("design:paramtypes", [redis_1.RedisService])
54
51
  ], CachedSettingsService);
55
- exports.cachedSettingsService = typedi_1.Container.get(CachedSettingsService);
56
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/cache/settings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAoD;AACpD,uCAA2C;AAC3C,+CAAkD;AAElD,MAAM,QAAQ,GACb,mHAAmH,CAAC;AACrH,kBAAS,CAAC,GAAG,CAAC,oBAAY,E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AY,CAAC,CAAA;qCAAuB,oBAAY;GAD9D,qBAAqB,CAkCjC;AAGY,QAAA,qBAAqB,GAAG,kBAAS,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { Service, Inject, Container } from 'typedi';\nimport { RedisService } from '../../redis';\nimport { SettingModel } from '../../mongo/models';\n\nconst redisURL =\n\t'redis://default:8RCVCiwXRMo6isHgJanL1pE86cRt29YP@redis-12296.fcrce173.eu-west-1-1.ec2.redns.redis-cloud.com:12296';\nContainer.set(RedisService, new RedisService(redisURL));\nconst getSettingsKey = (): string => {\n\tconst tenant = process.env.tenant || 'lb';\n\tconst environment = process.env.environment || 'dev';\n\treturn `settings:${tenant}:${environment}`;\n};\n\n@Service()\nexport class CachedSettingsService {\n\tconstructor(@Inject(() => RedisService) private redisService: RedisService) {}\n\n\t/**\n\t * Get settings from Redis cache or fallback to DB if not found.\n\t */\n\tasync getSettings(): Promise<any> {\n\t\tconst key = getSettingsKey();\n\n\t\t// Try cache first\n\t\tconst cached = await this.redisService.getCachedObject<any>(key);\n\t\tif (cached) return cached;\n\n\t\t// Cache miss — fetch from DB\n\t\tconst settings = await SettingModel.findOne({}).lean().exec();\n\n\t\tif (!settings) {\n\t\t\tthrow new Error('Settings not found');\n\t\t}\n\n\t\t// Cache it\n\t\tawait this.redisService.cacheObject(key, settings);\n\n\t\treturn settings;\n\t}\n\n\t/**\n\t * Clear cached settings from Redis.\n\t */\n\tasync updateSettings(): Promise<string> {\n\t\tconst key = getSettingsKey();\n\t\tawait this.redisService.deleteCachedObject(key);\n\t\treturn 'Settings cache cleared successfully';\n\t}\n}\n\n// Export singleton instance for convenience\nexport const cachedSettingsService = Container.get(CachedSettingsService);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/cache/settings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,uCAA2C;AAC3C,+CAAkD;AAElD,MAAM,cAAc,GAAG,GAAW,EAAE;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ettingModel } from '../../mongo/models';\n\nconst getSettingsKey = (): string => {\n\tconst tenant = process.env.tenant || 'lb';\n\tconst environment = process.env.environment || 'dev';\n\treturn `settings:${tenant}:${environment}`;\n};\n\n@Service()\nexport class CachedSettingsService {\n\tconstructor(@Inject(() => RedisService) private readonly redisService: RedisService) {}\n\n\tasync getSettings(): Promise<any> {\n\t\tconst key = getSettingsKey();\n\n\t\tconst cached = await this.redisService.getCachedObject<any>(key);\n\t\tif (cached) return cached;\n\n\t\tconst settings = await SettingModel.findOne({}).lean().exec();\n\t\tif (!settings) throw new Error('Settings not found');\n\n\t\tawait this.redisService.cacheObject(key, settings);\n\t\treturn settings;\n\t}\n\n\tasync updateSettings(): Promise<string> {\n\t\tconst key = getSettingsKey();\n\t\tawait this.redisService.deleteCachedObject(key);\n\t\treturn 'Settings cache cleared successfully';\n\t}\n}\n"]}
@@ -8,6 +8,7 @@ import { UploadService } from './upload';
8
8
  import { FirebaseService } from './firebase';
9
9
  import { TokenRepository } from './auth/repository';
10
10
  import { MapService } from './map';
11
+ import { CachedSettingsService } from './cache/settings';
11
12
  export declare class LibraryManager {
12
13
  getLogger(): LyxaLogger;
13
14
  getMicroServiceDispatcher(): MicroServiceDispatcher;
@@ -20,4 +21,5 @@ export declare class LibraryManager {
20
21
  getGlobalUploadService(): UploadService;
21
22
  getTenetUploadService(): UploadService;
22
23
  getMapService(): MapService;
24
+ getCachedSettingsService(): CachedSettingsService;
23
25
  }
@@ -18,6 +18,7 @@ const upload_1 = require("./upload");
18
18
  const firebase_1 = require("./firebase");
19
19
  const repository_1 = require("./auth/repository");
20
20
  const map_1 = require("./map");
21
+ const settings_1 = require("./cache/settings");
21
22
  let LibraryManager = class LibraryManager {
22
23
  getLogger() {
23
24
  return typedi_1.Container.get(logger_1.LyxaLogger);
@@ -52,6 +53,9 @@ let LibraryManager = class LibraryManager {
52
53
  getMapService() {
53
54
  return typedi_1.Container.get(map_1.MapService);
54
55
  }
56
+ getCachedSettingsService() {
57
+ return typedi_1.Container.get(settings_1.CachedSettingsService);
58
+ }
55
59
  };
56
60
  exports.LibraryManager = LibraryManager;
57
61
  exports.LibraryManager = LibraryManager = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA4C;AAC5C,qCAAyC;AACzC,qCAAsC;AACtC,6CAAsD;AACtD,uCAAiD;AACjD,mCAAuC;AACvC,mDAAuD;AACvD,qCAAyC;AACzC,yCAA6C;AAC7C,kDAAoD;AACpD,+BAAmC;AAG5B,IAAM,cAAc,GAApB,MAAM,cAAc;IACnB,SAAS;QACf,OAAO,kBAAS,CAAC,GAAG,CAAC,mBAAU,CAAC,CAAC;IAClC,CAAC;IACM,yBAAyB;QAC/B,OAAO,kBAAS,CAAC,GAAG,CAAC,mCAAsB,CAAC,CAAC;IAC9C,CAAC;IACM,gBAAgB;QACtB,OAAO,kBAAS,CAAC,GAAG,CAAC,sBAAa,CAAC,CAAC;IACrC,CAAC;IACM,iBAAiB;QACvB,OAAO,kBAAS,CAAC,GAAG,CAAC,8BAAoB,CAAC,CAAC;IAC5C,CAAC;IACM,eAAe;QACrB,OAAO,kBAAS,CAAC,GAAG,CAAC,oBAAY,CAAC,CAAC;IACpC,CAAC;IACM,uBAAuB;QAC7B,OAAO,kBAAS,CAAC,GAAG,CAAC,oCAAoB,CAAC,CAAC;IAC5C,CAAC;IACM,kBAAkB;QACxB,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAe,CAAC,CAAC;IACvC,CAAC;IACM,sBAAsB;QAC5B,OAAO,kBAAS,CAAC,GAAG,CAAC,4BAAe,CAAC,CAAC;IACvC,CAAC;IACM,sBAAsB;QAC5B,OAAO,IAAI,sBAAa,EAAE,CAAC;IAC5B,CAAC;IACM,qBAAqB;QAC3B,OAAO,IAAI,sBAAa,CAAC,OAAO,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClF,CAAC;IACM,aAAa;QACnB,OAAO,kBAAS,CAAC,GAAG,CAAC,gBAAU,CAAC,CAAC;IAClC,CAAC;CACD,CAAA;AAlCY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,gBAAO,GAAE;GACG,cAAc,CAkC1B","sourcesContent":["import { Container, Service } from 'typedi';\nimport { TwilioService } from './twilio';\nimport { LyxaLogger } from './logger';\nimport { MicroServiceDispatcher } from './dispatcher';\nimport { SecretManagerService } from './secrets';\nimport { RedisService } from './redis';\nimport { ConfigurationService } from './configuration';\nimport { UploadService } from './upload';\nimport { FirebaseService } from './firebase';\nimport { TokenRepository } from './auth/repository';\nimport { MapService } from './map';\n\n@Service()\nexport class LibraryManager {\n\tpublic getLogger(): LyxaLogger {\n\t\treturn Container.get(LyxaLogger);\n\t}\n\tpublic getMicroServiceDispatcher(): MicroServiceDispatcher {\n\t\treturn Container.get(MicroServiceDispatcher);\n\t}\n\tpublic getTwilioService(): TwilioService {\n\t\treturn Container.get(TwilioService);\n\t}\n\tpublic getSecretsService(): SecretManagerService {\n\t\treturn Container.get(SecretManagerService);\n\t}\n\tpublic getRedisService(): RedisService {\n\t\treturn Container.get(RedisService);\n\t}\n\tpublic getConfigurationService(): ConfigurationService {\n\t\treturn Container.get(ConfigurationService);\n\t}\n\tpublic getFirebaseService(): FirebaseService {\n\t\treturn Container.get(FirebaseService);\n\t}\n\tpublic getAuthTokenRepository(): TokenRepository {\n\t\treturn Container.get(TokenRepository);\n\t}\n\tpublic getGlobalUploadService(): UploadService {\n\t\treturn new UploadService();\n\t}\n\tpublic getTenetUploadService(): UploadService {\n\t\treturn new UploadService('lyxa-' + this.getConfigurationService().options.tenet);\n\t}\n\tpublic getMapService(): MapService {\n\t\treturn Container.get(MapService);\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA4C;AAC5C,qCAAyC;AACzC,qCAAsC;AACtC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AAA,gBAAO,GAAE;GACG,cAAc,CAqC1B","sourcesContent":["import { Container, Service } from 'typedi';\nimport { TwilioService } from './twilio';\nimport { LyxaLogger } from './logger';\nimport { MicroServiceDispatcher } from './dispatcher';\nimport { SecretManagerService } from './secrets';\nimport { RedisService } from './redis';\nimport { ConfigurationService } from './configuration';\nimport { UploadService } from './upload';\nimport { FirebaseService } from './firebase';\nimport { TokenRepository } from './auth/repository';\nimport { MapService } from './map';\nimport { CachedSettingsService } from './cache/settings';\n\n@Service()\nexport class LibraryManager {\n\tpublic getLogger(): LyxaLogger {\n\t\treturn Container.get(LyxaLogger);\n\t}\n\tpublic getMicroServiceDispatcher(): MicroServiceDispatcher {\n\t\treturn Container.get(MicroServiceDispatcher);\n\t}\n\tpublic getTwilioService(): TwilioService {\n\t\treturn Container.get(TwilioService);\n\t}\n\tpublic getSecretsService(): SecretManagerService {\n\t\treturn Container.get(SecretManagerService);\n\t}\n\tpublic getRedisService(): RedisService {\n\t\treturn Container.get(RedisService);\n\t}\n\tpublic getConfigurationService(): ConfigurationService {\n\t\treturn Container.get(ConfigurationService);\n\t}\n\tpublic getFirebaseService(): FirebaseService {\n\t\treturn Container.get(FirebaseService);\n\t}\n\tpublic getAuthTokenRepository(): TokenRepository {\n\t\treturn Container.get(TokenRepository);\n\t}\n\tpublic getGlobalUploadService(): UploadService {\n\t\treturn new UploadService();\n\t}\n\tpublic getTenetUploadService(): UploadService {\n\t\treturn new UploadService('lyxa-' + this.getConfigurationService().options.tenet);\n\t}\n\tpublic getMapService(): MapService {\n\t\treturn Container.get(MapService);\n\t}\n\tpublic getCachedSettingsService(): CachedSettingsService {\n\t\treturn Container.get(CachedSettingsService);\n\t}\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { Ref } from '@typegoose/typegoose';
2
+ import { Shop } from '../shop.model';
3
+ import { Order } from '../order.model';
4
+ declare class UsedPoint {
5
+ amountUsed: number;
6
+ dateUsed: Date;
7
+ }
8
+ export declare class LoyaltyPoint {
9
+ points: number;
10
+ dateGenerated: Date;
11
+ dateExpiry: Date;
12
+ shop?: Ref<Shop>;
13
+ order?: Ref<Order>;
14
+ usedPoints: UsedPoint[];
15
+ }
16
+ export {};
@@ -0,0 +1,61 @@
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.LoyaltyPoint = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const shop_model_1 = require("../shop.model");
15
+ const order_model_1 = require("../order.model");
16
+ class UsedPoint {
17
+ amountUsed;
18
+ dateUsed;
19
+ }
20
+ __decorate([
21
+ (0, typegoose_1.prop)({ required: true }),
22
+ __metadata("design:type", Number)
23
+ ], UsedPoint.prototype, "amountUsed", void 0);
24
+ __decorate([
25
+ (0, typegoose_1.prop)({ required: true }),
26
+ __metadata("design:type", Date)
27
+ ], UsedPoint.prototype, "dateUsed", void 0);
28
+ class LoyaltyPoint {
29
+ points;
30
+ dateGenerated;
31
+ dateExpiry;
32
+ shop;
33
+ order;
34
+ usedPoints;
35
+ }
36
+ exports.LoyaltyPoint = LoyaltyPoint;
37
+ __decorate([
38
+ (0, typegoose_1.prop)({ required: true }),
39
+ __metadata("design:type", Number)
40
+ ], LoyaltyPoint.prototype, "points", void 0);
41
+ __decorate([
42
+ (0, typegoose_1.prop)({ required: true }),
43
+ __metadata("design:type", Date)
44
+ ], LoyaltyPoint.prototype, "dateGenerated", void 0);
45
+ __decorate([
46
+ (0, typegoose_1.prop)({ required: true }),
47
+ __metadata("design:type", Date)
48
+ ], LoyaltyPoint.prototype, "dateExpiry", void 0);
49
+ __decorate([
50
+ (0, typegoose_1.prop)({ ref: () => shop_model_1.Shop, required: true }),
51
+ __metadata("design:type", Object)
52
+ ], LoyaltyPoint.prototype, "shop", void 0);
53
+ __decorate([
54
+ (0, typegoose_1.prop)({ ref: () => order_model_1.Order, required: true }),
55
+ __metadata("design:type", Object)
56
+ ], LoyaltyPoint.prototype, "order", void 0);
57
+ __decorate([
58
+ (0, typegoose_1.prop)({ type: () => [UsedPoint], default: [] }),
59
+ __metadata("design:type", Array)
60
+ ], LoyaltyPoint.prototype, "usedPoints", void 0);
61
+ //# sourceMappingURL=loyaltyPoint.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loyaltyPoint.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/loyaltyPoint.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAAiD;AACjD,8CAAqC;AACrC,gDAAuC;AAEvC,MAAM,SAAS;IAEP,UAAU,CAAU;IAGpB,QAAQ,CAAQ;CACvB;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACE;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACP,IAAI;2CAAC;AAGxB,MAAa,YAAY;IAEjB,MAAM,CAAU;IAGhB,aAAa,CAAQ;IAGrB,UAAU,CAAQ;IAGlB,IAAI,CAAa;IAGjB,KAAK,CAAc;IAEnB,UAAU,CAAe;CAChC;AAjBD,oCAiBC;AAfO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACF;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACF,IAAI;mDAAC;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACL,IAAI;gDAAC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACjB;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gDACf","sourcesContent":["// loyaltyPoint.model.ts\nimport { prop, Ref } from '@typegoose/typegoose';\nimport { Shop } from '../shop.model';\nimport { Order } from '../order.model';\n\nclass UsedPoint {\n\t@prop({ required: true })\n\tpublic amountUsed!: number;\n\n\t@prop({ required: true })\n\tpublic dateUsed!: Date;\n}\n\nexport class LoyaltyPoint {\n\t@prop({ required: true })\n\tpublic points!: number;\n\n\t@prop({ required: true })\n\tpublic dateGenerated!: Date;\n\n\t@prop({ required: true })\n\tpublic dateExpiry!: Date;\n\n\t@prop({ ref: () => Shop, required: true })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ ref: () => Order, required: true })\n\tpublic order?: Ref<Order>;\n\t@prop({ type: () => [UsedPoint], default: [] })\n\tpublic usedPoints!: UsedPoint[];\n}\n"]}
@@ -2,10 +2,12 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
2
  import { PaymentInformation } from './payment-infromation.model';
3
3
  import { PaymentMethod } from '../../../../utilities/enum';
4
4
  import { RiderProfit } from './profit.model';
5
+ import { CashSettlement } from './cash-settlement.model';
5
6
  export declare class OrderFinance extends TimeStamps {
6
7
  exchangeRate?: number;
7
8
  paymentMethod?: PaymentMethod;
8
9
  paymentInformation?: PaymentInformation;
9
10
  riderProfit?: RiderProfit;
11
+ cashSettlement?: CashSettlement;
10
12
  processedAt?: Date;
11
13
  }
@@ -15,11 +15,13 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  const payment_infromation_model_1 = require("./payment-infromation.model");
16
16
  const enum_1 = require("../../../../utilities/enum");
17
17
  const profit_model_1 = require("./profit.model");
18
+ const cash_settlement_model_1 = require("./cash-settlement.model");
18
19
  class OrderFinance extends defaultClasses_1.TimeStamps {
19
20
  exchangeRate;
20
21
  paymentMethod;
21
22
  paymentInformation;
22
23
  riderProfit;
24
+ cashSettlement;
23
25
  processedAt;
24
26
  }
25
27
  exports.OrderFinance = OrderFinance;
@@ -39,6 +41,10 @@ __decorate([
39
41
  (0, typegoose_1.prop)({ type: () => profit_model_1.RiderProfit }),
40
42
  __metadata("design:type", profit_model_1.RiderProfit)
41
43
  ], OrderFinance.prototype, "riderProfit", void 0);
44
+ __decorate([
45
+ (0, typegoose_1.prop)({ type: () => cash_settlement_model_1.CashSettlement }),
46
+ __metadata("design:type", cash_settlement_model_1.CashSettlement)
47
+ ], OrderFinance.prototype, "cashSettlement", void 0);
42
48
  __decorate([
43
49
  (0, typegoose_1.prop)({ type: Date }),
44
50
  __metadata("design:type", Date)
@@ -1 +1 @@
1
- {"version":3,"file":"order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,4EAAqE;AACrE,2EAAiE;AACjE,qDAA2D;AAC3D,iDAA6C;AAE7C,MAAa,YAAa,SAAQ,2BAAU;IAEpC,YAAY,CAAU;IAGtB,aAAa,CAAiB;IAGrC,kBAAkB,CAAsB;IAGjC,WAAW,CAAe;IAG1B,WAAW,CAAQ;CAC1B;AAfD,oCAeC;AAbO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,OAAO,EAAE,oBAAa,CAAC,IAAI,EAAE,CAAC;;mDACpC;AAGrC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8CAAkB,EAAE,CAAC;8BACpB,8CAAkB;wDAAC;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,0BAAW,EAAE,CAAC;8BACb,0BAAW;iDAAC;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACA,IAAI;iDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { PaymentInformation } from './payment-infromation.model';\nimport { PaymentMethod } from '../../../../utilities/enum';\nimport { RiderProfit } from './profit.model';\n\nexport class OrderFinance extends TimeStamps {\n\t@prop({ type: Number, default: 1 })\n\tpublic exchangeRate?: number;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpublic paymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation })\n\tpaymentInformation?: PaymentInformation;\n\n\t@prop({ type: () => RiderProfit })\n\tpublic riderProfit?: RiderProfit;\n\n\t@prop({ type: Date })\n\tpublic processedAt?: Date;\n}\n"]}
1
+ {"version":3,"file":"order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,4EAAqE;AACrE,2EAAiE;AACjE,qDAA2D;AAC3D,iDAA6C;AAC7C,mEAAyD;AAEzD,MAAa,YAAa,SAAQ,2BAAU;IAEpC,YAAY,CAAU;IAGtB,aAAa,CAAiB;IAGrC,kBAAkB,CAAsB;IAGjC,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,WAAW,CAAQ;CAC1B;AAlBD,oCAkBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,OAAO,EAAE,oBAAa,CAAC,IAAI,EAAE,CAAC;;mDACpC;AAGrC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8CAAkB,EAAE,CAAC;8BACpB,8CAAkB;wDAAC;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,0BAAW,EAAE,CAAC;8BACb,0BAAW;iDAAC;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,CAAC;8BACb,sCAAc;oDAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACA,IAAI;iDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { PaymentInformation } from './payment-infromation.model';\nimport { PaymentMethod } from '../../../../utilities/enum';\nimport { RiderProfit } from './profit.model';\nimport { CashSettlement } from './cash-settlement.model';\n\nexport class OrderFinance extends TimeStamps {\n\t@prop({ type: Number, default: 1 })\n\tpublic exchangeRate?: number;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpublic paymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation })\n\tpaymentInformation?: PaymentInformation;\n\n\t@prop({ type: () => RiderProfit })\n\tpublic riderProfit?: RiderProfit;\n\n\t@prop({ type: () => CashSettlement })\n\tpublic cashSettlement?: CashSettlement;\n\n\t@prop({ type: Date })\n\tpublic processedAt?: Date;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Ref, mongoose } from '@typegoose/typegoose';
2
2
  import { Rider } from '../rider.model';
3
- import { FaqAccountType, ItemType, DeliveryStatus } from '../../../../utilities/enum';
3
+ import { FaqAccountType, DeliveryStatus, UserAppSectionItemType } from '../../../../utilities/enum';
4
4
  import { User } from '../user.model';
5
5
  import { Shop } from '../shop.model';
6
6
  import { IDistance, IDuration } from '../../../map/interfaces/IMapService';
@@ -14,7 +14,7 @@ export declare class TripLeg {
14
14
  orders?: mongoose.Types.ObjectId[];
15
15
  user?: Ref<User>;
16
16
  shop?: Ref<Shop>;
17
- shopType?: ItemType;
17
+ shopType?: UserAppSectionItemType;
18
18
  status?: DeliveryStatus;
19
19
  totalDistance?: IDistance;
20
20
  totalDuration?: IDuration;
@@ -79,7 +79,7 @@ __decorate([
79
79
  __decorate([
80
80
  (0, typegoose_1.prop)({
81
81
  type: String,
82
- enum: enum_1.ItemType,
82
+ enum: enum_1.UserAppSectionItemType,
83
83
  }),
84
84
  __metadata("design:type", String)
85
85
  ], TripLeg.prototype, "shopType", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"trip-leg.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/trip-leg.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2D;AAC3D,gDAAuC;AACvC,gDAAuC;AACvC,qDAAsF;AACtF,8CAAqC;AACrC,8CAAqC;AAGrC,MAAa,OAAO;IAEnB,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,QAAQ,CAAU;IAGlB,SAAS,CAAU;IAOnB,IAAI,CAAkB;IAGtB,KAAK,CAAc;IAGnB,MAAM,CAA6B;IAGnC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAMjB,QAAQ,CAAY;IAQpB,MAAM,CAAkB;IAGxB,aAAa,CAAa;IAG1B,aAAa,CAAa;IAG1B,qBAAqB,CAAc;IAGnC,QAAQ,CAAa;IAGrB,QAAQ,CA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gBAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;;sDACQ;AAGnC;IADC,IAAA,gBAAI,GAAE;;yCACc;AAGrB;IADC,IAAA,gBAAI,GAAE;;yCACc;AAKrB;IAHC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;KAChB,CAAC;;iDAC4B","sourcesContent":["import { Ref, prop, mongoose } from '@typegoose/typegoose';\nimport { Order } from '../order.model';\nimport { Rider } from '../rider.model';\nimport { FaqAccountType, ItemType, DeliveryStatus } from '../../../../utilities/enum';\nimport { User } from '../user.model';\nimport { Shop } from '../shop.model';\nimport { IDistance, IDuration } from '../../../map/interfaces/IMapService';\n\nexport class TripLeg {\n\t@prop({ type: String })\n\tname?: string;\n\n\t@prop({ type: String })\n\taddress?: string;\n\n\t@prop({ required: true, type: Number })\n\tlatitude?: number;\n\n\t@prop({ required: true, type: Number })\n\tlongitude?: number;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: FaqAccountType,\n\t\tdefault: FaqAccountType.RIDER,\n\t})\n\ttype?: FaqAccountType;\n\n\t@prop({ ref: () => Rider })\n\trider?: Ref<Rider>;\n\n\t@prop({ ref: () => Order })\n\torders?: mongoose.Types.ObjectId[];\n\n\t@prop({ ref: () => User })\n\tuser?: Ref<User>;\n\n\t@prop({ ref: () => Shop })\n\tshop?: Ref<Shop>;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: ItemType,\n\t})\n\tshopType?: ItemType;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: DeliveryStatus,\n\t\tdefault: DeliveryStatus.PENDING,\n\t\trequired: true,\n\t})\n\tstatus?: DeliveryStatus;\n\n\t@prop()\n\ttotalDistance?: IDistance;\n\n\t@prop()\n\ttotalDuration?: IDuration;\n\n\t@prop({ type: [[Number]] })\n\ttotalOverviewPolyline?: number[][];\n\n\t@prop()\n\tdistance?: IDistance;\n\n\t@prop()\n\tduration?: IDuration;\n\n\t@prop({\n\t\ttype: [[Number]],\n\t})\n\toverviewPolyline?: number[][];\n}\n"]}
1
+ {"version":3,"file":"trip-leg.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/trip-leg.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2D;AAC3D,gDAAuC;AACvC,gDAAuC;AACvC,qDAAoG;AACpG,8CAAqC;AACrC,8CAAqC;AAGrC,MAAa,OAAO;IAEnB,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,QAAQ,CAAU;IAGlB,SAAS,CAAU;IAOnB,IAAI,CAAkB;IAGtB,KAAK,CAAc;IAGnB,MAAM,CAA6B;IAGnC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAMjB,QAAQ,CAA0B;IAQlC,MAAM,CAAkB;IAGxB,aAAa,CAAa;IAG1B,aAAa,CAAa;IAG1B,qBAAqB,CAAc;IAGnC,QAAQ,CAAa;IAGrB,QAAQ,CAAa;IAKrB,gBAAgB,CAAc;CAC9B;AAjED,0BAiEC;AA/DA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qCACT;AAGd;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACN;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACrB;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACpB;AAOnB;IALC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,qBAAc;QACpB,OAAO,EAAE,qBAAc,CAAC,KAAK;KAC7B,CAAC;;qCACoB;AAGtB;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;sCACR;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;uCACQ;AAGnC;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;qCACT;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;qCACT;AAMjB;IAJC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,6BAAsB;KAC5B,CAAC;;yCACgC;AAQlC;IANC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,qBAAc;QACpB,OAAO,EAAE,qBAAc,CAAC,OAAO;QAC/B,QAAQ,EAAE,IAAI;KACd,CAAC;;uCACsB;AAGxB;IADC,IAAA,gBAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,gBAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;;sDACQ;AAGnC;IADC,IAAA,gBAAI,GAAE;;yCACc;AAGrB;IADC,IAAA,gBAAI,GAAE;;yCACc;AAKrB;IAHC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;KAChB,CAAC;;iDAC4B","sourcesContent":["import { Ref, prop, mongoose } from '@typegoose/typegoose';\nimport { Order } from '../order.model';\nimport { Rider } from '../rider.model';\nimport { FaqAccountType, DeliveryStatus, UserAppSectionItemType } from '../../../../utilities/enum';\nimport { User } from '../user.model';\nimport { Shop } from '../shop.model';\nimport { IDistance, IDuration } from '../../../map/interfaces/IMapService';\n\nexport class TripLeg {\n\t@prop({ type: String })\n\tname?: string;\n\n\t@prop({ type: String })\n\taddress?: string;\n\n\t@prop({ required: true, type: Number })\n\tlatitude?: number;\n\n\t@prop({ required: true, type: Number })\n\tlongitude?: number;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: FaqAccountType,\n\t\tdefault: FaqAccountType.RIDER,\n\t})\n\ttype?: FaqAccountType;\n\n\t@prop({ ref: () => Rider })\n\trider?: Ref<Rider>;\n\n\t@prop({ ref: () => Order })\n\torders?: mongoose.Types.ObjectId[];\n\n\t@prop({ ref: () => User })\n\tuser?: Ref<User>;\n\n\t@prop({ ref: () => Shop })\n\tshop?: Ref<Shop>;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: UserAppSectionItemType,\n\t})\n\tshopType?: UserAppSectionItemType;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: DeliveryStatus,\n\t\tdefault: DeliveryStatus.PENDING,\n\t\trequired: true,\n\t})\n\tstatus?: DeliveryStatus;\n\n\t@prop()\n\ttotalDistance?: IDistance;\n\n\t@prop()\n\ttotalDuration?: IDuration;\n\n\t@prop({ type: [[Number]] })\n\ttotalOverviewPolyline?: number[][];\n\n\t@prop()\n\tdistance?: IDistance;\n\n\t@prop()\n\tduration?: IDuration;\n\n\t@prop({\n\t\ttype: [[Number]],\n\t})\n\toverviewPolyline?: number[][];\n}\n"]}
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToSecondary = exports.roundCurrency = void 0;
4
- const settings_1 = require("../libraries/cache/settings");
4
+ const __1 = require("..");
5
5
  const enum_1 = require("./enum");
6
6
  const DEFAULT_ROUNDING_FACTOR = 0.01;
7
7
  const DEFAULT_EXCHANGE_RATE = 1;
8
8
  const getRoundingFactor = async (currency) => {
9
- const settings = (await settings_1.cachedSettingsService.getSettings());
10
- const currencySetting = settings.currencySetting;
9
+ const settingsService = (0, __1.getLibraries)().getCachedSettingsService();
10
+ const setting = (await (0, __1.getLibraries)().getCachedSettingsService().getSettings());
11
+ const currencySetting = setting.currencySetting;
11
12
  let roundingFactor;
12
13
  if (currencySetting) {
13
14
  switch (currency) {
@@ -25,7 +26,7 @@ const getRoundingFactor = async (currency) => {
25
26
  return roundingFactor || DEFAULT_ROUNDING_FACTOR;
26
27
  };
27
28
  const getExchangeRate = async () => {
28
- const settings = (await settings_1.cachedSettingsService.getSettings());
29
+ const settings = (await (0, __1.getLibraries)().getCachedSettingsService().getSettings());
29
30
  const currencySetting = settings.currencySetting;
30
31
  return currencySetting?.exchangeRate || DEFAULT_EXCHANGE_RATE;
31
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"currency.js","sourceRoot":"/","sources":["utilities/currency.ts"],"names":[],"mappings":";;;AAAA,0DAAoE;AAEpE,iCAAsC;AAEtC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,iBAAiB,GAAG,KAAK,EAAE,QAAsB,EAAmB,EAAE;IAC3E,MAAM,QAAQ,GAAG,CAAC,MAAM,gCAAqB,CAAC,WAAW,EAAE,CAAY,CAAC;IACxE,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;IACjD,IAAI,cAAkC,CAAC;IACvC,IAAI,eAAe,EAAE,CAAC;QACrB,QAAQ,QAAQ,EAAE,CAAC;YAClB,KAAK,mBAAY,CAAC,IAAI;gBACrB,cAAc,GAAG,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC;gBACvD,MAAM;YACP,KAAK,mBAAY,CAAC,SAAS;gBAC1B,cAAc,GAAG,eAAe,CAAC,iBAAiB,EAAE,OAAO,CAAC;gBAC5D,MAAM;YACP;gBACC,cAAc,GAAG,uBAAuB,CAAC;gBACzC,MAAM;QACR,CAAC;IACF,CAAC;IACD,OAAO,cAAc,IAAI,uBAAuB,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IACnD,MAAM,QAAQ,GAAG,CAAC,MAAM,gCAAqB,CAAC,WAAW,EAAE,CAAY,CAAC;IACxE,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;IACjD,OAAO,eAAe,EAAE,YAAY,IAAI,qBAAqB,CAAC;AAC/D,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAE,QAAsB,EAAmB,EAAE;IAC9F,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,cAAc,CAAC;AAC7D,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB;AAEK,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;IAC3E,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;IAC5C,OAAO,IAAA,qBAAa,EAAC,MAAM,GAAG,WAAW,EAAE,mBAAY,CAAC,SAAS,CAAC,CAAC;AACpE,CAAC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B","sourcesContent":["import { cachedSettingsService } from '../libraries/cache/settings';\nimport { Setting } from '../libraries/mongo/models';\nimport { PaidCurrency } from './enum';\n\nconst DEFAULT_ROUNDING_FACTOR = 0.01;\nconst DEFAULT_EXCHANGE_RATE = 1;\n\nconst getRoundingFactor = async (currency: PaidCurrency): Promise<number> => {\n\tconst settings = (await cachedSettingsService.getSettings()) as Setting;\n\tconst currencySetting = settings.currencySetting;\n\tlet roundingFactor: number | undefined;\n\tif (currencySetting) {\n\t\tswitch (currency) {\n\t\t\tcase PaidCurrency.BASE:\n\t\t\t\troundingFactor = currencySetting.baseCurrency?.roundTo;\n\t\t\t\tbreak;\n\t\t\tcase PaidCurrency.SECONDARY:\n\t\t\t\troundingFactor = currencySetting.secondaryCurrency?.roundTo;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\troundingFactor = DEFAULT_ROUNDING_FACTOR;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn roundingFactor || DEFAULT_ROUNDING_FACTOR;\n};\n\nconst getExchangeRate = async (): Promise<number> => {\n\tconst settings = (await cachedSettingsService.getSettings()) as Setting;\n\tconst currencySetting = settings.currencySetting;\n\treturn currencySetting?.exchangeRate || DEFAULT_EXCHANGE_RATE;\n};\n\nexport const roundCurrency = async (amount: number, currency: PaidCurrency): Promise<number> => {\n\tconst roundingFactor = await getRoundingFactor(currency);\n\treturn Math.round(amount / roundingFactor) * roundingFactor;\n};\n\nexport const convertToSecondary = async (amount: number): Promise<number> => {\n\tconst exchageRate = await getExchangeRate();\n\treturn roundCurrency(amount * exchageRate, PaidCurrency.SECONDARY);\n};\n"]}
1
+ {"version":3,"file":"currency.js","sourceRoot":"/","sources":["utilities/currency.ts"],"names":[],"mappings":";;;AAAA,0BAAkC;AAGlC,iCAAsC;AAEtC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,iBAAiB,GAAG,KAAK,EAAE,QAAsB,EAAmB,EAAE;IAC3E,MAAM,eAAe,GAAG,IAAA,gBAAY,GAAE,CAAC,wBAAwB,EAAE,CAAC;IAClE,MAAM,OAAO,GAAG,CAAC,MAAM,IAAA,gBAAY,GAAE,CAAC,wBAAwB,EAAE,CAAC,WAAW,EAAE,CAAY,CAAC;IAC3F,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAChD,IAAI,cAAkC,CAAC;IACvC,IAAI,eAAe,EAAE,CAAC;QACrB,QAAQ,QAAQ,EAAE,CAAC;YAClB,KAAK,mBAAY,CAAC,IAAI;gBACrB,cAAc,GAAG,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC;gBACvD,MAAM;YACP,KAAK,mBAAY,CAAC,SAAS;gBAC1B,cAAc,GAAG,eAAe,CAAC,iBAAiB,EAAE,OAAO,CAAC;gBAC5D,MAAM;YACP;gBACC,cAAc,GAAG,uBAAuB,CAAC;gBACzC,MAAM;QACR,CAAC;IACF,CAAC;IACD,OAAO,cAAc,IAAI,uBAAuB,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IACnD,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAA,gBAAY,GAAE,CAAC,wBAAwB,EAAE,CAAC,WAAW,EAAE,CAAY,CAAC;IAC5F,MAAM,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;IACjD,OAAO,eAAe,EAAE,YAAY,IAAI,qBAAqB,CAAC;AAC/D,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAE,QAAsB,EAAmB,EAAE;IAC9F,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,cAAc,CAAC;AAC7D,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB;AAEK,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAc,EAAmB,EAAE;IAC3E,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;IAC5C,OAAO,IAAA,qBAAa,EAAC,MAAM,GAAG,WAAW,EAAE,mBAAY,CAAC,SAAS,CAAC,CAAC;AACpE,CAAC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B","sourcesContent":["import { getLibraries } from '..';\n\nimport { Setting } from '../libraries/mongo/models';\nimport { PaidCurrency } from './enum';\n\nconst DEFAULT_ROUNDING_FACTOR = 0.01;\nconst DEFAULT_EXCHANGE_RATE = 1;\n\nconst getRoundingFactor = async (currency: PaidCurrency): Promise<number> => {\n\tconst settingsService = getLibraries().getCachedSettingsService();\n\tconst setting = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\tconst currencySetting = setting.currencySetting;\n\tlet roundingFactor: number | undefined;\n\tif (currencySetting) {\n\t\tswitch (currency) {\n\t\t\tcase PaidCurrency.BASE:\n\t\t\t\troundingFactor = currencySetting.baseCurrency?.roundTo;\n\t\t\t\tbreak;\n\t\t\tcase PaidCurrency.SECONDARY:\n\t\t\t\troundingFactor = currencySetting.secondaryCurrency?.roundTo;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\troundingFactor = DEFAULT_ROUNDING_FACTOR;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn roundingFactor || DEFAULT_ROUNDING_FACTOR;\n};\n\nconst getExchangeRate = async (): Promise<number> => {\n\tconst settings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\tconst currencySetting = settings.currencySetting;\n\treturn currencySetting?.exchangeRate || DEFAULT_EXCHANGE_RATE;\n};\n\nexport const roundCurrency = async (amount: number, currency: PaidCurrency): Promise<number> => {\n\tconst roundingFactor = await getRoundingFactor(currency);\n\treturn Math.round(amount / roundingFactor) * roundingFactor;\n};\n\nexport const convertToSecondary = async (amount: number): Promise<number> => {\n\tconst exchageRate = await getExchangeRate();\n\treturn roundCurrency(amount * exchageRate, PaidCurrency.SECONDARY);\n};\n"]}
@@ -195,7 +195,7 @@ export declare const AddressSchema: z.ZodObject<{
195
195
  description?: string | undefined;
196
196
  zone?: string | import("mongoose").Types.ObjectId | undefined;
197
197
  }>;
198
- export declare const UserAddressSchema: z.ZodObject<{
198
+ export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
199
199
  address: z.ZodString;
200
200
  description: z.ZodOptional<z.ZodString>;
201
201
  city: z.ZodString;
@@ -214,13 +214,13 @@ export declare const UserAddressSchema: z.ZodObject<{
214
214
  latitude: z.ZodNumber;
215
215
  longitude: z.ZodNumber;
216
216
  zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
217
- } & {
217
+ }, {
218
218
  addressLabel: z.ZodString;
219
219
  apartment: z.ZodString;
220
220
  buildingName: z.ZodString;
221
221
  deliveryOption: z.ZodOptional<z.ZodString>;
222
222
  instructions: z.ZodOptional<z.ZodString>;
223
- }, "strip", z.ZodTypeAny, {
223
+ }>, "strip", z.ZodTypeAny, {
224
224
  location: {
225
225
  type: GeoLocationType;
226
226
  coordinates: [number, number];
@@ -257,7 +257,7 @@ export declare const UserAddressSchema: z.ZodObject<{
257
257
  deliveryOption?: string | undefined;
258
258
  instructions?: string | undefined;
259
259
  }>;
260
- export declare const CourierAddressSchema: z.ZodObject<{
260
+ export declare const CourierAddressSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
261
261
  address: z.ZodString;
262
262
  description: z.ZodOptional<z.ZodString>;
263
263
  city: z.ZodString;
@@ -276,16 +276,16 @@ export declare const CourierAddressSchema: z.ZodObject<{
276
276
  latitude: z.ZodNumber;
277
277
  longitude: z.ZodNumber;
278
278
  zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
279
- } & {
279
+ }, {
280
280
  addressLabel: z.ZodString;
281
281
  apartment: z.ZodString;
282
282
  buildingName: z.ZodString;
283
283
  deliveryOption: z.ZodOptional<z.ZodString>;
284
284
  instructions: z.ZodOptional<z.ZodString>;
285
- } & {
285
+ }>, {
286
286
  name: z.ZodString;
287
287
  phoneNumber: z.ZodString;
288
- }, "strip", z.ZodTypeAny, {
288
+ }>, "strip", z.ZodTypeAny, {
289
289
  name: string;
290
290
  location: {
291
291
  type: GeoLocationType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -1,9 +0,0 @@
1
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
- import { ItemType, SectionType, Status } from '../../../utilities/enum';
3
- export declare class AppScreenSetting extends TimeStamps {
4
- itemType: ItemType;
5
- section: SectionType;
6
- alias: string;
7
- status?: Status;
8
- sortingOrder?: number;
9
- }
@@ -1,72 +0,0 @@
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.AppScreenSetting = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const enum_1 = require("../../../utilities/enum");
16
- const _1 = require(".");
17
- let AppScreenSetting = class AppScreenSetting extends defaultClasses_1.TimeStamps {
18
- itemType;
19
- section;
20
- alias;
21
- status;
22
- sortingOrder;
23
- };
24
- exports.AppScreenSetting = AppScreenSetting;
25
- __decorate([
26
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType }),
27
- __metadata("design:type", String)
28
- ], AppScreenSetting.prototype, "itemType", void 0);
29
- __decorate([
30
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.SectionType }),
31
- __metadata("design:type", String)
32
- ], AppScreenSetting.prototype, "section", void 0);
33
- __decorate([
34
- (0, typegoose_1.prop)({ required: true, type: String }),
35
- __metadata("design:type", String)
36
- ], AppScreenSetting.prototype, "alias", void 0);
37
- __decorate([
38
- (0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
39
- __metadata("design:type", String)
40
- ], AppScreenSetting.prototype, "status", void 0);
41
- __decorate([
42
- (0, typegoose_1.prop)({ type: Number }),
43
- __metadata("design:type", Number)
44
- ], AppScreenSetting.prototype, "sortingOrder", void 0);
45
- exports.AppScreenSetting = AppScreenSetting = __decorate([
46
- (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'appScreenSettings' } }),
47
- (0, typegoose_1.pre)('save', async function (next) {
48
- if (this.isNew || typeof this.sortingOrder === 'undefined') {
49
- try {
50
- const maxSortingOrder = await _1.AppScreenSettingModel.aggregate([
51
- {
52
- $match: {
53
- deletedAt: null,
54
- },
55
- },
56
- {
57
- $group: {
58
- _id: null,
59
- maxSortingOrder: { $max: '$sortingOrder' },
60
- },
61
- },
62
- ]).exec();
63
- this.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;
64
- }
65
- catch (error) {
66
- return next(error);
67
- }
68
- }
69
- next();
70
- })
71
- ], AppScreenSetting);
72
- //# sourceMappingURL=app-screen-setting.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-screen-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/app-screen-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,kDAAwE;AACxE,wBAA0C;AA8BnC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAU;IAExC,QAAQ,CAAY;IAGpB,OAAO,CAAe;IAGtB,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAfY,4CAAgB;AAErB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;kDAC5B;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,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, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, SectionType, Status } from '../../../utilities/enum';\nimport { AppScreenSettingModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'appScreenSettings' } })\n@pre<AppScreenSetting>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder that aren't deleted\n\t\t\tconst maxSortingOrder = await AppScreenSettingModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class AppScreenSetting extends TimeStamps {\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, type: String, enum: SectionType })\n\tpublic section!: SectionType;\n\n\t@prop({ required: true, type: String })\n\tpublic alias!: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -1,17 +0,0 @@
1
- import { Ref } from '@typegoose/typegoose';
2
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { Order } from './order.model';
4
- import { PaymentMethod, PaymentStatus } from '../../../utilities/enum';
5
- import { PaymentInformation } from './embedded/payment-infromation.model';
6
- import { PaymentAttempt } from './embedded/payment-attempt.model';
7
- export declare class OrderPayment extends TimeStamps {
8
- order: Ref<Order>;
9
- paymentMethod?: PaymentMethod;
10
- paymentInformation?: PaymentInformation;
11
- status?: PaymentStatus;
12
- receiptUrl?: string;
13
- attempts?: PaymentAttempt[];
14
- currency: string;
15
- amount: number;
16
- secondaryAmount?: number;
17
- }
@@ -1,84 +0,0 @@
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.OrderPayment = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const order_model_1 = require("./order.model");
16
- const enum_1 = require("../../../utilities/enum");
17
- const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
18
- const payment_attempt_model_1 = require("./embedded/payment-attempt.model");
19
- let OrderPayment = class OrderPayment extends defaultClasses_1.TimeStamps {
20
- order;
21
- paymentMethod;
22
- paymentInformation;
23
- status;
24
- receiptUrl;
25
- attempts;
26
- currency;
27
- amount;
28
- secondaryAmount;
29
- };
30
- exports.OrderPayment = OrderPayment;
31
- __decorate([
32
- (0, typegoose_1.prop)({ required: true, ref: () => order_model_1.Order, index: true, unique: true }),
33
- __metadata("design:type", Object)
34
- ], OrderPayment.prototype, "order", void 0);
35
- __decorate([
36
- (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentMethod, default: enum_1.PaymentMethod.CASH }),
37
- __metadata("design:type", String)
38
- ], OrderPayment.prototype, "paymentMethod", void 0);
39
- __decorate([
40
- (0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation }),
41
- __metadata("design:type", payment_infromation_model_1.PaymentInformation)
42
- ], OrderPayment.prototype, "paymentInformation", void 0);
43
- __decorate([
44
- (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentStatus, default: enum_1.PaymentStatus.PENDING }),
45
- __metadata("design:type", String)
46
- ], OrderPayment.prototype, "status", void 0);
47
- __decorate([
48
- (0, typegoose_1.prop)(),
49
- __metadata("design:type", String)
50
- ], OrderPayment.prototype, "receiptUrl", void 0);
51
- __decorate([
52
- (0, typegoose_1.prop)({ type: [payment_attempt_model_1.PaymentAttempt], default: [] }),
53
- __metadata("design:type", Array)
54
- ], OrderPayment.prototype, "attempts", void 0);
55
- __decorate([
56
- (0, typegoose_1.prop)({ type: String }),
57
- __metadata("design:type", String)
58
- ], OrderPayment.prototype, "currency", void 0);
59
- __decorate([
60
- (0, typegoose_1.prop)({ required: true, type: Number }),
61
- __metadata("design:type", Number)
62
- ], OrderPayment.prototype, "amount", void 0);
63
- __decorate([
64
- (0, typegoose_1.prop)({ type: Number }),
65
- __metadata("design:type", Number)
66
- ], OrderPayment.prototype, "secondaryAmount", void 0);
67
- exports.OrderPayment = OrderPayment = __decorate([
68
- (0, typegoose_1.modelOptions)({
69
- schemaOptions: {
70
- timestamps: true,
71
- collection: 'orderPayments',
72
- toJSON: { virtuals: true },
73
- toObject: { virtuals: true },
74
- },
75
- options: {
76
- allowMixed: typegoose_1.Severity.ALLOW,
77
- },
78
- }),
79
- (0, typegoose_1.index)({ order: 1 }),
80
- (0, typegoose_1.index)({ status: 1 }),
81
- (0, typegoose_1.index)({ paymentMethod: 1 }),
82
- (0, typegoose_1.index)({ createdAt: -1 })
83
- ], OrderPayment);
84
- //# sourceMappingURL=order-payment.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"order-payment.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-payment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,+CAAsC;AACtC,kDAAuE;AACvE,oFAA0E;AAC1E,4EAAkE;AAiB3D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,2BAAU;IAE3C,KAAK,CAAa;IAGlB,aAAa,CAAiB;IAG9B,kBAAkB,CAAsB;IAGxC,MAAM,CAAiB;IAGvB,UAAU,CAAU;IAGpB,QAAQ,CAAoB;IAG5B,QAAQ,CAAS;IAGjB,MAAM,CAAS;IAGf,eAAe,CAAU;CACzB,CAAA;AA3BY,oCAAY;AAExB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;2CACpD;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,OAAO,EAAE,oBAAa,CAAC,IAAI,EAAE,CAAC;;mDAC3C;AAG9B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8CAAkB,EAAE,CAAC;8BACpB,8CAAkB;wDAAC;AAGxC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,OAAO,EAAE,oBAAa,CAAC,OAAO,EAAE,CAAC;;4CACrD;AAGvB;IADC,IAAA,gBAAI,GAAE;;gDACa;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,sCAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;8CAClB;AAG5B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACN;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACxB;AAGf;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACE;uBA1Bb,YAAY;IAfxB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,eAAe;YAC3B,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,KAAK,EAAE,CAAC,EAAE,CAAC;IACnB,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpB,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;GACZ,YAAY,CA2BxB","sourcesContent":["import { index, modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Order } from './order.model';\nimport { PaymentMethod, PaymentStatus } from '../../../utilities/enum';\nimport { PaymentInformation } from './embedded/payment-infromation.model';\nimport { PaymentAttempt } from './embedded/payment-attempt.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\ttimestamps: true,\n\t\tcollection: 'orderPayments',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ order: 1 })\n@index({ status: 1 })\n@index({ paymentMethod: 1 })\n@index({ createdAt: -1 })\nexport class OrderPayment extends TimeStamps {\n\t@prop({ required: true, ref: () => Order, index: true, unique: true })\n\torder: Ref<Order>;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpaymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation })\n\tpaymentInformation?: PaymentInformation;\n\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\n\tstatus?: PaymentStatus;\n\n\t@prop()\n\treceiptUrl?: string;\n\n\t@prop({ type: [PaymentAttempt], default: [] })\n\tattempts?: PaymentAttempt[];\n\n\t@prop({ type: String })\n\tcurrency: string;\n\n\t@prop({ required: true, type: Number })\n\tamount: number;\n\n\t@prop({ type: Number })\n\tsecondaryAmount?: number;\n}\n"]}