@lyxa.ai/core 1.0.68 → 1.0.70

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 (27) hide show
  1. package/dist/libraries/mongo/models/embedded/currency.model.d.ts +1 -0
  2. package/dist/libraries/mongo/models/embedded/currency.model.js +5 -0
  3. package/dist/libraries/mongo/models/embedded/currency.model.js.map +1 -1
  4. package/dist/libraries/mongo/models/filter-container.model.d.ts +2 -2
  5. package/dist/libraries/mongo/models/filter-container.model.js.map +1 -1
  6. package/dist/libraries/mongo/models/line-item.model.d.ts +8 -1
  7. package/dist/libraries/mongo/models/line-item.model.js +23 -0
  8. package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
  9. package/dist/libraries/mongo/models/list-container.model.d.ts +2 -2
  10. package/dist/libraries/mongo/models/list-container.model.js +1 -1
  11. package/dist/libraries/mongo/models/list-container.model.js.map +1 -1
  12. package/dist/utilities/currency.d.ts +3 -0
  13. package/dist/utilities/currency.js +42 -0
  14. package/dist/utilities/currency.js.map +1 -0
  15. package/package.json +1 -1
  16. package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +0 -9
  17. package/dist/libraries/mongo/models/app-screen-setting.model.js +0 -72
  18. package/dist/libraries/mongo/models/app-screen-setting.model.js.map +0 -1
  19. package/dist/libraries/mongo/models/order-payment.model.d.ts +0 -17
  20. package/dist/libraries/mongo/models/order-payment.model.js +0 -84
  21. package/dist/libraries/mongo/models/order-payment.model.js.map +0 -1
  22. package/dist/libraries/mongo/models/providers/courier-order-finance.model.d.ts +0 -7
  23. package/dist/libraries/mongo/models/providers/courier-order-finance.model.js +0 -26
  24. package/dist/libraries/mongo/models/providers/courier-order-finance.model.js.map +0 -1
  25. package/dist/libraries/mongo/models/providers/regular-order-finance.model.d.ts +0 -25
  26. package/dist/libraries/mongo/models/providers/regular-order-finance.model.js +0 -95
  27. package/dist/libraries/mongo/models/providers/regular-order-finance.model.js.map +0 -1
@@ -2,4 +2,5 @@ export declare class Currency {
2
2
  symbol?: string;
3
3
  name: string;
4
4
  code?: string;
5
+ roundTo?: number;
5
6
  }
@@ -15,6 +15,7 @@ class Currency {
15
15
  symbol;
16
16
  name;
17
17
  code;
18
+ roundTo;
18
19
  }
19
20
  exports.Currency = Currency;
