@lyxa.ai/core 1.0.20 → 1.0.22

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 (95) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/libraries/logger/index.d.ts +2 -0
  3. package/dist/libraries/logger/index.js +17 -1
  4. package/dist/libraries/logger/index.js.map +1 -1
  5. package/dist/libraries/mongo/index.js +49 -16
  6. package/dist/libraries/mongo/index.js.map +1 -1
  7. package/dist/libraries/mongo/models/cart-participant.model.d.ts +2 -2
  8. package/dist/libraries/mongo/models/cart-participant.model.js +2 -2
  9. package/dist/libraries/mongo/models/cart-participant.model.js.map +1 -1
  10. package/dist/libraries/mongo/models/cart.model.d.ts +5 -7
  11. package/dist/libraries/mongo/models/cart.model.js +22 -31
  12. package/dist/libraries/mongo/models/cart.model.js.map +1 -1
  13. package/dist/libraries/mongo/models/embedded/line-item-attribute.model.d.ts +7 -0
  14. package/dist/libraries/mongo/models/embedded/line-item-attribute.model.js +29 -0
  15. package/dist/libraries/mongo/models/embedded/line-item-attribute.model.js.map +1 -0
  16. package/dist/libraries/mongo/models/embedded/order-cancel.model.d.ts +7 -0
  17. package/dist/libraries/mongo/models/embedded/order-cancel.model.js +34 -0
  18. package/dist/libraries/mongo/models/embedded/order-cancel.model.js.map +1 -0
  19. package/dist/libraries/mongo/models/embedded/order-pricing.model.d.ts +18 -0
  20. package/dist/libraries/mongo/models/embedded/order-pricing.model.js +97 -0
  21. package/dist/libraries/mongo/models/embedded/order-pricing.model.js.map +1 -0
  22. package/dist/libraries/mongo/models/embedded/payment-attempt.model.d.ts +10 -0
  23. package/dist/libraries/mongo/models/embedded/payment-attempt.model.js +60 -0
  24. package/dist/libraries/mongo/models/embedded/payment-attempt.model.js.map +1 -0
  25. package/dist/libraries/mongo/models/embedded/payment-infromation.model.d.ts +1 -0
  26. package/dist/libraries/mongo/models/embedded/payment-infromation.model.js +5 -0
  27. package/dist/libraries/mongo/models/embedded/payment-infromation.model.js.map +1 -1
  28. package/dist/libraries/mongo/models/embedded/price-breakdown.model.d.ts +5 -0
  29. package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +32 -0
  30. package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -0
  31. package/dist/libraries/mongo/models/embedded/status-timeline.model.d.ts +14 -0
  32. package/dist/libraries/mongo/models/embedded/status-timeline.model.js +59 -0
  33. package/dist/libraries/mongo/models/embedded/status-timeline.model.js.map +1 -0
  34. package/dist/libraries/mongo/models/index.d.ts +24 -0
  35. package/dist/libraries/mongo/models/index.js +26 -2
  36. package/dist/libraries/mongo/models/index.js.map +1 -1
  37. package/dist/libraries/mongo/models/line-item.model.d.ts +9 -8
  38. package/dist/libraries/mongo/models/line-item.model.js +17 -16
  39. package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
  40. package/dist/libraries/mongo/models/order-delivery.model.d.ts +24 -0
  41. package/dist/libraries/mongo/models/order-delivery.model.js +119 -0
  42. package/dist/libraries/mongo/models/order-delivery.model.js.map +1 -0
  43. package/dist/libraries/mongo/models/order-payment.model.d.ts +21 -0
  44. package/dist/libraries/mongo/models/order-payment.model.js +96 -0
  45. package/dist/libraries/mongo/models/order-payment.model.js.map +1 -0
  46. package/dist/libraries/mongo/models/order.model.d.ts +15 -0
  47. package/dist/libraries/mongo/models/order.model.js +60 -7
  48. package/dist/libraries/mongo/models/order.model.js.map +1 -1
  49. package/dist/libraries/mongo/models/product.model.d.ts +5 -6
  50. package/dist/libraries/mongo/models/product.model.js +12 -17
  51. package/dist/libraries/mongo/models/product.model.js.map +1 -1
  52. package/dist/libraries/mongo/models/providers/courier-order.model.d.ts +23 -0
  53. package/dist/libraries/mongo/models/providers/courier-order.model.js +89 -0
  54. package/dist/libraries/mongo/models/providers/courier-order.model.js.map +1 -0
  55. package/dist/libraries/mongo/models/providers/regular-order.model.d.ts +23 -0
  56. package/dist/libraries/mongo/models/providers/regular-order.model.js +85 -0
  57. package/dist/libraries/mongo/models/providers/regular-order.model.js.map +1 -0
  58. package/dist/libraries/mongo/models/rating-setting.model.d.ts +1 -0
  59. package/dist/libraries/mongo/models/rating-setting.model.js +11 -2
  60. package/dist/libraries/mongo/models/rating-setting.model.js.map +1 -1
  61. package/dist/libraries/mongo/models/shared/address.model.d.ts +4 -0
  62. package/dist/libraries/mongo/models/shared/address.model.js +14 -1
  63. package/dist/libraries/mongo/models/shared/address.model.js.map +1 -1
  64. package/dist/libraries/mongo/models/shared/work-hour.model.js +1 -1
  65. package/dist/libraries/mongo/models/shared/work-hour.model.js.map +1 -1
  66. package/dist/libraries/mongo/models/shop-access-control.model.js +10 -6
  67. package/dist/libraries/mongo/models/shop-access-control.model.js.map +1 -1
  68. package/dist/libraries/mongo/models/shop-product.model.d.ts +4 -4
  69. package/dist/libraries/mongo/models/shop-product.model.js +7 -7
  70. package/dist/libraries/mongo/models/shop-product.model.js.map +1 -1
  71. package/dist/libraries/mongo/models/shop.model.d.ts +1 -1
  72. package/dist/libraries/mongo/models/shop.model.js +2 -2
  73. package/dist/libraries/mongo/models/shop.model.js.map +1 -1
  74. package/dist/utilities/common/password.d.ts +1 -0
  75. package/dist/utilities/common/password.js +12 -0
  76. package/dist/utilities/common/password.js.map +1 -0
  77. package/dist/utilities/common/week.d.ts +1 -0
  78. package/dist/utilities/common/week.js +5 -0
  79. package/dist/utilities/common/week.js.map +1 -0
  80. package/dist/utilities/enum.d.ts +60 -10
  81. package/dist/utilities/enum.js +77 -19
  82. package/dist/utilities/enum.js.map +1 -1
  83. package/dist/utilities/pagination.d.ts +4 -2
  84. package/dist/utilities/pagination.js +42 -5
  85. package/dist/utilities/pagination.js.map +1 -1
  86. package/dist/utilities/transformers.d.ts +1 -1
  87. package/dist/utilities/transformers.js +0 -12
  88. package/dist/utilities/transformers.js.map +1 -1
  89. package/dist/utilities/validation/common-validation.d.ts +182 -64
  90. package/dist/utilities/validation/common-validation.js +24 -13
  91. package/dist/utilities/validation/common-validation.js.map +1 -1
  92. package/dist/utilities/validation/global-validation.d.ts +40 -20
  93. package/dist/utilities/validation/global-validation.js +6 -4
  94. package/dist/utilities/validation/global-validation.js.map +1 -1
  95. package/package.json +1 -1
