@lyxa.ai/core 1.0.23 → 1.0.25

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 (35) hide show
  1. package/dist/libraries/mongo/models/parent.model.d.ts +1 -0
  2. package/dist/libraries/mongo/models/parent.model.js +6 -1
  3. package/dist/libraries/mongo/models/parent.model.js.map +1 -1
  4. package/dist/libraries/mongo/models/shared/address.model.d.ts +3 -0
  5. package/dist/libraries/mongo/models/shared/address.model.js +7 -1
  6. package/dist/libraries/mongo/models/shared/address.model.js.map +1 -1
  7. package/dist/utilities/common/week.js.map +1 -1
  8. package/dist/utilities/pagination.d.ts +9 -2
  9. package/dist/utilities/pagination.js +23 -36
  10. package/dist/utilities/pagination.js.map +1 -1
  11. package/package.json +1 -1
  12. package/dist/libraries/mongo/models/cart-lineitem.model.d.ts +0 -29
  13. package/dist/libraries/mongo/models/cart-lineitem.model.js +0 -120
  14. package/dist/libraries/mongo/models/cart-lineitem.model.js.map +0 -1
  15. package/dist/libraries/mongo/models/cart-perticipant.model.d.ts +0 -22
  16. package/dist/libraries/mongo/models/cart-perticipant.model.js +0 -104
  17. package/dist/libraries/mongo/models/cart-perticipant.model.js.map +0 -1
  18. package/dist/libraries/mongo/models/embedded/addon.model.d.ts +0 -8
  19. package/dist/libraries/mongo/models/embedded/addon.model.js +0 -34
  20. package/dist/libraries/mongo/models/embedded/addon.model.js.map +0 -1
  21. package/dist/libraries/mongo/models/embedded/payment-details.model.d.ts +0 -9
  22. package/dist/libraries/mongo/models/embedded/payment-details.model.js +0 -52
  23. package/dist/libraries/mongo/models/embedded/payment-details.model.js.map +0 -1
  24. package/dist/libraries/mongo/models/embedded/portion.model.d.ts +0 -5
  25. package/dist/libraries/mongo/models/embedded/portion.model.js +0 -32
  26. package/dist/libraries/mongo/models/embedded/portion.model.js.map +0 -1
  27. package/dist/libraries/mongo/models/embedded/price.model.d.ts +0 -5
  28. package/dist/libraries/mongo/models/embedded/price.model.js +0 -32
  29. package/dist/libraries/mongo/models/embedded/price.model.js.map +0 -1
  30. package/dist/libraries/mongo/models/order-pricing.model.d.ts +0 -18
  31. package/dist/libraries/mongo/models/order-pricing.model.js +0 -88
  32. package/dist/libraries/mongo/models/order-pricing.model.js.map +0 -1
  33. package/dist/libraries/mongo/models/shop-product.model.d.ts +0 -25
  34. package/dist/libraries/mongo/models/shop-product.model.js +0 -102
  35. package/dist/libraries/mongo/models/shop-product.model.js.map +0 -1
@@ -7,6 +7,7 @@ import { ParentDocument } from './embedded/parent-document.model';
7
7
  import { Address } from './shared/address.model';