20
21
  __decorate([
@@ -29,4 +30,8 @@ __decorate([
29
30
  (0, typegoose_1.prop)({ type: String }),
30
31
  __metadata("design:type", String)
31
32
  ], Currency.prototype, "code", void 0);
33
+ __decorate([
34
+ (0, typegoose_1.prop)({ type: Number, default: 0.01 }),
35
+ __metadata("design:type", Number)
36
+ ], Currency.prototype, "roundTo", void 0);
32
37
  //# sourceMappingURL=currency.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/currency.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,QAAQ;IAEb,MAAM,CAAU;IAGhB,IAAI,CAAU;IAGd,IAAI,CAAU;CACrB;AATD,4BASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACA;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACF","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class Currency {\n\t@prop({ type: String })\n\tpublic symbol?: string;\n\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic code?: string;\n}\n"]}
1
+ {"version":3,"file":"currency.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/currency.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,QAAQ;IAEb,MAAM,CAAU;IAGhB,IAAI,CAAU;IAGd,IAAI,CAAU;IAGd,OAAO,CAAU;CACxB;AAZD,4BAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACA;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACF;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yCACd","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class Currency {\n\t@prop({ type: String })\n\tpublic symbol?: string;\n\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic code?: string;\n\n\t@prop({ type: Number, default: 0.01 })\n\tpublic roundTo?: number;\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
- import { ItemType, Status } from '../../../utilities/enum';
2
+ import { Status, UserAppSectionItemType } from '../../../utilities/enum';
3
3
  export declare class FilterContainer extends TimeStamps {
4
4
  name: string;
5
5
  deals: string[];
6
- itemType?: ItemType;
6
+ itemType?: UserAppSectionItemType;
7
7
  status?: Status;
8
8
  sortingOrder?: number;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"filter-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/filter-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAA2D;AAC3D,wBAAyC;AAgClC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,KAAK,CAAY;IAGjB,QAAQ,CAAY;IAGpB,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAfY,0CAAe;AAEpB;IADN,IAAA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E,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,eAAe,CAe3B","sourcesContent":["import { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status } from '../../../utilities/enum';\nimport { FilterContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'filterContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<FilterContainer>('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 for filterContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await FilterContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\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 FilterContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: [String] })\n\tpublic deals!: string[]; // e.g., \"5\", \"10\", \"20\", \"30\", \"double_menu\"\n\n\t@prop({ type: String, enum: ItemType })\n\tpublic itemType?: ItemType;\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
+ {"version":3,"file":"filter-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/filter-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAmF;AACnF,wBAAyC;AAgClC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,KAAK,CAAY;IAGjB,QAAQ,CAA0B;IAGlC,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAfY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;;8CACjB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;iDACE;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;+CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACM;0BAdjB,eAAe;IA9B3B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,EAAE,CAAC;IACnE,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,IAAA,eAAG,EAAkB,MAAM,EAAE,KAAK,WAAW,IAAI;QAEjD,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,uBAAoB,CAAC,SAAS,CAA8B;oBACzF;wBACC,MAAM,EAAE;4BACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,eAAe,CAe3B","sourcesContent":["import { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { FilterContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'filterContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<FilterContainer>('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 for filterContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await FilterContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\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 FilterContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: [String] })\n\tpublic deals!: string[]; // e.g., \"5\", \"10\", \"20\", \"30\", \"double_menu\"\n\n\t@prop({ type: String, enum: ItemType })\n\tpublic itemType?: UserAppSectionItemType;\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"]}
@@ -3,12 +3,19 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { Cart } from './cart.model';
4
4
  import { Product } from './product.model';
5
5
  import { PriceBreakdown } from './embedded/price-breakdown.model';
6
- import { PriceOption } from '../../../utilities/enum';
6
+ import { ItemType, PriceOption } from '../../../utilities/enum';
7
7
  import { LineItemAttribute } from './embedded/line-item-attribute.model';
8
8
  import { User } from './user.model';
9
+ import { Shop } from './shop.model';
10
+ import { Parent } from './parent.model';
11
+ import { Category } from './category.model';
9
12
  export declare class LineItem extends TimeStamps {
10
13
  cart: Ref<Cart>;
11
14
  user: Ref<User>;
15
+ shop: Ref<Shop>;
16
+ parent: Ref<Parent>;
17
+ itemType: ItemType;
18
+ category: Ref<Category>;
12
19
  product: Ref<Product>;
13
20
  quantity?: number;
14
21
  priceOption?: PriceOption;
@@ -18,9 +18,16 @@ const price_breakdown_model_1 = require("./embedded/price-breakdown.model");
18
18
  const enum_1 = require("../../../utilities/enum");
19
19
  const line_item_attribute_model_1 = require("./embedded/line-item-attribute.model");
20
20
  const user_model_1 = require("./user.model");
21
+ const shop_model_1 = require("./shop.model");
22
+ const parent_model_1 = require("./parent.model");
23
+ const category_model_1 = require("./category.model");
21
24
  let LineItem = class LineItem extends defaultClasses_1.TimeStamps {
22
25
  cart;
23
26
  user;
27
+ shop;
28
+ parent;
29
+ itemType;
30
+ category;
24
31
  product;
25
32
  quantity;
26
33
  priceOption;
@@ -38,6 +45,22 @@ __decorate([
38
45
  (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
39
46
  __metadata("design:type", Object)
40
47
  ], LineItem.prototype, "user", void 0);
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop }),
50
+ __metadata("design:type", Object)
51
+ ], LineItem.prototype, "shop", void 0);
52
+ __decorate([
53
+ (0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent }),
54
+ __metadata("design:type", Object)
55
+ ], LineItem.prototype, "parent", void 0);
56
+ __decorate([
57
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType }),
58
+ __metadata("design:type", String)
59
+ ], LineItem.prototype, "itemType", void 0);
60
+ __decorate([
61
+ (0, typegoose_1.prop)({ required: true, ref: () => category_model_1.Category }),
62
+ __metadata("design:type", Object)
63
+ ], LineItem.prototype, "category", void 0);
41
64
  __decorate([
42
65
  (0, typegoose_1.prop)({ required: true, ref: () => product_model_1.Product }),
43
66
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6CAAoC;AACpC,mDAA0C;AAC1C,4EAAkE;AAClE,kDAAsD;AACtD,oFAAyE;AACzE,6CAAoC;AAkB7B,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IA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QAAQ;IAbpB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,WAAW;YACvB,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,CAAC;IAClB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;GACT,QAAQ,CA2BpB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Cart } from './cart.model';\nimport { Product } from './product.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { PriceOption } from '../../../utilities/enum';\nimport { LineItemAttribute } from './embedded/line-item-attribute.model';\nimport { User } from './user.model';\n\n/**\n * LineItem model - Represents individual items in a cart\n */\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'lineItems',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ cart: 1 })\n@index({ cart: 1, user: 1 })\n@index({ product: 1 })\nexport class LineItem extends TimeStamps {\n\t@prop({ required: true, ref: () => Cart })\n\tpublic cart!: Ref<Cart>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Product })\n\tpublic product!: Ref<Product>;\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: PriceBreakdown })\n\tpublic priceBreakdown: PriceBreakdown;\n\n\t@prop({ type: () => [LineItemAttribute], default: [] })\n\tpublic attributes?: LineItemAttribute[];\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic removedIngredients?: string[];\n\n\t@prop()\n\tpublic specialInstructions?: string;\n}\n"]}
1
+ {"version":3,"file":"line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6CAAoC;AACpC,mDAA0C;AAC1C,4EAAkE;AAClE,kDAAgE;AAChE,oFAAyE;AACzE,6CAAoC;AACpC,6CAAoC;AACpC,iDAAwC;AACxC,qDAA4C;AAkBrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IAEhC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB,QAAQ,CAAiB;IAGzB,OAAO,CAAgB;IAGvB,QAAQ,CAAU;IAGlB,WAAW,CAAe;IAG1B,cAAc,CAAiB;IAG/B,UAAU,CAAuB;IAGjC,kBAAkB,CAAY;IAG9B,mBAAmB,CAAU;CACpC,CAAA;AAvCY,4BAAQ;AAEb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;sCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;sCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;sCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAA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B,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,CAAC;IAClB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;GACT,QAAQ,CAuCpB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Cart } from './cart.model';\nimport { Product } from './product.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { ItemType, PriceOption } from '../../../utilities/enum';\nimport { LineItemAttribute } from './embedded/line-item-attribute.model';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Parent } from './parent.model';\nimport { Category } from './category.model';\n\n/**\n * LineItem model - Represents individual items in a cart\n */\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'lineItems',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ cart: 1 })\n@index({ cart: 1, user: 1 })\n@index({ product: 1 })\nexport class LineItem extends TimeStamps {\n\t@prop({ required: true, ref: () => Cart })\n\tpublic cart!: Ref<Cart>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent: Ref<Parent>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, ref: () => Category })\n\tpublic category!: Ref<Category>;\n\n\t@prop({ required: true, ref: () => Product })\n\tpublic product!: Ref<Product>;\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: PriceBreakdown })\n\tpublic priceBreakdown: PriceBreakdown;\n\n\t@prop({ type: () => [LineItemAttribute], default: [] })\n\tpublic attributes?: LineItemAttribute[];\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic removedIngredients?: string[];\n\n\t@prop()\n\tpublic specialInstructions?: string;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { ItemType, Status } from '../../../utilities/enum';
3
+ import { Status, UserAppSectionItemType } from '../../../utilities/enum';
4
4
  import { Shop } from './shop.model';
5
5
  import { Tag } from './tag.model';
6
6
  export declare class ListContainer extends TimeStamps {
@@ -10,7 +10,7 @@ export declare class ListContainer extends TimeStamps {
10
10
  deals?: string[];
11
11
  tags?: Ref<Tag>[];
12
12
  shops?: Ref<Shop>[];
13
- itemType?: ItemType;
13
+ itemType?: UserAppSectionItemType;
14
14
  status?: Status;
15
15
  sortingOrder?: number;
16
16
  }
@@ -53,7 +53,7 @@ __decorate([
53
53
  __metadata("design:type", Array)
54
54
  ], ListContainer.prototype, "shops", void 0);
55
55
  __decorate([
56
- (0, typegoose_1.prop)({ type: String, enum: enum_1.ItemType }),
56
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.UserAppSectionItemType }),
57
57
  __metadata("design:type", String)
58
58
  ], ListContainer.prototype, "itemType", void 0);
59
59
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"list-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/list-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAA2D;AAC3D,6CAAoC;AACpC,2CAAk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AAa;IA9BzB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;IACjE,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,IAAA,eAAG,EAAgB,MAAM,EAAE,KAAK,WAAW,IAAI;QAE/C,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,qBAAkB,CAAC,SAAS,CAA8B;oBACvF;wBACC,MAAM,EAAE;4BACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,aAAa,CA2BzB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status } from '../../../utilities/enum';\nimport { Shop } from './shop.model';\nimport { Tag } from './tag.model';\nimport { ListContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'listContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<ListContainer>('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 for listContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ListContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\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 ListContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic banner!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic deals?: string[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ type: String, enum: ItemType })\n\tpublic itemType?: ItemType;\n\n\t@prop({ enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
1
+ {"version":3,"file":"list-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/list-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAmF;AACnF,6CAAoC;AACpC,2CAAkC;AAClC,wBAAuC;AAgChC,IAAM,aAAa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EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;IACjE,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,IAAA,eAAG,EAAgB,MAAM,EAAE,KAAK,WAAW,IAAI;QAE/C,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,qBAAkB,CAAC,SAAS,CAA8B;oBACvF;wBACC,MAAM,EAAE;4BACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,aAAa,CA2BzB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { Shop } from './shop.model';\nimport { Tag } from './tag.model';\nimport { ListContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'listContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<ListContainer>('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 for listContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ListContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\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 ListContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic banner!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic deals?: string[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ type: String, enum: UserAppSectionItemType })\n\tpublic itemType?: UserAppSectionItemType;\n\n\t@prop({ enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { PaidCurrency } from './enum';
2
+ export declare const roundCurrency: (amount: number, currency: PaidCurrency) => Promise<number>;
3
+ export declare const convertToSecondary: (amount: number) => Promise<number>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToSecondary = exports.roundCurrency = void 0;
4
+ const settings_1 = require("../libraries/cache/settings");
5
+ const enum_1 = require("./enum");
6
+ const DEFAULT_ROUNDING_FACTOR = 0.01;
7
+ const DEFAULT_EXCHANGE_RATE = 1;
8
+ const getRoundingFactor = async (currency) => {
9
+ const settings = (await settings_1.cachedSettingsService.getSettings());
10
+ const currencySetting = settings.currencySetting;
11
+ let roundingFactor;
12
+ if (currencySetting) {
13
+ switch (currency) {
14
+ case enum_1.PaidCurrency.BASE:
15
+ roundingFactor = currencySetting.baseCurrency?.roundTo;
16
+ break;
17
+ case enum_1.PaidCurrency.SECONDARY:
18
+ roundingFactor = currencySetting.secondaryCurrency?.roundTo;
19
+ break;
20
+ default:
21
+ roundingFactor = DEFAULT_ROUNDING_FACTOR;
22
+ break;
23
+ }
24
+ }
25
+ return roundingFactor || DEFAULT_ROUNDING_FACTOR;
26
+ };
27
+ const getExchangeRate = async () => {
28
+ const settings = (await settings_1.cachedSettingsService.getSettings());
29
+ const currencySetting = settings.currencySetting;
30
+ return currencySetting?.exchangeRate || DEFAULT_EXCHANGE_RATE;
31
+ };
32
+ const roundCurrency = async (amount, currency) => {
33
+ const roundingFactor = await getRoundingFactor(currency);
34
+ return Math.round(amount / roundingFactor) * roundingFactor;
35
+ };
36
+ exports.roundCurrency = roundCurrency;
37
+ const convertToSecondary = async (amount) => {
38
+ const exchageRate = await getExchangeRate();
39
+ return (0, exports.roundCurrency)(amount * exchageRate, enum_1.PaidCurrency.SECONDARY);
40
+ };
41
+ exports.convertToSecondary = convertToSecondary;
42
+ //# sourceMappingURL=currency.js.map
@@ -0,0 +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,E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AS,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
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,EAA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D,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,gBAAgB,CAe5B","sourcesContent":["import { modelOptions, 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"]}
@@ -1,7 +0,0 @@
1
- import { OrderFinance } from '../order-finance.model';
2
- import { OrderType } from '../../../../utilities/enum';
3
- import { CourierOrderProfit } from '../embedded/profit.model';
4
- export declare class CourierOrderFinance extends OrderFinance {
5
- orderType: OrderType.COURIER;
6
- companyProfit?: CourierOrderProfit;
7
- }
@@ -1,26 +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.CourierOrderFinance = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const order_finance_model_1 = require("../order-finance.model");
15
- const enum_1 = require("../../../../utilities/enum");
16
- const profit_model_1 = require("../embedded/profit.model");
17
- class CourierOrderFinance extends order_finance_model_1.OrderFinance {
18
- orderType = enum_1.OrderType.COURIER;
19
- companyProfit;
20
- }
21
- exports.CourierOrderFinance = CourierOrderFinance;
22
- __decorate([
23
- (0, typegoose_1.prop)({ type: () => profit_model_1.CourierOrderProfit }),
24
- __metadata("design:type", profit_model_1.CourierOrderProfit)
25
- ], CourierOrderFinance.prototype, "companyProfit", void 0);
26
- //# sourceMappingURL=courier-order-finance.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"courier-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/courier-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,gEAAsD;AACtD,qDAAuD;AACvD,2DAA8D;AAE9D,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,aAAa,CAAsB;CAC1C;AALD,kDAKC;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BAClB,iCAAkB;0DAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { OrderType } from '../../../../utilities/enum';\nimport { CourierOrderProfit } from '../embedded/profit.model';\n\nexport class CourierOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.COURIER as const;\n\n\t@prop({ type: () => CourierOrderProfit })\n\tpublic companyProfit?: CourierOrderProfit;\n}\n"]}
@@ -1,25 +0,0 @@
1
- import { Ref } from '@typegoose/typegoose';
2
- import { OrderFinance } from '../order-finance.model';
3
- import { ItemType, OrderType } from '../../../../utilities/enum';
4
- import { RegularOrderProfit } from '../embedded/profit.model';
5
- import { Vat } from '../embedded/vat.model';
6
- import { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';
7
- import { Parent } from '../parent.model';
8
- import { Shop } from '../shop.model';
9
- export declare class RegularOrderFinance extends OrderFinance {
10
- orderType: OrderType.REGULAR;
11
- parent: Ref<Parent>;
12
- shop: Ref<Shop>;
13
- itemType: ItemType;
14
- isShopDelivery?: boolean;
15
- companyProfit?: RegularOrderProfit;
16
- shopProfit?: RegularOrderProfit;
17
- vat?: Vat;
18
- discount?: MarketingCut;
19
- buy1get1?: MarketingCut;
20
- loyaltyPoint?: LoyaltyPoint;
21
- coupon?: CouponDetails;
22
- freeDelivery?: MarketingCut;
23
- replacementOrder?: MarketingCut;
24
- endorseLoss?: MarketingCut;
25
- }
@@ -1,95 +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.RegularOrderFinance = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const order_finance_model_1 = require("../order-finance.model");
15
- const enum_1 = require("../../../../utilities/enum");
16
- const profit_model_1 = require("../embedded/profit.model");
17
- const vat_model_1 = require("../embedded/vat.model");
18
- const marketing_cut_model_1 = require("../embedded/marketing-cut.model");
19
- const parent_model_1 = require("../parent.model");
20
- const shop_model_1 = require("../shop.model");
21
- class RegularOrderFinance extends order_finance_model_1.OrderFinance {
22
- orderType = enum_1.OrderType.REGULAR;
23
- parent;
24
- shop;
25
- itemType;
26
- isShopDelivery;
27
- companyProfit;
28
- shopProfit;
29
- vat;
30
- discount;
31
- buy1get1;
32
- loyaltyPoint;
33
- coupon;
34
- freeDelivery;
35
- replacementOrder;
36
- endorseLoss;
37
- }
38
- exports.RegularOrderFinance = RegularOrderFinance;
39
- __decorate([
40
- (0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent, index: true }),
41
- __metadata("design:type", Object)
42
- ], RegularOrderFinance.prototype, "parent", void 0);
43
- __decorate([
44
- (0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop, index: true }),
45
- __metadata("design:type", Object)
46
- ], RegularOrderFinance.prototype, "shop", void 0);
47
- __decorate([
48
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType, index: true }),
49
- __metadata("design:type", String)
50
- ], RegularOrderFinance.prototype, "itemType", void 0);
51
- __decorate([
52
- (0, typegoose_1.prop)({ type: Boolean, default: false }),
53
- __metadata("design:type", Boolean)
54
- ], RegularOrderFinance.prototype, "isShopDelivery", void 0);
55
- __decorate([
56
- (0, typegoose_1.prop)({ type: () => profit_model_1.RegularOrderProfit }),
57
- __metadata("design:type", profit_model_1.RegularOrderProfit)
58
- ], RegularOrderFinance.prototype, "companyProfit", void 0);
59
- __decorate([
60
- (0, typegoose_1.prop)({ type: () => profit_model_1.RegularOrderProfit }),
61
- __metadata("design:type", profit_model_1.RegularOrderProfit)
62
- ], RegularOrderFinance.prototype, "shopProfit", void 0);
63
- __decorate([
64
- (0, typegoose_1.prop)({ type: () => vat_model_1.Vat }),
65
- __metadata("design:type", vat_model_1.Vat)
66
- ], RegularOrderFinance.prototype, "vat", void 0);
67
- __decorate([
68
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
69
- __metadata("design:type", marketing_cut_model_1.MarketingCut)
70
- ], RegularOrderFinance.prototype, "discount", void 0);
71
- __decorate([
72
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
73
- __metadata("design:type", marketing_cut_model_1.MarketingCut)
74
- ], RegularOrderFinance.prototype, "buy1get1", void 0);
75
- __decorate([
76
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.LoyaltyPoint }),
77
- __metadata("design:type", marketing_cut_model_1.LoyaltyPoint)
78
- ], RegularOrderFinance.prototype, "loyaltyPoint", void 0);
79
- __decorate([
80
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.CouponDetails }),
81
- __metadata("design:type", marketing_cut_model_1.CouponDetails)
82
- ], RegularOrderFinance.prototype, "coupon", void 0);
83
- __decorate([
84
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
85
- __metadata("design:type", marketing_cut_model_1.MarketingCut)
86
- ], RegularOrderFinance.prototype, "freeDelivery", void 0);
87
- __decorate([
88
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
89
- __metadata("design:type", marketing_cut_model_1.MarketingCut)
90
- ], RegularOrderFinance.prototype, "replacementOrder", void 0);
91
- __decorate([
92
- (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
93
- __metadata("design:type", marketing_cut_model_1.MarketingCut)
94
- ], RegularOrderFinance.prototype, "endorseLoss", void 0);
95
- //# sourceMappingURL=regular-order-finance.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"regular-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/regular-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,gEAAsD;AACtD,qDAAiE;AACjE,2DAA8D;AAC9D,qDAA4C;AAC5C,yEAA4F;AAC5F,kDAAyC;AACzC,8CAAqC;AAErC,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,QAAQ,CAAY;IAGpB,cAAc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I,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACjB,kCAAY;qDAAC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACb,kCAAY;yDAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,mCAAa,EAAE,CAAC;8BACpB,mCAAa;mDAAC;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACb,kCAAY;yDAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACT,kCAAY;6DAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACd,kCAAY;wDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { ItemType, OrderType } from '../../../../utilities/enum';\nimport { RegularOrderProfit } from '../embedded/profit.model';\nimport { Vat } from '../embedded/vat.model';\nimport { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';\nimport { Parent } from '../parent.model';\nimport { Shop } from '../shop.model';\n\nexport class RegularOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.REGULAR as const;\n\n\t@prop({ required: true, ref: () => Parent, index: true })\n\tpublic parent!: Ref<Parent>;\n\n\t@prop({ required: true, ref: () => Shop, index: true })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, enum: ItemType, index: true })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopDelivery?: boolean;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic companyProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic shopProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic discount?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic buy1get1?: MarketingCut;\n\n\t@prop({ type: () => LoyaltyPoint })\n\tpublic loyaltyPoint?: LoyaltyPoint;\n\n\t@prop({ type: () => CouponDetails })\n\tpublic coupon?: CouponDetails;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic freeDelivery?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic replacementOrder?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic endorseLoss?: MarketingCut;\n}\n"]}