@@ -11,20 +11,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LineItem = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
- const core_user_model_1 = require("./core-user.model");
15
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
16
15
  const cart_model_1 = require("./cart.model");
17
16
  const product_model_1 = require("./product.model");
18
- const portion_model_1 = require("./embedded/portion.model");
19
- const addon_model_1 = require("./embedded/addon.model");
17
+ const price_breakdown_model_1 = require("./embedded/price-breakdown.model");
18
+ const enum_1 = require("../../../utilities/enum");
19
+ const line_item_attribute_model_1 = require("./embedded/line-item-attribute.model");
20
+ const user_model_1 = require("./user.model");
20
21
  let LineItem = class LineItem extends defaultClasses_1.TimeStamps {
21
22
  cart;
22
23
  user;
23
24
  product;
24
25
  quantity;
25
- unitPrice;
26
- portion;
27
- addOns;
26
+ priceOption;
27
+ priceBreakdown;
28
+ attributes;
28
29
  removedIngredients;
29
30
  specialInstructions;
30
31
  };
@@ -34,7 +35,7 @@ __decorate([
34
35
  __metadata("design:type", Object)
35
36
  ], LineItem.prototype, "cart", void 0);
36
37
  __decorate([
37
- (0, typegoose_1.prop)({ required: false, ref: () => core_user_model_1.CoreUser }),
38
+ (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
38
39
  __metadata("design:type", Object)
39
40
  ], LineItem.prototype, "user", void 0);
40
41
  __decorate([
@@ -42,21 +43,21 @@ __decorate([
42
43
  __metadata("design:type", Object)
43
44
  ], LineItem.prototype, "product", void 0);
44
45
  __decorate([
45
- (0, typegoose_1.prop)({ required: true, min: 1, default: 1 }),
46
+ (0, typegoose_1.prop)({ min: 1, default: 1 }),
46
47
  __metadata("design:type", Number)
47
48
  ], LineItem.prototype, "quantity", void 0);
48
49
  __decorate([
49
- (0, typegoose_1.prop)(),
50
- __metadata("design:type", Number)
51
- ], LineItem.prototype, "unitPrice", void 0);
50
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.PriceOption, default: enum_1.PriceOption.SINGLE_PRICE }),
51
+ __metadata("design:type", String)
52
+ ], LineItem.prototype, "priceOption", void 0);
52
53
  __decorate([
53
- (0, typegoose_1.prop)({ type: () => portion_model_1.Portion }),
54
- __metadata("design:type", portion_model_1.Portion)
55
- ], LineItem.prototype, "portion", void 0);
54
+ (0, typegoose_1.prop)({ required: true, type: price_breakdown_model_1.PriceBreakdown }),
55
+ __metadata("design:type", price_breakdown_model_1.PriceBreakdown)
56
+ ], LineItem.prototype, "priceBreakdown", void 0);
56
57
  __decorate([
57
- (0, typegoose_1.prop)({ type: () => [addon_model_1.AddOn], default: [] }),
58
+ (0, typegoose_1.prop)({ type: () => [line_item_attribute_model_1.LineItemAttribute], default: [] }),
58
59
  __metadata("design:type", Array)
59
- ], LineItem.prototype, "addOns", void 0);
60
+ ], LineItem.prototype, "attributes", void 0);
60
61
  __decorate([
61
62
  (0, typegoose_1.prop)({ type: () => [String], default: [] }),
62
63
  __metadata("design:type", Array)
@@ -1 +1 @@
1
- {"version":3,"file":"line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,uDAA6C;AAC7C,4EAAqE;AACrE,6CAAoC;AACpC,mDAA0C;AAC1C,4DAAmD;AACnD,wDAA+C;AAkBxC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IAEhC,IAAI,CAAa;IAGjB,IAAI,CAAiB;IAGrB,OAAO,CAAgB;IAGvB,QAAQ,CAAU;IAGlB,SAAS,CAAU;IAGnB,OAAO,CAAW;IAGlB,MAAM,CAAW;IAGjB,kBAAkB,CAAY;IAG9B,mBAAmB,CAAU;CACpC,CAAA;AA3BY,4BAAQ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I,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 {\r\n\tprop,\r\n\tgetModelForClass,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { CoreUser } from './core-user.model';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { Product } from './product.model';\r\nimport { Portion } from './embedded/portion.model';\r\nimport { AddOn } from './embedded/addon.model';\r\n\r\n/**\r\n * LineItem model - Represents individual items in a cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'lineItems',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1 })\r\n@index({ cart: 1, user: 1 })\r\n@index({ product: 1 })\r\nexport class LineItem extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: false, ref: () => CoreUser })\r\n\tpublic user?: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, ref: () => Product })\r\n\tpublic product!: Ref<Product>;\r\n\r\n\t@prop({ required: true, min: 1, default: 1 })\r\n\tpublic quantity!: number;\r\n\r\n\t@prop()\r\n\tpublic unitPrice!: number;\r\n\r\n\t@prop({ type: () => Portion })\r\n\tpublic portion?: Portion;\r\n\r\n\t@prop({ type: () => [AddOn], default: [] })\r\n\tpublic addOns?: AddOn[];\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic removedIngredients?: string[];\r\n\r\n\t@prop()\r\n\tpublic specialInstructions?: string;\r\n}"]}
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;IAEhC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,OAAO,CAAgB;IAGvB,QAAQ,CAAU;IAGlB,WAAW,CAAe;IAG1B,cAAc,CAAiB;IAG/B,UAAU,CAAuB;IAGjC,kBAAkB,CAAY;IAG9B,mBAAmB,CAAU;CACpC,CAAA;AA3BY,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,uBAAO,EAAE,CAAC;;yCACf;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0CACJ;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,OAAO,EAAE,kBAAW,CAAC,YAAY,EAAE,CAAC;;6CAC5C;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,sCAAc,EAAE,CAAC;8BACxB,sCAAc;gDAAC;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,6CAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;4CACf;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;oDACP;AAG9B;IADN,IAAA,gBAAI,GAAE;;qDAC6B;mBA1BxB,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';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { Product } from './product.model';\r\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\r\nimport { PriceOption } from '../../../utilities/enum';\r\nimport { LineItemAttribute } from './embedded/line-item-attribute.model';\r\nimport { User } from './user.model';\r\n\r\n/**\r\n * LineItem model - Represents individual items in a cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'lineItems',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1 })\r\n@index({ cart: 1, user: 1 })\r\n@index({ product: 1 })\r\nexport class LineItem extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ required: true, ref: () => Product })\r\n\tpublic product!: Ref<Product>;\r\n\r\n\t@prop({ min: 1, default: 1 })\r\n\tpublic quantity?: number;\r\n\r\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\r\n\tpublic priceOption?: PriceOption;\r\n\r\n\t@prop({ required: true, type: PriceBreakdown })\r\n\tpublic priceBreakdown: PriceBreakdown;\r\n\r\n\t@prop({ type: () => [LineItemAttribute], default: [] })\r\n\tpublic attributes?: LineItemAttribute[];\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic removedIngredients?: string[];\r\n\r\n\t@prop()\r\n\tpublic specialInstructions?: string;\r\n}\r\n"]}
@@ -0,0 +1,24 @@
1
+ import { Ref } from '@typegoose/typegoose';
2
+ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
+ import { Order } from './order.model';
4
+ import { Rider } from './rider.model';
5
+ export declare class RiderAssignment {
6
+ rider: Ref<Rider>;
7
+ status: string;
8
+ timestamp: Date;
9
+ reason?: string;
10
+ }
11
+ export declare class OrderDelivery extends TimeStamps {
12
+ order: Ref<Order>;
13
+ rider?: Ref<Rider>;
14
+ riderAssignments: RiderAssignment[];
15
+ estimatedPickupTime?: Date;
16
+ actualPickupTime?: Date;
17
+ estimatedDeliveryTime?: Date;
18
+ actualDeliveryTime?: Date;
19
+ searchingStartTime?: Date;
20
+ totalSearchAttempts?: number;
21
+ lastSearchRadiusInKm?: number;
22
+ deliveryDistanceInKm?: number;
23
+ note?: string;
24
+ }
@@ -0,0 +1,119 @@
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.OrderDelivery = exports.RiderAssignment = 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 rider_model_1 = require("./rider.model");
17
+ const enum_1 = require("../../../utilities/enum");
18
+ class RiderAssignment {
19
+ rider;
20
+ status;
21
+ timestamp;
22
+ reason;
23
+ }
24
+ exports.RiderAssignment = RiderAssignment;
25
+ __decorate([
26
+ (0, typegoose_1.prop)({ ref: () => rider_model_1.Rider, required: true }),
27
+ __metadata("design:type", Object)
28
+ ], RiderAssignment.prototype, "rider", void 0);
29
+ __decorate([
30
+ (0, typegoose_1.prop)({
31
+ type: String,
32
+ enum: enum_1.RiderAssignmentStatus,
33
+ default: enum_1.RiderAssignmentStatus.REQUESTED,
34
+ required: true,
35
+ }),
36
+ __metadata("design:type", String)
37
+ ], RiderAssignment.prototype, "status", void 0);
38
+ __decorate([
39
+ (0, typegoose_1.prop)({ required: true, default: Date.now }),
40
+ __metadata("design:type", Date)
41
+ ], RiderAssignment.prototype, "timestamp", void 0);
42
+ __decorate([
43
+ (0, typegoose_1.prop)(),
44
+ __metadata("design:type", String)
45
+ ], RiderAssignment.prototype, "reason", void 0);
46
+ let OrderDelivery = class OrderDelivery extends defaultClasses_1.TimeStamps {
47
+ order;
48
+ rider;
49
+ riderAssignments;
50
+ estimatedPickupTime;
51
+ actualPickupTime;
52
+ estimatedDeliveryTime;
53
+ actualDeliveryTime;
54
+ searchingStartTime;
55
+ totalSearchAttempts;
56
+ lastSearchRadiusInKm;
57
+ deliveryDistanceInKm;
58
+ note;
59
+ };
60
+ exports.OrderDelivery = OrderDelivery;
61
+ __decorate([
62
+ (0, typegoose_1.prop)({ ref: () => order_model_1.Order, required: true, index: true }),
63
+ __metadata("design:type", Object)
64
+ ], OrderDelivery.prototype, "order", void 0);
65
+ __decorate([
66
+ (0, typegoose_1.prop)({ ref: () => rider_model_1.Rider }),
67
+ __metadata("design:type", Object)
68
+ ], OrderDelivery.prototype, "rider", void 0);
69
+ __decorate([
70
+ (0, typegoose_1.prop)({ type: () => [RiderAssignment], default: [] }),
71
+ __metadata("design:type", Array)
72
+ ], OrderDelivery.prototype, "riderAssignments", void 0);
73
+ __decorate([
74
+ (0, typegoose_1.prop)(),
75
+ __metadata("design:type", Date)
76
+ ], OrderDelivery.prototype, "estimatedPickupTime", void 0);
77
+ __decorate([
78
+ (0, typegoose_1.prop)(),
79
+ __metadata("design:type", Date)
80
+ ], OrderDelivery.prototype, "actualPickupTime", void 0);
81
+ __decorate([
82
+ (0, typegoose_1.prop)(),
83
+ __metadata("design:type", Date)
84
+ ], OrderDelivery.prototype, "estimatedDeliveryTime", void 0);
85
+ __decorate([
86
+ (0, typegoose_1.prop)(),
87
+ __metadata("design:type", Date)
88
+ ], OrderDelivery.prototype, "actualDeliveryTime", void 0);
89
+ __decorate([
90
+ (0, typegoose_1.prop)({ default: Date.now }),
91
+ __metadata("design:type", Date)
92
+ ], OrderDelivery.prototype, "searchingStartTime", void 0);
93
+ __decorate([
94
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
95
+ __metadata("design:type", Number)
96
+ ], OrderDelivery.prototype, "totalSearchAttempts", void 0);
97
+ __decorate([
98
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
99
+ __metadata("design:type", Number)
100
+ ], OrderDelivery.prototype, "lastSearchRadiusInKm", void 0);
101
+ __decorate([
102
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
103
+ __metadata("design:type", Number)
104
+ ], OrderDelivery.prototype, "deliveryDistanceInKm", void 0);
105
+ __decorate([
106
+ (0, typegoose_1.prop)({ type: String }),
107
+ __metadata("design:type", String)
108
+ ], OrderDelivery.prototype, "note", void 0);
109
+ exports.OrderDelivery = OrderDelivery = __decorate([
110
+ (0, typegoose_1.modelOptions)({
111
+ schemaOptions: {
112
+ timestamps: true,
113
+ toJSON: { virtuals: true },
114
+ toObject: { virtuals: true },
115
+ collection: 'orderDeliveries',
116
+ },
117
+ })
118
+ ], OrderDelivery);
119
+ //# sourceMappingURL=order-delivery.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-delivery.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-delivery.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,+CAAsC;AACtC,+CAAsC;AACtC,kDAAgE;AAEhE,MAAa,eAAe;IAE3B,KAAK,CAAa;IAQlB,MAAM,CAAS;IAGf,SAAS,CAAO;IAGhB,MAAM,CAAU;CAChB;AAjBD,0CAiBC;AAfA;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACzB;AAQlB;IANC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,4BAAqB;QAC3B,OAAO,EAAE,4BAAqB,CAAC,SAAS;QACxC,QAAQ,EAAE,IAAI;KACd,CAAC;;+CACa;AAGf;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;8BACjC,IAAI;kDAAC;AAGhB;I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;AAG9B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;2DACL;AAG9B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACT;wBAnCF,aAAa;IARzB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC5B,UAAU,EAAE,iBAAiB;SAC7B;KACD,CAAC;GACW,aAAa,CAoCzB","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Order } from './order.model';\r\nimport { Rider } from './rider.model';\r\nimport { RiderAssignmentStatus } from '../../../utilities/enum';\r\n\r\nexport class RiderAssignment {\r\n\t@prop({ ref: () => Rider, required: true })\r\n\trider: Ref<Rider>;\r\n\r\n\t@prop({\r\n\t\ttype: String,\r\n\t\tenum: RiderAssignmentStatus,\r\n\t\tdefault: RiderAssignmentStatus.REQUESTED,\r\n\t\trequired: true,\r\n\t})\r\n\tstatus: string;\r\n\r\n\t@prop({ required: true, default: Date.now })\r\n\ttimestamp: Date;\r\n\r\n\t@prop()\r\n\treason?: string;\r\n}\r\n\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\ttimestamps: true,\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t\tcollection: 'orderDeliveries',\r\n\t},\r\n})\r\nexport class OrderDelivery extends TimeStamps {\r\n\t@prop({ ref: () => Order, required: true, index: true })\r\n\torder: Ref<Order>;\r\n\r\n\t@prop({ ref: () => Rider })\r\n\trider?: Ref<Rider>;\r\n\r\n\t@prop({ type: () => [RiderAssignment], default: [] })\r\n\triderAssignments: RiderAssignment[];\r\n\r\n\t@prop()\r\n\testimatedPickupTime?: Date;\r\n\r\n\t@prop()\r\n\tactualPickupTime?: Date;\r\n\r\n\t@prop()\r\n\testimatedDeliveryTime?: Date;\r\n\r\n\t@prop()\r\n\tactualDeliveryTime?: Date;\r\n\r\n\t@prop({ default: Date.now })\r\n\tsearchingStartTime?: Date;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\ttotalSearchAttempts?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tlastSearchRadiusInKm?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tdeliveryDistanceInKm?: number;\r\n\r\n\t@prop({ type: String })\r\n\tnote?: string;\r\n}\r\n"]}
@@ -0,0 +1,21 @@
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 { Transaction } from './transaction.model';
6
+ import { Card } from './card.model';
7
+ import { PaymentInformation } from './embedded/payment-infromation.model';
8
+ import { PaymentAttempt } from './embedded/payment-attempt.model';
9
+ export declare class OrderPayment extends TimeStamps {
10
+ order: Ref<Order>;
11
+ paymentMethod?: PaymentMethod;
12
+ paymentInformation?: PaymentInformation;
13
+ status?: PaymentStatus;
14
+ transaction?: Ref<Transaction>;
15
+ card?: Ref<Card>;
16
+ receiptUrl?: string;
17
+ attempts?: PaymentAttempt[];
18
+ currency: string;
19
+ amount: number;
20
+ secondaryAmount?: number;
21
+ }
@@ -0,0 +1,96 @@
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 transaction_model_1 = require("./transaction.model");
18
+ const card_model_1 = require("./card.model");
19
+ const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
20
+ const payment_attempt_model_1 = require("./embedded/payment-attempt.model");
21
+ let OrderPayment = class OrderPayment extends defaultClasses_1.TimeStamps {
22
+ order;
23
+ paymentMethod;
24
+ paymentInformation;
25
+ status;
26
+ transaction;
27
+ card;
28
+ receiptUrl;
29
+ attempts;
30
+ currency;
31
+ amount;
32
+ secondaryAmount;
33
+ };
34
+ exports.OrderPayment = OrderPayment;
35
+ __decorate([
36
+ (0, typegoose_1.prop)({ ref: () => order_model_1.Order, required: true, index: true }),
37
+ __metadata("design:type", Object)
38
+ ], OrderPayment.prototype, "order", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ enum: enum_1.PaymentMethod, type: String }),
41
+ __metadata("design:type", String)
42
+ ], OrderPayment.prototype, "paymentMethod", void 0);
43
+ __decorate([
44
+ (0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation }),
45
+ __metadata("design:type", payment_infromation_model_1.PaymentInformation)
46
+ ], OrderPayment.prototype, "paymentInformation", void 0);
47
+ __decorate([
48
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentStatus, default: enum_1.PaymentStatus.PENDING }),
49
+ __metadata("design:type", String)
50
+ ], OrderPayment.prototype, "status", void 0);
51
+ __decorate([
52
+ (0, typegoose_1.prop)({ ref: () => transaction_model_1.Transaction }),
53
+ __metadata("design:type", Object)
54
+ ], OrderPayment.prototype, "transaction", void 0);
55
+ __decorate([
56
+ (0, typegoose_1.prop)({ ref: () => card_model_1.Card }),
57
+ __metadata("design:type", Object)
58
+ ], OrderPayment.prototype, "card", void 0);
59
+ __decorate([
60
+ (0, typegoose_1.prop)(),
61
+ __metadata("design:type", String)
62
+ ], OrderPayment.prototype, "receiptUrl", void 0);
63
+ __decorate([
64
+ (0, typegoose_1.prop)({ type: [{ type: () => payment_attempt_model_1.PaymentAttempt }], default: [] }),
65
+ __metadata("design:type", Array)
66
+ ], OrderPayment.prototype, "attempts", void 0);
67
+ __decorate([
68
+ (0, typegoose_1.prop)({ type: String }),
69
+ __metadata("design:type", String)
70
+ ], OrderPayment.prototype, "currency", void 0);
71
+ __decorate([
72
+ (0, typegoose_1.prop)({ required: true, type: Number }),
73
+ __metadata("design:type", Number)
74
+ ], OrderPayment.prototype, "amount", void 0);
75
+ __decorate([
76
+ (0, typegoose_1.prop)({ type: Number }),
77
+ __metadata("design:type", Number)
78
+ ], OrderPayment.prototype, "secondaryAmount", void 0);
79
+ exports.OrderPayment = OrderPayment = __decorate([
80
+ (0, typegoose_1.modelOptions)({
81
+ schemaOptions: {
82
+ timestamps: true,
83
+ collection: 'orderPayments',
84
+ toJSON: { virtuals: true },
85
+ toObject: { virtuals: true },
86
+ },
87
+ options: {
88
+ allowMixed: typegoose_1.Severity.ALLOW,
89
+ },
90
+ }),
91
+ (0, typegoose_1.index)({ order: 1 }),
92
+ (0, typegoose_1.index)({ status: 1 }),
93
+ (0, typegoose_1.index)({ paymentMethod: 1 }),
94
+ (0, typegoose_1.index)({ createdAt: -1 })
95
+ ], OrderPayment);
96
+ //# sourceMappingURL=order-payment.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-payment.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-payment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAg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AC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;8CAClC;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;uBAhCb,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,CAiCxB","sourcesContent":["import { index, modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Order } from './order.model';\r\nimport { PaymentMethod, PaymentStatus } from '../../../utilities/enum';\r\nimport { Transaction } from './transaction.model';\r\nimport { Card } from './card.model';\r\nimport { PaymentInformation } from './embedded/payment-infromation.model';\r\nimport { PaymentAttempt } from './embedded/payment-attempt.model';\r\n\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\ttimestamps: true,\r\n\t\tcollection: 'orderPayments',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ order: 1 })\r\n@index({ status: 1 })\r\n@index({ paymentMethod: 1 })\r\n@index({ createdAt: -1 })\r\nexport class OrderPayment extends TimeStamps {\r\n\t@prop({ ref: () => Order, required: true, index: true })\r\n\torder: Ref<Order>;\r\n\r\n\t@prop({ enum: PaymentMethod, type: String })\r\n\tpaymentMethod?: PaymentMethod;\r\n\r\n\t@prop({ type: () => PaymentInformation })\r\n\tpaymentInformation?: PaymentInformation;\r\n\r\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\r\n\tstatus?: PaymentStatus;\r\n\r\n\t@prop({ ref: () => Transaction })\r\n\ttransaction?: Ref<Transaction>;\r\n\r\n\t@prop({ ref: () => Card })\r\n\tcard?: Ref<Card>;\r\n\r\n\t@prop()\r\n\treceiptUrl?: string;\r\n\r\n\t@prop({ type: [{ type: () => PaymentAttempt }], default: [] })\r\n\tattempts?: PaymentAttempt[];\r\n\r\n\t@prop({ type: String })\r\n\tcurrency: string;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tamount: number;\r\n\r\n\t@prop({ type: Number })\r\n\tsecondaryAmount?: number;\r\n}\r\n"]}
@@ -1,3 +1,18 @@
1
+ import { Ref } from '@typegoose/typegoose';
1
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
+ import { OrderType } from '../../../utilities/enum';
4
+ import { OrderCancel } from './embedded/order-cancel.model';
5
+ import { OrderPricing } from './embedded/order-pricing.model';
6
+ import { User } from './user.model';
2
7
  export declare class Order extends TimeStamps {
8
+ orderId: string;
9
+ orderType?: OrderType;
10
+ user: Ref<User>;
11
+ instruction?: string;
12
+ note?: string;
13
+ scheduledFor?: Date;
14
+ pricing: OrderPricing;
15
+ orderCancel: OrderCancel;
16
+ isLateOrder?: boolean;
17
+ isUrgentOrder?: boolean;
3
18
  }