8
8
  export declare class Parent extends TimeStamps {
9
9
  name: string;
10
+ email: string;
10
11
  phoneNumber: string;
11
12
  address: Address;
12
13
  chargeType: ChargeType;
@@ -19,6 +19,7 @@ const parent_document_model_1 = require("./embedded/parent-document.model");
19
19
  const address_model_1 = require("./shared/address.model");
20
20
  let Parent = class Parent extends defaultClasses_1.TimeStamps {
21
21
  name;
22
+ email;
22
23
  phoneNumber;
23
24
  address;
24
25
  chargeType;
@@ -35,6 +36,10 @@ __decorate([
35
36
  (0, typegoose_1.prop)({ required: true, type: String }),
36
37
  __metadata("design:type", String)
37
38
  ], Parent.prototype, "name", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ required: true, type: String }),
41
+ __metadata("design:type", String)
42
+ ], Parent.prototype, "email", void 0);
38
43
  __decorate([
39
44
  (0, typegoose_1.prop)({ required: true, type: String }),
40
45
  __metadata("design:type", String)
@@ -76,7 +81,7 @@ __decorate([
76
81
  __metadata("design:type", parent_document_model_1.ParentDocument)
77
82
  ], Parent.prototype, "document", void 0);
78
83
  exports.Parent = Parent = __decorate([
79
- (0, typegoose_1.index)({ companyName: 1, itemType: 1 }, {
84
+ (0, typegoose_1.index)({ name: 1, itemType: 1 }, {
80
85
  unique: true,
81
86
  partialFilterExpression: { deletedAt: null },
82
87
  name: 'companyName_itemType_unique',
@@ -1 +1 @@
1
- {"version":3,"file":"parent.model.js","sourceRoot":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;mDAClB;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;oDACc;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;sCACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACV;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,sCAAc,EAAE,CAAC;8BAC7B,sCAAc;wCAAC;iBAhCrB,MAAM;IATlB,IAAA,iBAAK,EACL,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAC/B;QACC,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;QAC5C,IAAI,EAAE,6BAA6B;KACnC,CACD;IACA,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;GAC9C,MAAM,CAiClB","sourcesContent":["import { index, modelOptions, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ChargeType, ItemType, Status } from '../../../utilities/enum';\r\nimport { Admin } from './admin.model';\r\nimport { Charge } from './embedded/charge.model';\r\nimport { ParentDocument } from './embedded/parent-document.model';\r\nimport { Address } from './shared/address.model';\r\n\r\n@index(\r\n\t{ companyName: 1, itemType: 1 },\r\n\t{\r\n\t\tunique: true,\r\n\t\tpartialFilterExpression: { deletedAt: null },\r\n\t\tname: 'companyName_itemType_unique',\r\n\t}\r\n)\r\n@modelOptions({ schemaOptions: { collection: 'parents' } })\r\nexport class Parent extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic phoneNumber!: string;\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic address!: Address;\r\n\r\n\t@prop({ required: true, type: String, enum: ChargeType })\r\n\tpublic chargeType!: ChargeType;\r\n\r\n\t@prop({ type: Charge })\r\n\tpublic charge?: Charge;\r\n\r\n\t@prop({ required: true, type: String, enum: ItemType })\r\n\tpublic itemType!: ItemType;\r\n\r\n\t@prop({ required: true, type: Boolean, default: true })\r\n\tpublic isServiceFeeCharged!: boolean;\r\n\r\n\t@prop({ ref: () => Admin })\r\n\tpublic businessDevExecutive?: Ref<Admin>;\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic profilePhoto!: string;\r\n\r\n\t@prop({ required: true, type: ParentDocument })\r\n\tpublic document!: ParentDocument;\r\n}\r\n"]}
1
+ {"version":3,"file":"parent.model.js","sourceRoot":"/","sources":["libraries/mongo/models/parent.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAuE;AACvE,+CAAsC;AACtC,0DAAiD;AACjD,4EAAkE;AAClE,0DAAiD;AAW1C,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,OAAO,CAAW;IAGlB,UAAU,CAAc;IAGxB,MAAM,CAAU;IAGhB,QAAQ,CAAY;IAGpB,mBAAmB,CAAW;IAG9B,oBAAoB,CAAc;IAGlC,MAAM,CAAU;IAGhB,YAAY,CAAU;IAGtB,QAAQ,CAAkB;CACjC,CAAA;AApCY,wBAAM;AAEX;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,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K,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EACxB;QACC,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;QAC5C,IAAI,EAAE,6BAA6B;KACnC,CACD;IACA,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC;GAC9C,MAAM,CAoClB","sourcesContent":["import { index, modelOptions, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ChargeType, ItemType, Status } from '../../../utilities/enum';\r\nimport { Admin } from './admin.model';\r\nimport { Charge } from './embedded/charge.model';\r\nimport { ParentDocument } from './embedded/parent-document.model';\r\nimport { Address } from './shared/address.model';\r\n\r\n@index(\r\n\t{ name: 1, itemType: 1 },\r\n\t{\r\n\t\tunique: true,\r\n\t\tpartialFilterExpression: { deletedAt: null },\r\n\t\tname: 'companyName_itemType_unique',\r\n\t}\r\n)\r\n@modelOptions({ schemaOptions: { collection: 'parents' } })\r\nexport class Parent extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic email!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic phoneNumber!: string;\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic address!: Address;\r\n\r\n\t@prop({ required: true, type: String, enum: ChargeType })\r\n\tpublic chargeType!: ChargeType;\r\n\r\n\t@prop({ type: Charge })\r\n\tpublic charge?: Charge;\r\n\r\n\t@prop({ required: true, type: String, enum: ItemType })\r\n\tpublic itemType!: ItemType;\r\n\r\n\t@prop({ required: true, type: Boolean, default: true })\r\n\tpublic isServiceFeeCharged!: boolean;\r\n\r\n\t@prop({ ref: () => Admin })\r\n\tpublic businessDevExecutive?: Ref<Admin>;\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic profilePhoto!: string;\r\n\r\n\t@prop({ required: true, type: ParentDocument })\r\n\tpublic document!: ParentDocument;\r\n}\r\n"]}
@@ -1,4 +1,6 @@
1
+ import { Zone } from '../zone.model';
1
2
  import { GeoLocation } from "./geo-location.model";
3
+ import { Ref } from '@typegoose/typegoose';
2
4
  export declare class Address {
3
5
  address: string;
4
6
  description?: string;
@@ -8,6 +10,7 @@ export declare class Address {
8
10
  location: GeoLocation;
9
11
  latitude: number;
10
12
  longitude: number;
13
+ zone?: Ref<Zone>;
11
14
  }
12
15
  export declare class UserAddress extends Address {
13
16
  addressLabel: string;
@@ -10,8 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CourierAddress = exports.UserAddress = exports.Address = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
13
+ const zone_model_1 = require("../zone.model");
14
14
  const geo_location_model_1 = require("./geo-location.model");
15
+ const typegoose_1 = require("@typegoose/typegoose");
15
16
  let Address = class Address {
16
17
  address;
17
18
  description;
@@ -21,6 +22,7 @@ let Address = class Address {
21
22
  location;
22
23
  latitude;
23
24
  longitude;
25
+ zone;
24
26
  };
25
27
  exports.Address = Address;
26
28
  __decorate([
@@ -55,6 +57,10 @@ __decorate([
55
57
  (0, typegoose_1.prop)({ required: true, type: Number }),
56
58
  __metadata("design:type", Number)
57
59
  ], Address.prototype, "longitude", void 0);
60
+ __decorate([
61
+ (0, typegoose_1.prop)({ ref: () => zone_model_1.Zone }),
62
+ __metadata("design:type", Object)
63
+ ], Address.prototype, "zone", void 0);
58
64
  exports.Address = Address = __decorate([
59
65
  (0, typegoose_1.index)({ location: '2dsphere' })
60
66
  ], Address);
@@ -1 +1 @@
1
- {"version":3,"file":"address.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/address.model.ts"],"names":[],"mappings":";;;;;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YAAY,CAAU;CAC7B;AAfD,kCAeC;AAbO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACV;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACb;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACV;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACQ;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACM;AAG9B,MAAa,cAAe,SAAQ,WAAW;IAEvC,IAAI,CAAS;IAGb,WAAW,CAAS;CAC3B;AAND,wCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACH;AAGb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACZ","sourcesContent":["import {index, prop} from '@typegoose/typegoose';\r\nimport { GeoLocationType } from '../../../../utilities/enum';\r\nimport {GeoLocation} from \"./geo-location.model\";\r\n\r\n@index({ location: '2dsphere' })\r\nexport class Address {\r\n\t@prop({ required: true, type: String })\r\n\tpublic address!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic description?: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic city!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic state!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic country!: string;\r\n\r\n\t@prop({ type: GeoLocation })\r\n\tpublic location!: GeoLocation;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic latitude!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic longitude!: number;\r\n}\r\n\r\nexport class UserAddress extends Address {\r\n\t@prop({ required: true, type: String })\r\n\tpublic addressLabel!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic apartment!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic buildingName!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic deliveryOption?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic instructions?: string;\r\n}\r\n\r\nexport class CourierAddress extends UserAddress {\r\n\t@prop({ type: String })\r\n\tpublic name: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic phonenumber: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"address.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/address.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAqC;AACrC,6DAAiD;AACjD,oDAAsD;AAG/C,IAAM,OAAO,GAAb,MAAM,OAAO;IAEZ,OAAO,CAAU;IAGjB,WAAW,CAAU;IAGrB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,OAAO,CAAU;IAGjB,QAAQ,CAAe;IAGvB,QAAQ,CAAU;IAGlB,SAAS,CAAU;IAGnB,IAAI,CAAa;CACxB,CAAA;AA3BY,0BAAO;AAEZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCACf;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACK;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EA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AAM,EAAE,CAAC;;4CACH;AAGb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACZ","sourcesContent":["import { Zone } from '../zone.model';\r\nimport {GeoLocation} from \"./geo-location.model\";\r\nimport {index, prop, Ref} from '@typegoose/typegoose';\r\n\r\n@index({ location: '2dsphere' })\r\nexport class Address {\r\n\t@prop({ required: true, type: String })\r\n\tpublic address!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic description?: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic city!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic state!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic country!: string;\r\n\r\n\t@prop({ type: GeoLocation })\r\n\tpublic location!: GeoLocation;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic latitude!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic longitude!: number;\r\n\r\n\t@prop({ ref: () => Zone })\r\n\tpublic zone?: Ref<Zone>;\r\n}\r\n\r\nexport class UserAddress extends Address {\r\n\t@prop({ required: true, type: String })\r\n\tpublic addressLabel!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic apartment!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic buildingName!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic deliveryOption?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic instructions?: string;\r\n}\r\n\r\nexport class CourierAddress extends UserAddress {\r\n\t@prop({ type: String })\r\n\tpublic name: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic phonenumber: string;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"week.js","sourceRoot":"/","sources":["utilities/common/week.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACzD,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CACvF,CAAC","sourcesContent":["export const daysOfWeek = Array.from({ length: 7 }, (_, i) =>\r\n new Intl.DateTimeFormat('en-US', { weekday: 'long' }).format(new Date(1970, 0, 4 + i))\r\n );"]}
1
+ {"version":3,"file":"week.js","sourceRoot":"/","sources":["utilities/common/week.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACzD,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CACzF,CAAC","sourcesContent":["export const daysOfWeek = Array.from({ length: 7 }, (_, i) =>\r\n new Intl.DateTimeFormat('en-US', { weekday: 'long' }).format(new Date(1970, 0, 4 + i))\r\n);"]}
@@ -2,7 +2,6 @@ import { DocumentType, ReturnModelType } from '@typegoose/typegoose';
2
2
  import { FilterQuery, PopulateOptions } from 'mongoose';
3
3
  import { z } from 'zod';
4
4
  import { AnyParamConstructor } from '@typegoose/typegoose/lib/types';
5
- import { FilterDTO, PaginatedResponse } from './validation';
6
5
  export declare function createPaginatedSchema<ItemType extends z.ZodTypeAny>(itemSchema: ItemType): z.ZodObject<{
7
6
  metadata: z.ZodObject<{
8
7
  page: z.ZodNumber;
@@ -65,4 +64,12 @@ export declare function createPaginatorObject<T extends AnyParamConstructor<any>
65
64
  };
66
65
  items: any[];
67
66
  }>;
68
- export declare function aggregateWithPagination<T>(Model: any, aggregationPipeline: any[], query?: Partial<FilterDTO>): Promise<PaginatedResponse<T>>;
67
+ export declare function paginateAggregation(model: any, pipeline: any[], page?: number, size?: number, sort?: any): Promise<{
68
+ metadata: {
69
+ page: number;
70
+ size: number;
71
+ totalElements: any;
72
+ totalPages: number;
73
+ };
74
+ documents: any;
75
+ }>;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPaginatedSchema = createPaginatedSchema;
4
4
  exports.createRawDocumentPaginatorObject = createRawDocumentPaginatorObject;
5
5
  exports.createPaginatorObject = createPaginatorObject;
6
- exports.aggregateWithPagination = aggregateWithPagination;
6
+ exports.paginateAggregation = paginateAggregation;
7
7
  const zod_1 = require("zod");
8
8
  function createPaginatedSchema(itemSchema) {
9
9
  return zod_1.z.object({
@@ -59,40 +59,27 @@ function createPaginatorObject(model, itemSchema, transformFn) {
59
59
  return PaginatedSchema.parse(paginatedResult);
60
60
  };
61
61
  }
62
- async function aggregateWithPagination(Model, aggregationPipeline, query) {
63
- const limit = query?.size ?? 10;
64
- const skip = query?.page && query?.size ? query.page * query.size : 0;
65
- const searchQuery = query?.query || {};
66
- const dataPipeline = [
67
- ...aggregationPipeline,
68
- { $sort: query?.sort || { createdAt: -1 } },
69
- { $skip: skip },
70
- { $limit: limit },
71
- ];
72
- const countPipeline = aggregationPipeline.some(stage => stage.$group || stage.$unwind)
73
- ? [...aggregationPipeline, { $count: 'total' }]
74
- : [...aggregationPipeline, { $count: 'total' }];
75
- try {
76
- const [data, countResult] = await Promise.all([
77
- Model.aggregate(dataPipeline).exec(),
78
- Model.aggregate(countPipeline).exec(),
79
- ]);
80
- const totalElements = countResult.length > 0 ? countResult[0].total : 0;
81
- const page = Math.floor(skip / limit) + 1;
82
- const totalPages = Math.ceil(totalElements / limit);
83
- return {
84
- metadata: {
85
- page,
86
- size: limit,
87
- totalElements,
88
- totalPages,
89
- },
90
- documents: data,
91
- };
92
- }
93
- catch (error) {
94
- console.error('Error during aggregation:', error);
95
- throw new Error('Failed to fetch paginated data');
96
- }
62
+ async function paginateAggregation(model, pipeline, page = 1, size = 10, sort = { createdAt: -1 }) {
63
+ const skip = (page - 1) * size;
64
+ const limit = size;
65
+ const pipelineWithCount = [...pipeline];
66
+ pipelineWithCount.push({ $count: 'totalCount' });
67
+ const totalCountResult = await model.aggregate(pipelineWithCount).exec();
68
+ const totalElements = totalCountResult?.[0]?.totalCount || 0;
69
+ const totalPages = Math.ceil(totalElements / size);
70
+ const paginatedPipeline = [...pipeline];
71
+ paginatedPipeline.push({ $sort: sort });
72
+ paginatedPipeline.push({ $skip: skip });
73
+ paginatedPipeline.push({ $limit: limit });
74
+ const data = await model.aggregate(paginatedPipeline).exec();
75
+ return {
76
+ metadata: {
77
+ page,
78
+ size,
79
+ totalElements,
80
+ totalPages,
81
+ },
82
+ documents: data,
83
+ };
97
84
  }
98
85
  //# sourceMappingURL=pagination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"/","sources":["utilities/pagination.ts"],"names":[],"mappings":";;AASA,sDAUC;AAqED,4EAWC;AASD,sDAmBC;AACD,0DA8CC;AA5KD,6BAAwB;AAOxB,SAAgB,qBAAqB,CAAgC,UAAoB;IACxF,OAAO,OAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;YACzB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;SACtB,CAAC;QACF,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,UAAU,CAAC;KAC1B,CAAC,CAAC;AACJ,CAAC;AA+BD,KAAK,UAAU,aAAa,CAC3B,KAAyB,EACzB,OAA4B;IAE5B,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,GAAG,CAAC,E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AAC,CAAC,CAAC,GAAG,mBAAmB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAEjD,IAAI,CAAC;QAEJ,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC7C,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE;YACpC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE;SACrC,CAAC,CAAC;QAGH,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;QAEpD,OAAO;YACN,QAAQ,EAAE;gBACT,IAAI;gBACJ,IAAI,EAAE,KAAK;gBACX,aAAa;gBACb,UAAU;aACV;YACD,SAAS,EAAE,IAAI;SACf,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACnD,CAAC;AACF,CAAC","sourcesContent":["import { DocumentType, ReturnModelType } from '@typegoose/typegoose';\r\nimport { FilterQuery, PopulateOptions } from 'mongoose';\r\nimport { z } from 'zod';\r\nimport { AnyParamConstructor } from '@typegoose/typegoose/lib/types';\r\nimport { FilterDTO, PaginatedResponse } from './validation';\r\n\r\n/**\r\n * A helper to create a paginated Zod schema for an item type.\r\n */\r\nexport function createPaginatedSchema<ItemType extends z.ZodTypeAny>(itemSchema: ItemType) {\r\n\treturn z.object({\r\n\t\tmetadata: z.object({\r\n\t\t\tpage: z.number(),\r\n\t\t\tsize: z.number(),\r\n\t\t\ttotalElements: z.number(),\r\n\t\t\ttotalPages: z.number(),\r\n\t\t}),\r\n\t\titems: z.array(itemSchema),\r\n\t});\r\n}\r\n\r\nexport interface RawPaginatedResult<T extends AnyParamConstructor<any>> {\r\n\tmetadata: {\r\n\t\tpage: number;\r\n\t\tsize: number;\r\n\t\ttotalElements: number;\r\n\t\ttotalPages: number;\r\n\t};\r\n\tdocuments: DocumentType<T>[];\r\n}\r\n\r\n/**\r\n * The common pagination options.\r\n */\r\nexport interface PaginatorOptions<TClass extends AnyParamConstructor<any>> {\r\n\tquery?: FilterQuery<DocumentType<TClass>>;\r\n\tpage?: number;\r\n\tsize?: number;\r\n\tsort?: Record<string, 1 | -1>;\r\n\tselect?: Record<string, 0 | 1>;\r\n\tpopulate?: PopulateOptions | (PopulateOptions | string)[];\r\n}\r\n\r\n/**\r\n * This internal function wraps the common query logic:\r\n * - filter, page, size, sort, populate\r\n * - fetch documents, count documents\r\n * - compute totalPages\r\n * Returns a standard object with `metadata` & `documents`.\r\n */\r\nasync function _basePaginate<T extends AnyParamConstructor<any>>(\r\n\tmodel: ReturnModelType<T>,\r\n\toptions: PaginatorOptions<T>\r\n): Promise<RawPaginatedResult<T>> {\r\n\tconst { query = {}, page = 1, size = 10, sort = {}, select, populate } = options;\r\n\r\n\tconst skip = (page - 1) * size;\r\n\r\n\tlet result = model.find(query).sort(sort).skip(skip).limit(size);\r\n\r\n\tif (select) {\r\n\t\tresult = result.select(select) as any;\r\n\t}\r\n\tif (populate) {\r\n\t\tresult = result.populate(populate);\r\n\t}\r\n\r\n\tconst [documents, totalElements] = await Promise.all([result.exec(), model.countDocuments(query)]);\r\n\r\n\tconst totalPages = Math.ceil(totalElements / size);\r\n\r\n\treturn {\r\n\t\tmetadata: {\r\n\t\t\tpage,\r\n\t\t\tsize,\r\n\t\t\ttotalElements,\r\n\t\t\ttotalPages,\r\n\t\t},\r\n\t\tdocuments: documents as unknown as DocumentType<T>[],\r\n\t};\r\n}\r\n\r\n/**\r\n * Creates a paginator returning raw documents.\r\n *\r\n * @param model The Typegoose model\r\n * @returns A function that, when passed `PaginatorOptions`, returns raw docs + metadata.\r\n */\r\nexport function createRawDocumentPaginatorObject<T extends AnyParamConstructor<any>>(\r\n\tmodel: ReturnModelType<T>\r\n) {\r\n\treturn async function paginate(options: PaginatorOptions<T>): Promise<RawPaginatedResult<T>> {\r\n\t\tconst { metadata, documents } = await _basePaginate(model, options);\r\n\r\n\t\treturn {\r\n\t\t\tmetadata,\r\n\t\t\tdocuments,\r\n\t\t};\r\n\t};\r\n}\r\n\r\n/**\r\n * Creates a paginator that returns Zod-validated items.\r\n *\r\n * @param model The Typegoose model\r\n * @param itemSchema A Zod schema describing the shape of each item\r\n * @param transformFn Optional transform function to convert raw doc -> item\r\n */\r\nexport function createPaginatorObject<T extends AnyParamConstructor<any>>(\r\n\tmodel: ReturnModelType<T>,\r\n\titemSchema: z.ZodTypeAny,\r\n\ttransformFn?: (doc: DocumentType<T>) => z.infer<typeof itemSchema>\r\n) {\r\n\tconst PaginatedSchema = createPaginatedSchema(itemSchema);\r\n\r\n\treturn async function paginate(options: PaginatorOptions<T>) {\r\n\t\tconst { metadata, documents } = await _basePaginate(model, options);\r\n\r\n\t\tconst items = transformFn ? documents.map(transformFn) : documents;\r\n\r\n\t\tconst paginatedResult = {\r\n\t\t\tmetadata,\r\n\t\t\titems,\r\n\t\t};\r\n\r\n\t\treturn PaginatedSchema.parse(paginatedResult);\r\n\t};\r\n}\r\nexport async function aggregateWithPagination<T>(\r\n\tModel: any,\r\n\taggregationPipeline: any[], // This will allow us to pass custom aggregation pipelines\r\n\tquery?: Partial<FilterDTO>\r\n): Promise<PaginatedResponse<T>> {\r\n\tconst limit: number = query?.size ?? 10;\r\n\tconst skip: number = query?.page && query?.size ? query.page * query.size : 0;\r\n\tconst searchQuery = query?.query || {};\r\n\r\n\t// Pagination Logic: Create a basic pipeline for pagination and counting\r\n\tconst dataPipeline = [\r\n\t\t...aggregationPipeline,\r\n\t\t{ $sort: query?.sort || { createdAt: -1 } },\r\n\t\t{ $skip: skip },\r\n\t\t{ $limit: limit },\r\n\t];\r\n\r\n\tconst countPipeline = aggregationPipeline.some(stage => stage.$group || stage.$unwind)\r\n\t\t? [...aggregationPipeline, { $count: 'total' }]\r\n\t\t: [...aggregationPipeline, { $count: 'total' }];\r\n\r\n\ttry {\r\n\t\t// Execute the aggregation pipeline for both data and count\r\n\t\tconst [data, countResult] = await Promise.all([\r\n\t\t\tModel.aggregate(dataPipeline).exec(),\r\n\t\t\tModel.aggregate(countPipeline).exec(),\r\n\t\t]);\r\n\r\n\t\t// Calculate pagination metadata\r\n\t\tconst totalElements = countResult.length > 0 ? countResult[0].total : 0;\r\n\t\tconst page = Math.floor(skip / limit) + 1;\r\n\t\tconst totalPages = Math.ceil(totalElements / limit);\r\n\r\n\t\treturn {\r\n\t\t\tmetadata: {\r\n\t\t\t\tpage,\r\n\t\t\t\tsize: limit,\r\n\t\t\t\ttotalElements,\r\n\t\t\t\ttotalPages,\r\n\t\t\t},\r\n\t\t\tdocuments: data,\r\n\t\t};\r\n\t} catch (error) {\r\n\t\tconsole.error('Error during aggregation:', error);\r\n\t\tthrow new Error('Failed to fetch paginated data');\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"pagination.js","sourceRoot":"/","sources":["utilities/pagination.ts"],"names":[],"mappings":";;AASA,sDAUC;AAqED,4EAWC;AASD,sDAmBC;AACD,kDAyCC;AAvKD,6BAAwB;AAOxB,SAAgB,qBAAqB,CAAgC,UAAoB;IACxF,OAAO,OAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;YACzB,UAAU,EAAE,O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AAI,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAGnD,MAAM,iBAAiB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IACxC,iBAAiB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,iBAAiB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAG1C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;IAG7D,OAAO;QACN,QAAQ,EAAE;YACT,IAAI;YACJ,IAAI;YACJ,aAAa;YACb,UAAU;SACV;QACD,SAAS,EAAE,IAAI;KACf,CAAC;AACH,CAAC","sourcesContent":["import { DocumentType, ReturnModelType } from '@typegoose/typegoose';\r\nimport { FilterQuery, PopulateOptions } from 'mongoose';\r\nimport { z } from 'zod';\r\nimport { AnyParamConstructor } from '@typegoose/typegoose/lib/types';\r\nimport { FilterDTO, PaginatedResponse } from './validation';\r\n\r\n/**\r\n * A helper to create a paginated Zod schema for an item type.\r\n */\r\nexport function createPaginatedSchema<ItemType extends z.ZodTypeAny>(itemSchema: ItemType) {\r\n\treturn z.object({\r\n\t\tmetadata: z.object({\r\n\t\t\tpage: z.number(),\r\n\t\t\tsize: z.number(),\r\n\t\t\ttotalElements: z.number(),\r\n\t\t\ttotalPages: z.number(),\r\n\t\t}),\r\n\t\titems: z.array(itemSchema),\r\n\t});\r\n}\r\n\r\nexport interface RawPaginatedResult<T extends AnyParamConstructor<any>> {\r\n\tmetadata: {\r\n\t\tpage: number;\r\n\t\tsize: number;\r\n\t\ttotalElements: number;\r\n\t\ttotalPages: number;\r\n\t};\r\n\tdocuments: DocumentType<T>[];\r\n}\r\n\r\n/**\r\n * The common pagination options.\r\n */\r\nexport interface PaginatorOptions<TClass extends AnyParamConstructor<any>> {\r\n\tquery?: FilterQuery<DocumentType<TClass>>;\r\n\tpage?: number;\r\n\tsize?: number;\r\n\tsort?: Record<string, 1 | -1>;\r\n\tselect?: Record<string, 0 | 1>;\r\n\tpopulate?: PopulateOptions | (PopulateOptions | string)[];\r\n}\r\n\r\n/**\r\n * This internal function wraps the common query logic:\r\n * - filter, page, size, sort, populate\r\n * - fetch documents, count documents\r\n * - compute totalPages\r\n * Returns a standard object with `metadata` & `documents`.\r\n */\r\nasync function _basePaginate<T extends AnyParamConstructor<any>>(\r\n\tmodel: ReturnModelType<T>,\r\n\toptions: PaginatorOptions<T>\r\n): Promise<RawPaginatedResult<T>> {\r\n\tconst { query = {}, page = 1, size = 10, sort = {}, select, populate } = options;\r\n\r\n\tconst skip = (page - 1) * size;\r\n\r\n\tlet result = model.find(query).sort(sort).skip(skip).limit(size);\r\n\r\n\tif (select) {\r\n\t\tresult = result.select(select) as any;\r\n\t}\r\n\tif (populate) {\r\n\t\tresult = result.populate(populate);\r\n\t}\r\n\r\n\tconst [documents, totalElements] = await Promise.all([result.exec(), model.countDocuments(query)]);\r\n\r\n\tconst totalPages = Math.ceil(totalElements / size);\r\n\r\n\treturn {\r\n\t\tmetadata: {\r\n\t\t\tpage,\r\n\t\t\tsize,\r\n\t\t\ttotalElements,\r\n\t\t\ttotalPages,\r\n\t\t},\r\n\t\tdocuments: documents as unknown as DocumentType<T>[],\r\n\t};\r\n}\r\n\r\n/**\r\n * Creates a paginator returning raw documents.\r\n *\r\n * @param model The Typegoose model\r\n * @returns A function that, when passed `PaginatorOptions`, returns raw docs + metadata.\r\n */\r\nexport function createRawDocumentPaginatorObject<T extends AnyParamConstructor<any>>(\r\n\tmodel: ReturnModelType<T>\r\n) {\r\n\treturn async function paginate(options: PaginatorOptions<T>): Promise<RawPaginatedResult<T>> {\r\n\t\tconst { metadata, documents } = await _basePaginate(model, options);\r\n\r\n\t\treturn {\r\n\t\t\tmetadata,\r\n\t\t\tdocuments,\r\n\t\t};\r\n\t};\r\n}\r\n\r\n/**\r\n * Creates a paginator that returns Zod-validated items.\r\n *\r\n * @param model The Typegoose model\r\n * @param itemSchema A Zod schema describing the shape of each item\r\n * @param transformFn Optional transform function to convert raw doc -> item\r\n */\r\nexport function createPaginatorObject<T extends AnyParamConstructor<any>>(\r\n\tmodel: ReturnModelType<T>,\r\n\titemSchema: z.ZodTypeAny,\r\n\ttransformFn?: (doc: DocumentType<T>) => z.infer<typeof itemSchema>\r\n) {\r\n\tconst PaginatedSchema = createPaginatedSchema(itemSchema);\r\n\r\n\treturn async function paginate(options: PaginatorOptions<T>) {\r\n\t\tconst { metadata, documents } = await _basePaginate(model, options);\r\n\r\n\t\tconst items = transformFn ? documents.map(transformFn) : documents;\r\n\r\n\t\tconst paginatedResult = {\r\n\t\t\tmetadata,\r\n\t\t\titems,\r\n\t\t};\r\n\r\n\t\treturn PaginatedSchema.parse(paginatedResult);\r\n\t};\r\n}\r\nexport async function paginateAggregation(\r\n\tmodel: any,\r\n\tpipeline: any[],\r\n\tpage: number = 1,\r\n\tsize: number = 10,\r\n\tsort: any = { createdAt: -1 }\r\n) {\r\n\t// Calculate skip and limit based on the page and size\r\n\tconst skip = (page - 1) * size;\r\n\tconst limit = size;\r\n\r\n\t// Copy the pipeline to avoid mutation\r\n\tconst pipelineWithCount = [...pipeline];\r\n\r\n\t// Step 1: Calculate total count\r\n\tpipelineWithCount.push({ $count: 'totalCount' });\r\n\r\n\t// Step 2: Execute to get total count\r\n\tconst totalCountResult = await model.aggregate(pipelineWithCount).exec();\r\n\tconst totalElements = totalCountResult?.[0]?.totalCount || 0;\r\n\tconst totalPages = Math.ceil(totalElements / size);\r\n\r\n\t// Step 3: Apply pagination to the original pipeline\r\n\tconst paginatedPipeline = [...pipeline];\r\n\tpaginatedPipeline.push({ $sort: sort });\r\n\tpaginatedPipeline.push({ $skip: skip });\r\n\tpaginatedPipeline.push({ $limit: limit });\r\n\r\n\t// Step 4: Execute the paginated pipeline\r\n\tconst data = await model.aggregate(paginatedPipeline).exec();\r\n\r\n\t// Return the paginated data with metadata\r\n\treturn {\r\n\t\tmetadata: {\r\n\t\t\tpage,\r\n\t\t\tsize,\r\n\t\t\ttotalElements,\r\n\t\t\ttotalPages,\r\n\t\t},\r\n\t\tdocuments: data,\r\n\t};\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
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,29 +0,0 @@
1
- import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
- import { CoreUser } from './core-user.model';
3
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
4
- import { Cart } from './cart.model';
5
- import { Product } from './product.model';
6
- import { Attribute } from './attribute.model';
7
- import { AttributeItem } from './embedded/attribute-item.model';
8
- export declare class Portion {
9
- price: number;
10
- size?: string;
11
- unit?: string;
12
- }
13
- export declare class AddOn {
14
- attribute: Ref<Attribute>;
15
- attributeItem: AttributeItem;
16
- price: number;
17
- }
18
- export declare class LineItem extends TimeStamps {
19
- cart: Ref<Cart>;
20
- user?: Ref<CoreUser>;
21
- product: Ref<Product>;
22
- quantity: number;
23
- unitPrice: number;
24
- portion?: Portion;
25
- addOns?: AddOn[];
26
- removedIngredients?: string[];
27
- specialInstructions?: string;
28
- }
29
- export declare const LineItemModel: ReturnModelType<typeof LineItem>;
@@ -1,120 +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.LineItemModel = exports.LineItem = exports.AddOn = exports.Portion = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const core_user_model_1 = require("./core-user.model");
15
- const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
16
- const cart_model_1 = require("./cart.model");
17
- const product_model_1 = require("./product.model");
18
- const attribute_model_1 = require("./attribute.model");
19
- const attribute_item_model_1 = require("./embedded/attribute-item.model");
20
- class Portion {
21
- price;
22
- size;
23
- unit;
24
- }
25
- exports.Portion = Portion;
26
- __decorate([
27
- (0, typegoose_1.prop)({ required: true }),
28
- __metadata("design:type", Number)
29
- ], Portion.prototype, "price", void 0);
30
- __decorate([
31
- (0, typegoose_1.prop)(),
32
- __metadata("design:type", String)
33
- ], Portion.prototype, "size", void 0);
34
- __decorate([
35
- (0, typegoose_1.prop)(),
36
- __metadata("design:type", String)
37
- ], Portion.prototype, "unit", void 0);
38
- class AddOn {
39
- attribute;
40
- attributeItem;
41
- price;
42
- }
43
- exports.AddOn = AddOn;
44
- __decorate([
45
- (0, typegoose_1.prop)({ required: true, ref: () => attribute_model_1.Attribute }),
46
- __metadata("design:type", Object)
47
- ], AddOn.prototype, "attribute", void 0);
48
- __decorate([
49
- (0, typegoose_1.prop)({ required: true }),
50
- __metadata("design:type", attribute_item_model_1.AttributeItem)
51
- ], AddOn.prototype, "attributeItem", void 0);
52
- __decorate([
53
- (0, typegoose_1.prop)({ required: true, default: 0 }),
54
- __metadata("design:type", Number)
55
- ], AddOn.prototype, "price", void 0);
56
- let LineItem = class LineItem extends defaultClasses_1.TimeStamps {
57
- cart;
58
- user;
59
- product;
60
- quantity;
61
- unitPrice;
62
- portion;
63
- addOns;
64
- removedIngredients;
65
- specialInstructions;
66
- };
67
- exports.LineItem = LineItem;
68
- __decorate([
69
- (0, typegoose_1.prop)({ required: true, ref: () => cart_model_1.Cart }),
70
- __metadata("design:type", Object)
71
- ], LineItem.prototype, "cart", void 0);
72
- __decorate([
73
- (0, typegoose_1.prop)({ required: false, ref: () => core_user_model_1.CoreUser }),
74
- __metadata("design:type", Object)
75
- ], LineItem.prototype, "user", void 0);
76
- __decorate([
77
- (0, typegoose_1.prop)({ required: true, ref: () => product_model_1.Product }),
78
- __metadata("design:type", Object)
79
- ], LineItem.prototype, "product", void 0);
80
- __decorate([
81
- (0, typegoose_1.prop)({ required: true, min: 1, default: 1 }),
82
- __metadata("design:type", Number)
83
- ], LineItem.prototype, "quantity", void 0);
84
- __decorate([
85
- (0, typegoose_1.prop)(),
86
- __metadata("design:type", Number)
87
- ], LineItem.prototype, "unitPrice", void 0);
88
- __decorate([
89
- (0, typegoose_1.prop)({ type: () => Portion }),
90
- __metadata("design:type", Portion)
91
- ], LineItem.prototype, "portion", void 0);
92
- __decorate([
93
- (0, typegoose_1.prop)({ type: () => [AddOn], default: [] }),
94
- __metadata("design:type", Array)
95
- ], LineItem.prototype, "addOns", void 0);
96
- __decorate([
97
- (0, typegoose_1.prop)({ type: () => [String], default: [] }),
98
- __metadata("design:type", Array)
99
- ], LineItem.prototype, "removedIngredients", void 0);
100
- __decorate([
101
- (0, typegoose_1.prop)(),
102
- __metadata("design:type", String)
103
- ], LineItem.prototype, "specialInstructions", void 0);
104
- exports.LineItem = LineItem = __decorate([
105
- (0, typegoose_1.modelOptions)({
106
- schemaOptions: {
107
- collection: 'lineItems',
108
- toJSON: { virtuals: true },
109
- toObject: { virtuals: true },
110
- },
111
- options: {
112
- allowMixed: typegoose_1.Severity.ALLOW,
113
- },
114
- }),
115
- (0, typegoose_1.index)({ cart: 1 }),
116
- (0, typegoose_1.index)({ cart: 1, user: 1 }),
117
- (0, typegoose_1.index)({ product: 1 })
118
- ], LineItem);
119
- exports.LineItemModel = (0, typegoose_1.getModelForClass)(LineItem);
120
- //# sourceMappingURL=cart-lineitem.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cart-lineitem.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-lineitem.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,uDAA6C;AAC7C,4EAAqE;AACrE,6CAAoC;AACpC,mDAA0C;AAC1C,uDAA8C;AAC9C,0EAAgE;AAEhE,MAAa,OAAO;IAEZ,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,IAAI,CAAU;CACrB;AATD,0BASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACH;AAGf;IADN,IAAA,gBAAI,GAAE;;qCACc;AAGd;IADN,IAAA,gBAAI,GAAE;;qCACc;AAGtB,MAAa,KAAK;IAEV,SAAS,CAAkB;IAG3B,aAAa,CAAiB;IAG9B,KAAK,CAAU;CACtB;AATD,sBASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;wCACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACF,oCAAa;4CAAC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oCACf;AAmBhB,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,m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;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;AAEY,QAAA,aAAa,GAAqC,IAAA,4BAAgB,EAAC,QAAQ,CAAC,CAAC","sourcesContent":["import {\r\n\tprop,\r\n\tgetModelForClass,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { CoreUser } from './core-user.model';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { Product } from './product.model';\r\nimport { Attribute } from './attribute.model';\r\nimport { AttributeItem } from './embedded/attribute-item.model';\r\n\r\nexport class Portion {\r\n\t@prop({ required: true })\r\n\tpublic price!: number;\r\n\r\n\t@prop()\r\n\tpublic size?: string;\r\n\r\n\t@prop()\r\n\tpublic unit?: string;\r\n}\r\n\r\nexport class AddOn {\r\n\t@prop({ required: true, ref: () => Attribute })\r\n\tpublic attribute!: Ref<Attribute>;\r\n\r\n\t@prop({ required: true })\r\n\tpublic attributeItem!: AttributeItem;\r\n\r\n\t@prop({ required: true, default: 0 })\r\n\tpublic price!: number;\r\n}\r\n\r\n/**\r\n * LineItem model - Represents individual items in a cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'lineItems',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1 })\r\n@index({ cart: 1, user: 1 })\r\n@index({ product: 1 })\r\nexport class LineItem extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: false, ref: () => CoreUser })\r\n\tpublic user?: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, ref: () => Product })\r\n\tpublic product!: Ref<Product>;\r\n\r\n\t@prop({ required: true, min: 1, default: 1 })\r\n\tpublic quantity!: number;\r\n\r\n\t@prop()\r\n\tpublic unitPrice!: number;\r\n\r\n\t@prop({ type: () => Portion })\r\n\tpublic portion?: Portion;\r\n\r\n\t@prop({ type: () => [AddOn], default: [] })\r\n\tpublic addOns?: AddOn[];\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic removedIngredients?: string[];\r\n\r\n\t@prop()\r\n\tpublic specialInstructions?: string;\r\n}\r\n\r\nexport const LineItemModel: ReturnModelType<typeof LineItem> = getModelForClass(LineItem);\r\n"]}
@@ -1,22 +0,0 @@
1
- import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { Cart } from './cart.model';
4
- import { CoreUser } from './core-user.model';
5
- import { PaymentGateway, PaymentMethod } from '../../../utilities/enum';
6
- export declare class PaymentInformation {
7
- paymentGateway: PaymentGateway;
8
- referenceId?: string;
9
- transactionId?: string;
10
- }
11
- export declare class CartParticipant extends TimeStamps {
12
- cart: Ref<Cart>;
13
- user: Ref<CoreUser>;
14
- joinedAt: Date;
15
- isReady: boolean;
16
- isPaid: boolean;
17
- readyAt?: Date;
18
- spentAmount: number;
19
- paymentMethod?: PaymentMethod;
20
- paymentInformation?: PaymentInformation;
21
- }
22
- export declare const CartParticipantModel: ReturnModelType<typeof CartParticipant>;
@@ -1,104 +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.CartParticipantModel = exports.CartParticipant = exports.PaymentInformation = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const cart_model_1 = require("./cart.model");
16
- const core_user_model_1 = require("./core-user.model");
17
- const enum_1 = require("../../../utilities/enum");
18
- class PaymentInformation {
19
- paymentGateway;
20
- referenceId;
21
- transactionId;
22
- }
23
- exports.PaymentInformation = PaymentInformation;
24
- __decorate([
25
- (0, typegoose_1.prop)({
26
- required: true,
27
- enum: enum_1.PaymentGateway,
28
- type: String,
29
- default: enum_1.PaymentGateway.AREEBA,
30
- }),
31
- __metadata("design:type", String)
32
- ], PaymentInformation.prototype, "paymentGateway", void 0);
33
- __decorate([
34
- (0, typegoose_1.prop)(),
35
- __metadata("design:type", String)
36
- ], PaymentInformation.prototype, "referenceId", void 0);
37
- __decorate([
38
- (0, typegoose_1.prop)(),
39
- __metadata("design:type", String)
40
- ], PaymentInformation.prototype, "transactionId", void 0);
41
- let CartParticipant = class CartParticipant extends defaultClasses_1.TimeStamps {
42
- cart;
43
- user;
44
- joinedAt;
45
- isReady;
46
- isPaid;
47
- readyAt;
48
- spentAmount;
49
- paymentMethod;
50
- paymentInformation;
51
- };
52
- exports.CartParticipant = CartParticipant;
53
- __decorate([
54
- (0, typegoose_1.prop)({ required: true, ref: () => cart_model_1.Cart }),
55
- __metadata("design:type", Object)
56
- ], CartParticipant.prototype, "cart", void 0);
57
- __decorate([
58
- (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
59
- __metadata("design:type", Object)
60
- ], CartParticipant.prototype, "user", void 0);
61
- __decorate([
62
- (0, typegoose_1.prop)({ default: () => new Date() }),
63
- __metadata("design:type", Date)
64
- ], CartParticipant.prototype, "joinedAt", void 0);
65
- __decorate([
66
- (0, typegoose_1.prop)({ default: false }),
67
- __metadata("design:type", Boolean)
68
- ], CartParticipant.prototype, "isReady", void 0);
69
- __decorate([
70
- (0, typegoose_1.prop)({ default: false }),
71
- __metadata("design:type", Boolean)
72
- ], CartParticipant.prototype, "isPaid", void 0);
73
- __decorate([
74
- (0, typegoose_1.prop)(),
75
- __metadata("design:type", Date)
76
- ], CartParticipant.prototype, "readyAt", void 0);
77
- __decorate([
78
- (0, typegoose_1.prop)({ default: 0 }),
79
- __metadata("design:type", Number)
80
- ], CartParticipant.prototype, "spentAmount", void 0);
81
- __decorate([
82
- (0, typegoose_1.prop)({ enum: enum_1.PaymentMethod, type: String }),
83
- __metadata("design:type", String)
84
- ], CartParticipant.prototype, "paymentMethod", void 0);
85
- __decorate([
86
- (0, typegoose_1.prop)({ type: () => PaymentInformation }),
87
- __metadata("design:type", PaymentInformation)
88
- ], CartParticipant.prototype, "paymentInformation", void 0);
89
- exports.CartParticipant = CartParticipant = __decorate([
90
- (0, typegoose_1.modelOptions)({
91
- schemaOptions: {
92
- collection: 'cartParticipants',
93
- toJSON: { virtuals: true },
94
- toObject: { virtuals: true },
95
- },
96
- options: {
97
- allowMixed: typegoose_1.Severity.ALLOW,
98
- },
99
- }),
100
- (0, typegoose_1.index)({ cart: 1, user: 1 }, { unique: true }),
101
- (0, typegoose_1.index)({ cart: 1 })
102
- ], CartParticipant);
103
- exports.CartParticipantModel = (0, typegoose_1.getModelForClass)(CartParticipant);
104
- //# sourceMappingURL=cart-perticipant.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cart-perticipant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart-perticipant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B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ADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oDACO;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,oBAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACP;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC;8BACb,kBAAkB;2DAAC;0BA1BnC,eAAe;IAZ3B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,kBAAkB;YAC9B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;GACN,eAAe,CA2B3B;AAEY,QAAA,oBAAoB,GAChC,IAAA,4BAAgB,EAAC,eAAe,CAAC,CAAC","sourcesContent":["import {\r\n\tprop,\r\n\tgetModelForClass,\r\n\tRef,\r\n\tindex,\r\n\tmodelOptions,\r\n\tSeverity,\r\n\tReturnModelType,\r\n} from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Cart } from './cart.model';\r\nimport { CoreUser } from './core-user.model';\r\nimport { PaymentGateway, PaymentMethod } from '../../../utilities/enum';\r\n\r\nexport class PaymentInformation {\r\n\t@prop({\r\n\t\trequired: true,\r\n\t\tenum: PaymentGateway,\r\n\t\ttype: String,\r\n\t\tdefault: PaymentGateway.AREEBA,\r\n\t})\r\n\tpublic paymentGateway!: PaymentGateway;\r\n\r\n\t@prop()\r\n\tpublic referenceId?: string;\r\n\r\n\t@prop()\r\n\tpublic transactionId?: string;\r\n}\r\n\r\n/**\r\n * CartParticipant model - Tracks users participating in a group cart\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'cartParticipants',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ cart: 1, user: 1 }, { unique: true })\r\n@index({ cart: 1 })\r\nexport class CartParticipant extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Cart })\r\n\tpublic cart!: Ref<Cart>;\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ default: () => new Date() })\r\n\tpublic joinedAt!: Date;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isReady!: boolean;\r\n\r\n\t@prop({ default: false })\r\n\tpublic isPaid!: boolean;\r\n\r\n\t@prop()\r\n\tpublic readyAt?: Date;\r\n\r\n\t@prop({ default: 0 })\r\n\tpublic spentAmount!: number;\r\n\r\n\t@prop({ enum: PaymentMethod, type: String })\r\n\tpublic paymentMethod?: PaymentMethod;\r\n\r\n\t@prop({ type: () => PaymentInformation })\r\n\tpublic paymentInformation?: PaymentInformation;\r\n}\r\n\r\nexport const CartParticipantModel: ReturnModelType<typeof CartParticipant> =\r\n\tgetModelForClass(CartParticipant);\r\n"]}
@@ -1,8 +0,0 @@
1
- import { Ref } from '@typegoose/typegoose';
2
- import { Attribute } from '../attribute.model';
3
- import { AttributeItem } from '../embedded/attribute-item.model';
4
- export declare class AddOn {
5
- attribute: Ref<Attribute>;
6
- attributeItem: AttributeItem;
7
- price: number;
8
- }
@@ -1,34 +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.AddOn = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const attribute_model_1 = require("../attribute.model");
15
- const attribute_item_model_1 = require("../embedded/attribute-item.model");
16
- class AddOn {
17
- attribute;
18
- attributeItem;
19
- price;
20
- }
21
- exports.AddOn = AddOn;
22
- __decorate([
23
- (0, typegoose_1.prop)({ required: true, ref: () => attribute_model_1.Attribute }),
24
- __metadata("design:type", Object)
25
- ], AddOn.prototype, "attribute", void 0);
26
- __decorate([
27
- (0, typegoose_1.prop)({ required: true }),
28
- __metadata("design:type", attribute_item_model_1.AttributeItem)
29
- ], AddOn.prototype, "attributeItem", void 0);
30
- __decorate([
31
- (0, typegoose_1.prop)({ required: true, default: 0 }),
32
- __metadata("design:type", Number)
33
- ], AddOn.prototype, "price", void 0);
34
- //# sourceMappingURL=addon.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/addon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,wDAA+C;AAC/C,2EAAiE;AAEjE,MAAa,KAAK;IAEV,SAAS,CAAkB;IAG3B,aAAa,CAAiB;IAG9B,KAAK,CAAU;CACtB;AATD,sBASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;wCACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACF,oCAAa;4CAAC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oCACf","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\r\nimport { Attribute } from '../attribute.model';\r\nimport { AttributeItem } from '../embedded/attribute-item.model';\r\n\r\nexport class AddOn {\r\n\t@prop({ required: true, ref: () => Attribute })\r\n\tpublic attribute!: Ref<Attribute>;\r\n\r\n\t@prop({ required: true })\r\n\tpublic attributeItem!: AttributeItem;\r\n\r\n\t@prop({ required: true, default: 0 })\r\n\tpublic price!: number;\r\n}\r\n"]}
@@ -1,9 +0,0 @@
1
- import { Ref } from '@typegoose/typegoose';
2
- import { Transaction } from '../transaction.model';
3
- export declare class PaymentDetails {
4
- method: string;
5
- status: string;
6
- transaction?: Ref<Transaction>;
7
- paymentReference?: string;
8
- receiptUrl?: string;
9
- }
@@ -1,52 +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.PaymentDetails = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const transaction_model_1 = require("../transaction.model");
15
- const enum_1 = require("../../../../utilities/enum");
16
- class PaymentDetails {
17
- method;
18
- status;
19
- transaction;
20
- paymentReference;
21
- receiptUrl;
22
- }
23
- exports.PaymentDetails = PaymentDetails;
24
- __decorate([
25
- (0, typegoose_1.prop)({
26
- type: String,
27
- enum: enum_1.PaymentMethod,
28
- required: true,
29
- }),
30
- __metadata("design:type", String)
31
- ], PaymentDetails.prototype, "method", void 0);
32
- __decorate([
33
- (0, typegoose_1.prop)({
34
- type: String,
35
- enum: Object.values(enum_1.PaymentStatus),
36
- default: enum_1.PaymentStatus.PENDING,
37
- }),
38
- __metadata("design:type", String)
39
- ], PaymentDetails.prototype, "status", void 0);
40
- __decorate([
41
- (0, typegoose_1.prop)({ ref: () => transaction_model_1.Transaction }),
42
- __metadata("design:type", Object)
43
- ], PaymentDetails.prototype, "transaction", void 0);
44
- __decorate([
45
- (0, typegoose_1.prop)(),
46
- __metadata("design:type", String)
47
- ], PaymentDetails.prototype, "paymentReference", void 0);
48
- __decorate([
49
- (0, typegoose_1.prop)(),
50
- __metadata("design:type", String)
51
- ], PaymentDetails.prototype, "receiptUrl", void 0);
52
- //# sourceMappingURL=payment-details.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payment-details.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/payment-details.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,4DAAmD;AACnD,qDAA0E;AAE1E,MAAa,cAAc;IAM1B,MAAM,CAAS;IAOf,MAAM,CAAS;IAGf,WAAW,CAAoB;IAG/B,gBAAgB,CAAU;IAG1B,UAAU,CAAU;CACpB;AAvBD,wCAuBC;AAjBA;IALC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,oBAAa;QACnB,QAAQ,EAAE,IAAI;KACd,CAAC;;8CACa;AAOf;IALC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAa,CAAC;QAClC,OAAO,EAAE,oBAAa,CAAC,OAAO;KAC9B,CAAC;;8CACa;AAGf;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,+BAAW,EAAE,CAAC;;mDACF;AAG/B;IADC,IAAA,gBAAI,GAAE;;wDACmB;AAG1B;IADC,IAAA,gBAAI,GAAE;;kDACa","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\r\nimport { Transaction } from '../transaction.model';\r\nimport { PaymentMethod, PaymentStatus } from '../../../../utilities/enum';\r\n\r\nexport class PaymentDetails {\r\n\t@prop({\r\n\t\ttype: String,\r\n\t\tenum: PaymentMethod,\r\n\t\trequired: true,\r\n\t})\r\n\tmethod: string;\r\n\r\n\t@prop({\r\n\t\ttype: String,\r\n\t\tenum: Object.values(PaymentStatus),\r\n\t\tdefault: PaymentStatus.PENDING,\r\n\t})\r\n\tstatus: string;\r\n\r\n\t@prop({ ref: () => Transaction })\r\n\ttransaction?: Ref<Transaction>;\r\n\r\n\t@prop()\r\n\tpaymentReference?: string;\r\n\r\n\t@prop()\r\n\treceiptUrl?: string;\r\n}\r\n"]}
@@ -1,5 +0,0 @@
1
- export declare class Portion {
2
- price: number;
3
- size?: string;
4
- unit?: string;
5
- }
@@ -1,32 +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.Portion = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- class Portion {
15
- price;
16
- size;
17
- unit;
18
- }
19
- exports.Portion = Portion;
20
- __decorate([
21
- (0, typegoose_1.prop)({ required: true }),
22
- __metadata("design:type", Number)
23
- ], Portion.prototype, "price", void 0);
24
- __decorate([
25
- (0, typegoose_1.prop)(),
26
- __metadata("design:type", String)
27
- ], Portion.prototype, "size", void 0);
28
- __decorate([
29
- (0, typegoose_1.prop)(),
30
- __metadata("design:type", String)
31
- ], Portion.prototype, "unit", void 0);
32
- //# sourceMappingURL=portion.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"portion.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/portion.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,OAAO;IAEZ,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,IAAI,CAAU;CACrB;AATD,0BASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCACH;AAGf;IADN,IAAA,gBAAI,GAAE;;qCACc;AAGd;IADN,IAAA,gBAAI,GAAE;;qCACc","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class Portion {\r\n\t@prop({ required: true })\r\n\tpublic price!: number;\r\n\r\n\t@prop()\r\n\tpublic size?: string;\r\n\r\n\t@prop()\r\n\tpublic unit?: string;\r\n}\r\n"]}
@@ -1,5 +0,0 @@
1
- export declare class Price {
2
- unit?: string;
3
- unitValue?: number;
4
- price: number;
5
- }
@@ -1,32 +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.Price = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- class Price {
15
- unit;
16
- unitValue;
17
- price;
18
- }
19
- exports.Price = Price;
20
- __decorate([
21
- (0, typegoose_1.prop)({ type: String }),
22
- __metadata("design:type", String)
23
- ], Price.prototype, "unit", void 0);
24
- __decorate([
25
- (0, typegoose_1.prop)({ type: Number, min: 0 }),
26
- __metadata("design:type", Number)
27
- ], Price.prototype, "unitValue", void 0);
28
- __decorate([
29
- (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
30
- __metadata("design:type", Number)
31
- ], Price.prototype, "price", void 0);
32
- //# sourceMappingURL=price.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"price.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/price.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,KAAK;IAEV,IAAI,CAAU;IAGd,SAAS,CAAU;IAGnB,KAAK,CAAU;CACtB;AATD,sBASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mCACF;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;wCACL;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;oCACzB","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class Price {\n\t@prop({ type: String })\n\tpublic unit?: string;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic unitValue?: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n}\n"]}
@@ -1,18 +0,0 @@
1
- import { Ref } from "@typegoose/typegoose";
2
- import { Coupon } from "./coupon.model";
3
- export declare class OrderPricing {
4
- subtotal: number;
5
- secondarySubtotal: number;
6
- deliveryFee: number;
7
- secondaryDeliveryFee: number;
8
- vat: number;
9
- secondaryVat: number;
10
- appliedCoupon?: Ref<Coupon>;
11
- appliedCouponSnapshot?: Record<string, any>;
12
- discountValue: number;
13
- secondaryDiscountValue: number;
14
- serviceCharge: number;
15
- secondaryServiceCharge: number;
16
- total: number;
17
- secondaryTotal: number;
18
- }
@@ -1,88 +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.OrderPricing = void 0;
13
- const typegoose_1 = require("@typegoose/typegoose");
14
- const coupon_model_1 = require("./coupon.model");
15
- class OrderPricing {
16
- subtotal;
17
- secondarySubtotal;
18
- deliveryFee;
19
- secondaryDeliveryFee;
20
- vat;
21
- secondaryVat;
22
- appliedCoupon;
23
- appliedCouponSnapshot;
24
- discountValue;
25
- secondaryDiscountValue;
26
- serviceCharge;
27
- secondaryServiceCharge;
28
- total;
29
- secondaryTotal;
30
- }
31
- exports.OrderPricing = OrderPricing;
32
- __decorate([
33
- (0, typegoose_1.prop)({ required: true, default: 0 }),
34
- __metadata("design:type", Number)
35
- ], OrderPricing.prototype, "subtotal", void 0);
36
- __decorate([
37
- (0, typegoose_1.prop)({ default: 0 }),
38
- __metadata("design:type", Number)
39
- ], OrderPricing.prototype, "secondarySubtotal", void 0);
40
- __decorate([
41
- (0, typegoose_1.prop)({ default: 0 }),
42
- __metadata("design:type", Number)
43
- ], OrderPricing.prototype, "deliveryFee", void 0);
44
- __decorate([
45
- (0, typegoose_1.prop)({ default: 0 }),
46
- __metadata("design:type", Number)
47
- ], OrderPricing.prototype, "secondaryDeliveryFee", void 0);
48
- __decorate([
49
- (0, typegoose_1.prop)({ default: 0 }),
50
- __metadata("design:type", Number)
51
- ], OrderPricing.prototype, "vat", void 0);
52
- __decorate([
53
- (0, typegoose_1.prop)({ default: 0 }),
54
- __metadata("design:type", Number)
55
- ], OrderPricing.prototype, "secondaryVat", void 0);
56
- __decorate([
57
- (0, typegoose_1.prop)({ ref: () => coupon_model_1.Coupon }),
58
- __metadata("design:type", Object)
59
- ], OrderPricing.prototype, "appliedCoupon", void 0);
60
- __decorate([
61
- (0, typegoose_1.prop)({ type: () => Object, default: {} }),
62
- __metadata("design:type", Object)
63
- ], OrderPricing.prototype, "appliedCouponSnapshot", void 0);
64
- __decorate([
65
- (0, typegoose_1.prop)({ default: 0 }),
66
- __metadata("design:type", Number)
67
- ], OrderPricing.prototype, "discountValue", void 0);
68
- __decorate([
69
- (0, typegoose_1.prop)({ default: 0 }),
70
- __metadata("design:type", Number)
71
- ], OrderPricing.prototype, "secondaryDiscountValue", void 0);
72
- __decorate([
73
- (0, typegoose_1.prop)({ default: 0 }),
74
- __metadata("design:type", Number)
75
- ], OrderPricing.prototype, "serviceCharge", void 0);
76
- __decorate([
77
- (0, typegoose_1.prop)({ default: 0 }),
78
- __metadata("design:type", Number)
79
- ], OrderPricing.prototype, "secondaryServiceCharge", void 0);
80
- __decorate([
81
- (0, typegoose_1.prop)({ required: true, default: 0 }),
82
- __metadata("design:type", Number)
83
- ], OrderPricing.prototype, "total", void 0);
84
- __decorate([
85
- (0, typegoose_1.prop)({ default: 0 }),
86
- __metadata("design:type", Number)
87
- ], OrderPricing.prototype, "secondaryTotal", void 0);
88
- //# sourceMappingURL=order-pricing.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"order-pricing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-pricing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,iDAAwC;AAExC,MAAa,YAAY;IAExB,QAAQ,CAAS;IAGjB,iBAAiB,CAAS;IAG1B,WAAW,CAAS;IAGpB,oBAAoB,CAAS;IAG7B,GAAG,CAAS;IAGZ,YAAY,CAAS;IAGrB,aAAa,CAAe;IAM5B,qBAAqB,CAAuB;IAG5C,aAAa,CAAS;IAGtB,sBAAsB,CAAS;IAG/B,aAAa,CAAS;IAGtB,sBAAsB,CAAS;IAG/B,KAAK,CAAS;IAGd,cAAc,CAAS;CACvB;AA7CD,oCA6CC;AA3CA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACpB;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACK;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iDACD;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0DACQ;AAG7B;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yCACT;AAGZ;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACA;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;mDACA;AAM5B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2DACE;AAG5C;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDACC;AAGtB;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACU;AAG/B;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDACC;AAGtB;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACU;AAG/B;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;2CACvB;AAGd;IADC,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oDACE","sourcesContent":["import { prop, Ref } from \"@typegoose/typegoose\";\r\nimport { Coupon } from \"./coupon.model\";\r\n\r\nexport class OrderPricing {\r\n\t@prop({ required: true, default: 0 })\r\n\tsubtotal: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tsecondarySubtotal: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tdeliveryFee: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tsecondaryDeliveryFee: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tvat: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tsecondaryVat: number;\r\n\r\n\t@prop({ ref: () => Coupon })\r\n\tappliedCoupon?: Ref<Coupon>;\r\n\r\n\t// Optional snapshot of the line items at time of order\r\n\t// This is useful if we need to reference order contents directly\r\n\t// without requiring a cart lookup, and protects against cart modifications\r\n\t@prop({ type: () => Object, default: {} })\r\n\tappliedCouponSnapshot?: Record<string, any>;\r\n\r\n\t@prop({ default: 0 })\r\n\tdiscountValue: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tsecondaryDiscountValue: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tserviceCharge: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tsecondaryServiceCharge: number;\r\n\r\n\t@prop({ required: true, default: 0 })\r\n\ttotal: number;\r\n\r\n\t@prop({ default: 0 })\r\n\tsecondaryTotal: number;\r\n}"]}
@@ -1,25 +0,0 @@
1
- import { Ref } from '@typegoose/typegoose';
2
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { PriceOption, Status } from '../../../utilities/enum';
4
- import { AttributeMap } from './embedded/attribute-map.model';
5
- import { PriceBreakdown } from './embedded/price-breakdown.model';
6
- import { Product } from './product.model';
7
- import { ShopCategory } from './shop-category.model';
8
- import { Shop } from './shop.model';
9
- export declare class ShopProduct extends TimeStamps {
10
- product: Ref<Product>;
11
- shop: Ref<Shop>;
12
- priceOption?: PriceOption;
13
- priceBreakdowns?: PriceBreakdown[];
14
- description?: string;
15
- attributeMaps?: AttributeMap[];
16
- addons?: Ref<ShopProduct>[];
17
- status?: Status;
18
- shopCategory: Ref<ShopCategory>;
19
- sortingOrder?: number;
20
- isStockEnabled?: boolean;
21
- stockQuantity?: number;
22
- note?: string;
23
- isDrinkIncluded?: boolean;
24
- orderQuantityLimit?: number;
25
- }
@@ -1,102 +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.ShopProduct = 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 attribute_map_model_1 = require("./embedded/attribute-map.model");
17
- const price_breakdown_model_1 = require("./embedded/price-breakdown.model");
18
- const product_model_1 = require("./product.model");
19
- const shop_category_model_1 = require("./shop-category.model");
20
- const shop_model_1 = require("./shop.model");
21
- let ShopProduct = class ShopProduct extends defaultClasses_1.TimeStamps {
22
- product;
23
- shop;
24
- priceOption;
25
- priceBreakdowns;
26
- description;
27
- attributeMaps;
28
- addons;
29
- status;
30
- shopCategory;
31
- sortingOrder;
32
- isStockEnabled;
33
- stockQuantity;
34
- note;
35
- isDrinkIncluded;
36
- orderQuantityLimit;
37
- };
38
- exports.ShopProduct = ShopProduct;
39
- __decorate([
40
- (0, typegoose_1.prop)({ required: true, ref: () => product_model_1.Product }),
41
- __metadata("design:type", Object)
42
- ], ShopProduct.prototype, "product", void 0);
43
- __decorate([
44
- (0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop }),
45
- __metadata("design:type", Object)
46
- ], ShopProduct.prototype, "shop", void 0);
47
- __decorate([
48
- (0, typegoose_1.prop)({ type: String, enum: enum_1.PriceOption, default: enum_1.PriceOption.SINGLE_PRICE }),
49
- __metadata("design:type", String)
50
- ], ShopProduct.prototype, "priceOption", void 0);
51
- __decorate([
52
- (0, typegoose_1.prop)({ required: true, type: [price_breakdown_model_1.PriceBreakdown], min: 1 }),
53
- __metadata("design:type", Array)
54
- ], ShopProduct.prototype, "priceBreakdowns", void 0);
55
- __decorate([
56
- (0, typegoose_1.prop)({ type: String }),
57
- __metadata("design:type", String)
58
- ], ShopProduct.prototype, "description", void 0);
59
- __decorate([
60
- (0, typegoose_1.prop)({ type: [attribute_map_model_1.AttributeMap], default: [] }),
61
- __metadata("design:type", Array)
62
- ], ShopProduct.prototype, "attributeMaps", void 0);
63
- __decorate([
64
- (0, typegoose_1.prop)({ ref: () => ShopProduct, default: [] }),
65
- __metadata("design:type", Array)
66
- ], ShopProduct.prototype, "addons", void 0);
67
- __decorate([
68
- (0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
69
- __metadata("design:type", String)
70
- ], ShopProduct.prototype, "status", void 0);
71
- __decorate([
72
- (0, typegoose_1.prop)({ required: true, ref: () => shop_category_model_1.ShopCategory }),
73
- __metadata("design:type", Object)
74
- ], ShopProduct.prototype, "shopCategory", void 0);
75
- __decorate([
76
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
77
- __metadata("design:type", Number)
78
- ], ShopProduct.prototype, "sortingOrder", void 0);
79
- __decorate([
80
- (0, typegoose_1.prop)({ type: Boolean, default: false }),
81
- __metadata("design:type", Boolean)
82
- ], ShopProduct.prototype, "isStockEnabled", void 0);
83
- __decorate([
84
- (0, typegoose_1.prop)({ type: Number }),
85
- __metadata("design:type", Number)
86
- ], ShopProduct.prototype, "stockQuantity", void 0);
87
- __decorate([
88
- (0, typegoose_1.prop)({ type: String }),
89
- __metadata("design:type", String)
90
- ], ShopProduct.prototype, "note", void 0);
91
- __decorate([
92
- (0, typegoose_1.prop)({ type: Boolean, default: false }),
93
- __metadata("design:type", Boolean)
94
- ], ShopProduct.prototype, "isDrinkIncluded", void 0);
95
- __decorate([
96
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
97
- __metadata("design:type", Number)
98
- ], ShopProduct.prototype, "orderQuantityLimit", void 0);
99
- exports.ShopProduct = ShopProduct = __decorate([
100
- (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'shopProducts' } })
101
- ], ShopProduct);
102
- //# sourceMappingURL=shop-product.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shop-product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop-product.model.ts"],"names":[],"mappings":";;;;;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EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2CACX;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;2CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;;iDACV;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;mDACR;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACO;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACF;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;oDACP;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACA;sBA5CvB,WAAW;IADvB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,CAAC;GACnD,WAAW,CA6CvB","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { PriceOption, Status } from '../../../utilities/enum';\r\nimport { AttributeMap } from './embedded/attribute-map.model';\r\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\r\nimport { Product } from './product.model';\r\nimport { ShopCategory } from './shop-category.model';\r\nimport { Shop } from './shop.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'shopProducts' } })\r\nexport class ShopProduct extends TimeStamps {\r\n\t@prop({ required: true, ref: () => Product })\r\n\tpublic product!: Ref<Product>;\r\n\r\n\t@prop({ required: true, ref: () => Shop })\r\n\tpublic shop!: Ref<Shop>;\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], min: 1 })\r\n\tpublic priceBreakdowns?: PriceBreakdown[];\r\n\r\n\t@prop({ type: String })\r\n\tpublic description?: string;\r\n\r\n\t@prop({ type: [AttributeMap], default: [] })\r\n\tpublic attributeMaps?: AttributeMap[];\r\n\r\n\t@prop({ ref: () => ShopProduct, default: [] })\r\n\tpublic addons?: Ref<ShopProduct>[];\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ required: true, ref: () => ShopCategory })\r\n\tpublic shopCategory!: Ref<ShopCategory>;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic sortingOrder?: number;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isStockEnabled?: boolean;\r\n\r\n\t@prop({ type: Number })\r\n\tpublic stockQuantity?: number;\r\n\r\n\t@prop({ type: String })\r\n\tpublic note?: string;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isDrinkIncluded?: boolean;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic orderQuantityLimit?: number;\r\n}\r\n"]}