@@ -5,29 +5,82 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
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
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
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
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.Order = void 0;
10
13
  const typegoose_1 = require("@typegoose/typegoose");
11
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
+ const enum_1 = require("../../../utilities/enum");
16
+ const order_cancel_model_1 = require("./embedded/order-cancel.model");
17
+ const order_pricing_model_1 = require("./embedded/order-pricing.model");
18
+ const user_model_1 = require("./user.model");
12
19
  let Order = class Order extends defaultClasses_1.TimeStamps {
20
+ orderId;
21
+ orderType;
22
+ user;
23
+ instruction;
24
+ note;
25
+ scheduledFor;
26
+ pricing;
27
+ orderCancel;
28
+ isLateOrder;
29
+ isUrgentOrder;
13
30
  };
14
31
  exports.Order = Order;
32
+ __decorate([
33
+ (0, typegoose_1.prop)({ required: true, type: String, unique: true }),
34
+ __metadata("design:type", String)
35
+ ], Order.prototype, "orderId", void 0);
36
+ __decorate([
37
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.OrderType, default: enum_1.OrderType.REGULAR }),
38
+ __metadata("design:type", String)
39
+ ], Order.prototype, "orderType", void 0);
40
+ __decorate([
41
+ (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
42
+ __metadata("design:type", Object)
43
+ ], Order.prototype, "user", void 0);
44
+ __decorate([
45
+ (0, typegoose_1.prop)({ type: String }),
46
+ __metadata("design:type", String)
47
+ ], Order.prototype, "instruction", void 0);
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ type: String }),
50
+ __metadata("design:type", String)
51
+ ], Order.prototype, "note", void 0);
52
+ __decorate([
53
+ (0, typegoose_1.prop)({ type: Date }),
54
+ __metadata("design:type", Date)
55
+ ], Order.prototype, "scheduledFor", void 0);
56
+ __decorate([
57
+ (0, typegoose_1.prop)({ type: () => order_pricing_model_1.OrderPricing }),
58
+ __metadata("design:type", order_pricing_model_1.OrderPricing)
59
+ ], Order.prototype, "pricing", void 0);
60
+ __decorate([
61
+ (0, typegoose_1.prop)({ type: () => order_cancel_model_1.OrderCancel }),
62
+ __metadata("design:type", order_cancel_model_1.OrderCancel)
63
+ ], Order.prototype, "orderCancel", void 0);
64
+ __decorate([
65
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
66
+ __metadata("design:type", Boolean)
67
+ ], Order.prototype, "isLateOrder", void 0);
68
+ __decorate([
69
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
70
+ __metadata("design:type", Boolean)
71
+ ], Order.prototype, "isUrgentOrder", void 0);
15
72
  exports.Order = Order = __decorate([
16
73
  (0, typegoose_1.modelOptions)({
17
74
  schemaOptions: {
18
- timestamps: true,
75
+ collection: 'orders',
76
+ discriminatorKey: 'orderType',
19
77
  toJSON: { virtuals: true },
20
78
  toObject: { virtuals: true },
21
- collection: 'orders',
22
- },
23
- options: {
24
- allowMixed: typegoose_1.Severity.ALLOW,
25
79
  },
80
+ options: { allowMixed: typegoose_1.Severity.ALLOW },
26
81
  }),
27
- (0, typegoose_1.index)({ location: '2dsphere' }),
28
82
  (0, typegoose_1.index)({ createdAt: -1 }),
29
83
  (0, typegoose_1.index)({ orderStatus: 1, createdAt: -1 }),
30
- (0, typegoose_1.index)({ cart: 1 }),
31
84
  (0, typegoose_1.index)({ user: 1, createdAt: -1 }),
32
85
  (0, typegoose_1.index)({ shop: 1, orderStatus: 1 }),
33
86
  (0, typegoose_1.index)({ rider: 1, orderStatus: 1 })
@@ -1 +1 @@
1
- {"version":3,"file":"order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAA4G;AAC5G,4EAAqE;AAoB9D,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,2BAAU;CAAG,CAAA;AAA3B,sBAAK;gBAAL,KAAK;IAlBjB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC5B,UAAU,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC/B,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxC,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACjC,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IAClC,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;GACvB,KAAK,CAAsB","sourcesContent":["import { prop, getModelForClass, Ref, modelOptions, index, Severity, mongoose } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\n\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\ttimestamps: true,\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t\tcollection: 'orders',\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ location: '2dsphere' })\r\n@index({ createdAt: -1 })\r\n@index({ orderStatus: 1, createdAt: -1 })\r\n@index({ cart: 1 })\r\n@index({ user: 1, createdAt: -1 })\r\n@index({ shop: 1, orderStatus: 1 })\r\n@index({ rider: 1, orderStatus: 1 })\r\nexport class Order extends TimeStamps {}\r\n"]}
1
+ {"version":3,"file":"order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,kDAAoD;AACpD,sEAA4D;AAC5D,wEAA8D;AAC9D,6CAAoC;AAgB7B,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,2BAAU;IAE7B,OAAO,CAAS;IAGhB,SAAS,CAAa;IAGtB,IAAI,CAAY;IAGhB,WAAW,CAAU;IAGrB,IAAI,CAAU;IAGd,YAAY,CAAQ;IAGpB,OAAO,CAAe;IAKtB,WAAW,CAAc;IAGzB,WAAW,CAAW;IAGtB,aAAa,CAAW;CAC/B,CAAA;AAhCY,sBAAK;AAEV;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;sCAC9B;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,OAAO,EAAE,CAAC;;wCACvC;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mCACnB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACK;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mCACF;AAGd;IADN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{ prop, Ref, modelOptions, index, Severity } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { OrderType } from '../../../utilities/enum';\r\nimport { OrderCancel } from './embedded/order-cancel.model';\r\nimport { OrderPricing } from './embedded/order-pricing.model';\r\nimport { User } from './user.model';\r\n\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'orders',\r\n\t\tdiscriminatorKey: 'orderType',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: { allowMixed: Severity.ALLOW },\r\n})\r\n@index({ createdAt: -1 })\r\n@index({ orderStatus: 1, createdAt: -1 })\r\n@index({ user: 1, createdAt: -1 })\r\n@index({ shop: 1, orderStatus: 1 })\r\n@index({ rider: 1, orderStatus: 1 })\r\nexport class Order extends TimeStamps {\r\n\t@prop({ required: true, type: String, unique: true })\r\n\tpublic orderId: string;\r\n\r\n\t@prop({ type: String, enum: OrderType, default: OrderType.REGULAR })\r\n\tpublic orderType?: OrderType;\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user: Ref<User>;\r\n\r\n\t@prop({ type: String })\r\n\tpublic instruction?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic note?: string;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic scheduledFor?: Date;\r\n\r\n\t@prop({ type: () => OrderPricing })\r\n\tpublic pricing: OrderPricing;\r\n\r\n\t// payment: OrderPayment; This should be a virtual field to understand if the payment is done or not\r\n\r\n\t@prop({ type: () => OrderCancel })\r\n\tpublic orderCancel: OrderCancel;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isLateOrder?: boolean;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isUrgentOrder?: boolean;\r\n}\r\n"]}
@@ -1,19 +1,18 @@
1
1
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
- import { FoodGroup, ItemType, ProductDietaryType, Status } from '../../../utilities/enum';
2
+ import { ProductType, ItemType, ProductDietaryType, Status } from '../../../utilities/enum';
3
3
  import { ProductNutrition } from './embedded/product-nutrition.model';
4
4
  export declare class Product extends TimeStamps {
5
5
  name: string;
6
6
  barcode?: string;
7
7
  itemType: ItemType;
8
- foodGroup?: FoodGroup;
8
+ productType?: ProductType;
9
9
  images: string[];
10
10
  status?: Status;
11
+ nutritionPackSize?: number;
12
+ nutritionPackSizeUnit?: number;
11
13
  nutritionServingSize?: number;
12
- nutritionServingUnit?: string;
13
- nutritionPerUnit?: number;
14
14
  nutritionCalories?: number;
15
15
  nutritions?: ProductNutrition[];
16
16
  dietaryTypes?: ProductDietaryType[];
17
- storingTemperature?: number;
18
- storingTemperatureUnit?: string;
17
+ storedTemperature?: number;
19
18
  }
@@ -18,17 +18,16 @@ let Product = class Product extends defaultClasses_1.TimeStamps {
18
18
  name;
19
19
  barcode;
20
20
  itemType;
21
- foodGroup;
21
+ productType;
22
22
  images;
23
23
  status;
24
+ nutritionPackSize;
25
+ nutritionPackSizeUnit;
24
26
  nutritionServingSize;
25
- nutritionServingUnit;
26
- nutritionPerUnit;
27
27
  nutritionCalories;
28
28
  nutritions;
29
29
  dietaryTypes;
30
- storingTemperature;
31
- storingTemperatureUnit;
30
+ storedTemperature;
32
31
  };
33
32
  exports.Product = Product;
34
33
  __decorate([
@@ -44,9 +43,9 @@ __decorate([
44
43
  __metadata("design:type", String)
45
44
  ], Product.prototype, "itemType", void 0);
46
45
  __decorate([
47
- (0, typegoose_1.prop)({ type: String, enum: enum_1.FoodGroup }),
46
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.ProductType }),
48
47
  __metadata("design:type", String)
49
- ], Product.prototype, "foodGroup", void 0);
48
+ ], Product.prototype, "productType", void 0);
50
49
  __decorate([
51
50
  (0, typegoose_1.prop)({ required: true, type: [String] }),
52
51
  __metadata("design:type", Array)
@@ -58,15 +57,15 @@ __decorate([
58
57
  __decorate([
59
58
  (0, typegoose_1.prop)({ type: Number, min: 0 }),
60
59
  __metadata("design:type", Number)
61
- ], Product.prototype, "nutritionServingSize", void 0);
60
+ ], Product.prototype, "nutritionPackSize", void 0);
62
61
  __decorate([
63
- (0, typegoose_1.prop)({ type: String }),
64
- __metadata("design:type", String)
65
- ], Product.prototype, "nutritionServingUnit", void 0);
62
+ (0, typegoose_1.prop)({ type: Number, min: 0 }),
63
+ __metadata("design:type", Number)
64
+ ], Product.prototype, "nutritionPackSizeUnit", void 0);
66
65
  __decorate([
67
66
  (0, typegoose_1.prop)({ type: Number, min: 0 }),
68
67
  __metadata("design:type", Number)
69
- ], Product.prototype, "nutritionPerUnit", void 0);
68
+ ], Product.prototype, "nutritionServingSize", void 0);
70
69
  __decorate([
71
70
  (0, typegoose_1.prop)({ type: Number, min: 0 }),
72
71
  __metadata("design:type", Number)
@@ -82,11 +81,7 @@ __decorate([
82
81
  __decorate([
83
82
  (0, typegoose_1.prop)({ type: Number }),
84
83
  __metadata("design:type", Number)
85
- ], Product.prototype, "storingTemperature", void 0);
86
- __decorate([
87
- (0, typegoose_1.prop)({ type: String }),
88
- __metadata("design:type", String)
89
- ], Product.prototype, "storingTemperatureUnit", void 0);
84
+ ], Product.prototype, "storedTemperature", void 0);
90
85
  exports.Product = Product = __decorate([
91
86
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'products' } }),
92
87
  (0, typegoose_1.Index)({ name: 1, itemType: 1 }, {
@@ -1 +1 @@
1
- {"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiE;AACjE,4EAAqE;AACrE,kDAA0F;AAC1F,gFAAsE;AAU/D,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,QAAQ,CAAY;IAGpB,SAAS,CAAa;IAGtB,MAAM,CAAY;IAGlB,MAAM,CAAU;IAGhB,oBAAoB,CAAU;IAG9B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I,EAAE,CAAC,0CAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2CACT;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,yBAAkB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;6CACrB;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACY;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDACgB;kBAzC3B,OAAO;IARnB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAC3D,IAAA,iBAAK,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EACxB;QACC,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,eAAQ,CAAC,OAAO,EAAE,eAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;KACtG,CACD;GACY,OAAO,CA0CnB","sourcesContent":["import { Index, modelOptions, prop } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { FoodGroup, ItemType, ProductDietaryType, Status } from '../../../utilities/enum';\r\nimport { ProductNutrition } from './embedded/product-nutrition.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'products' } })\r\n@Index(\r\n\t{ name: 1, itemType: 1 },\r\n\t{\r\n\t\tunique: true,\r\n\t\tpartialFilterExpression: { itemType: { $in: [ItemType.GROCERY, ItemType.PHARMACY] }, deletedAt: null },\r\n\t}\r\n)\r\nexport class Product extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic barcode?: string;\r\n\r\n\t@prop({ required: true, type: String, enum: ItemType })\r\n\tpublic itemType!: ItemType;\r\n\r\n\t@prop({ type: String, enum: FoodGroup })\r\n\tpublic foodGroup?: FoodGroup;\r\n\r\n\t@prop({ required: true, type: [String] })\r\n\tpublic images!: string[];\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionServingSize?: number;\r\n\r\n\t@prop({ type: String })\r\n\tpublic nutritionServingUnit?: string;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionPerUnit?: number;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionCalories?: number;\r\n\r\n\t@prop({ type: [ProductNutrition], default: [] })\r\n\tpublic nutritions?: ProductNutrition[];\r\n\r\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\r\n\tpublic dietaryTypes?: ProductDietaryType[];\r\n\r\n\t@prop({ type: Number })\r\n\tpublic storingTemperature?: number;\r\n\r\n\t@prop({ type: String })\r\n\tpublic storingTemperatureUnit?: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiE;AACjE,4EAAqE;AACrE,kDAA4F;AAC5F,gFAAsE;AAU/D,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,QAAQ,CAAY;IAGpB,WAAW,CAAe;IAG1B,MAAM,CAAY;IAGlB,MAAM,CAAU;IAGhB,iBAAiB,CAAU;IAG3B,qBAAqB,CAAU;IAG/B,oBAAoB,CAAU;IAG9B,iBAAiB,CAAU;IAG3B,UAAU,CAAsB;IAGhC,YAAY,CAAwB;IAGpC,iBAAiB,CAAU;CAClC,CAAA;AAvCY,0BAAO;AAEZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,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EAAE,CAAC;;6CACrB;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACW;kBAtCtB,OAAO;IARnB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAC3D,IAAA,iBAAK,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EACxB;QACC,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,eAAQ,CAAC,OAAO,EAAE,eAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;KACtG,CACD;GACY,OAAO,CAuCnB","sourcesContent":["import { Index, modelOptions, prop } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ProductType, ItemType, ProductDietaryType, Status } from '../../../utilities/enum';\r\nimport { ProductNutrition } from './embedded/product-nutrition.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'products' } })\r\n@Index(\r\n\t{ name: 1, itemType: 1 },\r\n\t{\r\n\t\tunique: true,\r\n\t\tpartialFilterExpression: { itemType: { $in: [ItemType.GROCERY, ItemType.PHARMACY] }, deletedAt: null },\r\n\t}\r\n)\r\nexport class Product extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic barcode?: string;\r\n\r\n\t@prop({ required: true, type: String, enum: ItemType })\r\n\tpublic itemType!: ItemType;\r\n\r\n\t@prop({ type: String, enum: ProductType })\r\n\tpublic productType?: ProductType;\r\n\r\n\t@prop({ required: true, type: [String] })\r\n\tpublic images!: string[];\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionPackSize?: number;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionPackSizeUnit?: number;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionServingSize?: number;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic nutritionCalories?: number;\r\n\r\n\t@prop({ type: [ProductNutrition], default: [] })\r\n\tpublic nutritions?: ProductNutrition[];\r\n\r\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\r\n\tpublic dietaryTypes?: ProductDietaryType[];\r\n\r\n\t@prop({ type: Number })\r\n\tpublic storedTemperature?: number;\r\n}\r\n"]}
@@ -0,0 +1,23 @@
1
+ import { Order } from '../order.model';
2
+ import { CourierOrderStatus, CourierServiceType, OrderType } from '../../../../utilities/enum';
3
+ import { CourierAddress } from '../shared/address.model';
4
+ import { CourierOrderStatusTimeline } from '../embedded/status-timeline.model';
5
+ declare class CourierItem {
6
+ productName: string;
7
+ productImage?: string;
8
+ quantity: number;
9
+ unitPrice?: number;
10
+ secondaryUnitPrice?: number;
11
+ totalPrice?: number;
12
+ secondaryTotalPrice?: number;
13
+ }
14
+ export declare class CourierOrder extends Order {
15
+ orderType: OrderType.COURIER;
16
+ status?: CourierOrderStatus;
17
+ statusTimeline: CourierOrderStatusTimeline[];
18
+ courierType: CourierServiceType;
19
+ pickupLocation: CourierAddress;
20
+ deliveryLocation: CourierAddress;
21
+ items?: CourierItem[];
22
+ }
23
+ export {};