@lyxa.ai/core 1.0.13 → 1.0.15-debug

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 (118) hide show
  1. package/dist/index.js +0 -3
  2. package/dist/index.js.map +1 -1
  3. package/dist/libraries/mongo/index.js +89 -40
  4. package/dist/libraries/mongo/index.js.map +1 -1
  5. package/dist/libraries/mongo/models/admin.model.d.ts +5 -3
  6. package/dist/libraries/mongo/models/admin.model.js +23 -6
  7. package/dist/libraries/mongo/models/admin.model.js.map +1 -1
  8. package/dist/libraries/mongo/models/base/base-review.model.d.ts +2 -2
  9. package/dist/libraries/mongo/models/base/base-review.model.js +2 -2
  10. package/dist/libraries/mongo/models/base/base-review.model.js.map +1 -1
  11. package/dist/libraries/mongo/models/core-auth-identity.model.d.ts +8 -0
  12. package/dist/libraries/mongo/models/{auth-identity.model.js → core-auth-identity.model.js} +13 -12
  13. package/dist/libraries/mongo/models/core-auth-identity.model.js.map +1 -0
  14. package/dist/libraries/mongo/models/{user.model.d.ts → core-user.model.d.ts} +2 -2
  15. package/dist/libraries/mongo/models/{user.model.js → core-user.model.js} +18 -17
  16. package/dist/libraries/mongo/models/core-user.model.js.map +1 -0
  17. package/dist/libraries/mongo/models/favourite.model.d.ts +2 -2
  18. package/dist/libraries/mongo/models/favourite.model.js +2 -2
  19. package/dist/libraries/mongo/models/favourite.model.js.map +1 -1
  20. package/dist/libraries/mongo/models/index.d.ts +66 -0
  21. package/dist/libraries/mongo/models/index.js +83 -0
  22. package/dist/libraries/mongo/models/index.js.map +1 -0
  23. package/dist/libraries/mongo/models/notification.model.d.ts +2 -2
  24. package/dist/libraries/mongo/models/notification.model.js +2 -2
  25. package/dist/libraries/mongo/models/notification.model.js.map +1 -1
  26. package/dist/libraries/mongo/models/parent.model.d.ts +3 -3
  27. package/dist/libraries/mongo/models/parent.model.js.map +1 -1
  28. package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.d.ts +6 -0
  29. package/dist/libraries/mongo/models/providers/{apple-auth-identity.model.js → core-apple-auth-identity.model.js} +8 -7
  30. package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.js.map +1 -0
  31. package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.d.ts +9 -0
  32. package/dist/libraries/mongo/models/providers/{email-auth-identity.model.js → core-email-auth-identity.model.js} +10 -9
  33. package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js.map +1 -0
  34. package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.d.ts +6 -0
  35. package/dist/libraries/mongo/models/providers/{google-auth-identity.model.js → core-google-auth-identity.model.js} +8 -7
  36. package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.js.map +1 -0
  37. package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.d.ts +8 -0
  38. package/dist/libraries/mongo/models/providers/{phone-auth-identity.model.js → core-phone-auth-identity.model.js} +9 -8
  39. package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.js.map +1 -0
  40. package/dist/libraries/mongo/models/providers/custom-coupon.model.d.ts +2 -2
  41. package/dist/libraries/mongo/models/providers/custom-coupon.model.js +2 -2
  42. package/dist/libraries/mongo/models/providers/custom-coupon.model.js.map +1 -1
  43. package/dist/libraries/mongo/models/providers/individual-user-coupon.model.d.ts +2 -2
  44. package/dist/libraries/mongo/models/providers/individual-user-coupon.model.js +2 -2
  45. package/dist/libraries/mongo/models/providers/individual-user-coupon.model.js.map +1 -1
  46. package/dist/libraries/mongo/models/providers/{referral-code-coupon.mode.d.ts → referral-code-coupon.model.d.ts} +2 -2
  47. package/dist/libraries/mongo/models/providers/{referral-code-coupon.mode.js → referral-code-coupon.model.js} +3 -3
  48. package/dist/libraries/mongo/models/providers/referral-code-coupon.model.js.map +1 -0
  49. package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.d.ts +3 -3
  50. package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js +3 -3
  51. package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js.map +1 -1
  52. package/dist/libraries/mongo/models/punch-marketing-history.model.d.ts +2 -2
  53. package/dist/libraries/mongo/models/punch-marketing-history.model.js +2 -2
  54. package/dist/libraries/mongo/models/punch-marketing-history.model.js.map +1 -1
  55. package/dist/libraries/mongo/models/request-area.model.d.ts +2 -2
  56. package/dist/libraries/mongo/models/request-area.model.js +2 -2
  57. package/dist/libraries/mongo/models/request-area.model.js.map +1 -1
  58. package/dist/libraries/mongo/models/{role.model.ts.js → role.model.js} +3 -2
  59. package/dist/libraries/mongo/models/role.model.js.map +1 -0
  60. package/dist/libraries/mongo/models/{shop-review.js → shop-review.model.js} +1 -1
  61. package/dist/libraries/mongo/models/shop-review.model.js.map +1 -0
  62. package/dist/libraries/mongo/models/shop.model.d.ts +8 -8
  63. package/dist/libraries/mongo/models/shop.model.js +10 -10
  64. package/dist/libraries/mongo/models/shop.model.js.map +1 -1
  65. package/dist/libraries/mongo/models/subscription.model.d.ts +2 -2
  66. package/dist/libraries/mongo/models/subscription.model.js +2 -2
  67. package/dist/libraries/mongo/models/subscription.model.js.map +1 -1
  68. package/dist/libraries/mongo/models/{zone.js → zone.model.js} +1 -1
  69. package/dist/libraries/mongo/models/zone.model.js.map +1 -0
  70. package/dist/libraries/mongo/plugins/soft-delete-plugin.d.ts +10 -9
  71. package/dist/libraries/mongo/plugins/soft-delete-plugin.js +17 -17
  72. package/dist/libraries/mongo/plugins/soft-delete-plugin.js.map +1 -1
  73. package/dist/libraries/trpc/middlewares/cors.d.ts +12 -0
  74. package/dist/libraries/trpc/middlewares/cors.js +46 -0
  75. package/dist/libraries/trpc/middlewares/cors.js.map +1 -0
  76. package/dist/utilities/enum.d.ts +1 -1
  77. package/dist/utilities/enum.js +8 -8
  78. package/dist/utilities/enum.js.map +1 -1
  79. package/dist/utilities/error-middleware.d.ts +11 -0
  80. package/dist/utilities/error-middleware.js +177 -0
  81. package/dist/utilities/error-middleware.js.map +1 -0
  82. package/dist/utilities/validation/common-validation.d.ts +22 -2
  83. package/dist/utilities/validation/common-validation.js +41 -41
  84. package/dist/utilities/validation/common-validation.js.map +1 -1
  85. package/dist/utilities/validation/global-validation.d.ts +29 -6
  86. package/dist/utilities/validation/global-validation.js +64 -52
  87. package/dist/utilities/validation/global-validation.js.map +1 -1
  88. package/package.json +2 -2
  89. package/dist/libraries/mongo/models/auth-identity.model.d.ts +0 -8
  90. package/dist/libraries/mongo/models/auth-identity.model.js.map +0 -1
  91. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +0 -6
  92. package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +0 -1
  93. package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +0 -9
  94. package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +0 -1
  95. package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +0 -6
  96. package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +0 -1
  97. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +0 -8
  98. package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +0 -1
  99. package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +0 -1
  100. package/dist/libraries/mongo/models/request-area.model copy.d.ts +0 -9
  101. package/dist/libraries/mongo/models/request-area.model copy.js +0 -34
  102. package/dist/libraries/mongo/models/request-area.model copy.js.map +0 -1
  103. package/dist/libraries/mongo/models/rider-review.d.ts +0 -7
  104. package/dist/libraries/mongo/models/rider-review.js +0 -28
  105. package/dist/libraries/mongo/models/rider-review.js.map +0 -1
  106. package/dist/libraries/mongo/models/role.model.ts.js.map +0 -1
  107. package/dist/libraries/mongo/models/shop-review.js.map +0 -1
  108. package/dist/libraries/mongo/models/user.model.js.map +0 -1
  109. package/dist/libraries/mongo/models/zone.js.map +0 -1
  110. package/dist/libraries/mongo/models/zone.model..d.ts +0 -15
  111. package/dist/libraries/mongo/models/zone.model..js +0 -64
  112. package/dist/libraries/mongo/models/zone.model..js.map +0 -1
  113. package/dist/utilities/validation.d.ts +0 -25
  114. package/dist/utilities/validation.js +0 -44
  115. package/dist/utilities/validation.js.map +0 -1
  116. /package/dist/libraries/mongo/models/{role.model.ts.d.ts → role.model.d.ts} +0 -0
  117. /package/dist/libraries/mongo/models/{shop-review.d.ts → shop-review.model.d.ts} +0 -0
  118. /package/dist/libraries/mongo/models/{zone.d.ts → zone.model.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"referral-code-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-code-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiG;AACjG,qDAAwD;AACxD,wDAA8C;AAC9C,kDAAsD;AAEtD,MAAa,kBAAmB,SAAQ,qBAAM;IACtC,UAAU,GAAG,iBAAU,CAAC,aAAsB,CAAC;IAE/C,iBAAiB,GAAG,CAAU,CAAC;IAG/B,YAAY,CAAiB;CACpC;AAPD,gDAOC;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;wDACV;AAGxB,QAAA,uBAAuB,GACnC,IAAA,yCAA6B,EAAC,0BAAW,EAAE,kBAAkB,EAAE,iBAAU,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import { getDiscriminatorModelForClass, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { CouponType } from '../../../../utilities/enum';\r\nimport { CoreUser } from '../core-user.model';\r\nimport { Coupon, CouponModel } from '../coupon.model';\r\n\r\nexport class ReferralCodeCoupon extends Coupon {\r\n\tpublic couponType = CouponType.REFERRAL_CODE as const;\r\n\r\n\tpublic orderLimitPerUser = 1 as const;\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic referralUser!: Ref<CoreUser>;\r\n}\r\n\r\nexport const ReferralCodeCouponModel: ReturnModelType<typeof ReferralCodeCoupon> =\r\n\tgetDiscriminatorModelForClass(CouponModel, ReferralCodeCoupon, CouponType.REFERRAL_CODE);\r\n"]}
@@ -1,12 +1,12 @@
1
1
  import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
2
  import { CouponType } from '../../../../utilities/enum';
3
3
  import { BaseCoupon } from '../base/base-coupon.model';
4
- import { User } from '../user.model';
4
+ import { CoreUser } from '../core-user.model';
5
5
  import { Order } from '../order.model';
6
6
  export declare class ReferralRewardCoupon extends BaseCoupon {
7
7
  couponType: CouponType.REFERRAL_REWARD;
8
- users: Ref<User>[];
9
- referralCodeUsedBy: Ref<User>;
8
+ users: Ref<CoreUser>[];
9
+ referralCodeUsedBy: Ref<CoreUser>;
10
10
  referralCodeUsedOnOrder: Ref<Order>;
11
11
  }
12
12
  export declare const ReferralRewardCouponModel: ReturnModelType<typeof ReferralRewardCoupon>;
@@ -13,7 +13,7 @@ exports.ReferralRewardCouponModel = exports.ReferralRewardCoupon = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const enum_1 = require("../../../../utilities/enum");
15
15
  const base_coupon_model_1 = require("../base/base-coupon.model");
16
- const user_model_1 = require("../user.model");
16
+ const core_user_model_1 = require("../core-user.model");
17
17
  const order_model_1 = require("../order.model");
18
18
  const coupon_model_1 = require("../coupon.model");
19
19
  class ReferralRewardCoupon extends base_coupon_model_1.BaseCoupon {
@@ -24,11 +24,11 @@ class ReferralRewardCoupon extends base_coupon_model_1.BaseCoupon {
24
24
  }
25
25
  exports.ReferralRewardCoupon = ReferralRewardCoupon;
26
26
  __decorate([
27
- (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
27
+ (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
28
28
  __metadata("design:type", Array)
29
29
  ], ReferralRewardCoupon.prototype, "users", void 0);
30
30
  __decorate([
31
- (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
31
+ (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
32
32
  __metadata("design:type", Object)
33
33
  ], ReferralRewardCoupon.prototype, "referralCodeUsedBy", void 0);
34
34
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"referral-reward-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-reward-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiG;AACjG,qDAAwD;AACxD,iEAAuD;AACvD,8CAAqC;AACrC,gDAAuC;AACvC,kDAA8C;AAE9C,MAAa,oBAAqB,SAAQ,8BAAU;IAC5C,UAAU,GAAG,iBAAU,CAAC,eAAwB,CAAC;IAGjD,KAAK,CAAe;IAGpB,kBAAkB,CAAa;IAG/B,uBAAuB,CAAc;CAC5C;AAXD,oDAWC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mDACf;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;gEACJ;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;qEACC;AAGhC,QAAA,yBAAyB,GACrC,IAAA,yCAA6B,EAAC,0BAAW,EAAE,oBAAoB,EAAE,iBAAU,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { getDiscriminatorModelForClass, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { CouponType } from '../../../../utilities/enum';\r\nimport { BaseCoupon } from '../base/base-coupon.model';\r\nimport { User } from '../user.model';\r\nimport { Order } from '../order.model';\r\nimport { CouponModel } from '../coupon.model';\r\n\r\nexport class ReferralRewardCoupon extends BaseCoupon {\r\n\tpublic couponType = CouponType.REFERRAL_REWARD as const;\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic users!: Ref<User>[];\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic referralCodeUsedBy!: Ref<User>;\r\n\r\n\t@prop({ required: true, ref: () => Order })\r\n\tpublic referralCodeUsedOnOrder!: Ref<Order>;\r\n}\r\n\r\nexport const ReferralRewardCouponModel: ReturnModelType<typeof ReferralRewardCoupon> =\r\n\tgetDiscriminatorModelForClass(CouponModel, ReferralRewardCoupon, CouponType.REFERRAL_REWARD);\r\n"]}
1
+ {"version":3,"file":"referral-reward-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-reward-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiG;AACjG,qDAAwD;AACxD,iEAAuD;AACvD,wDAA8C;AAC9C,gDAAuC;AACvC,kDAA8C;AAE9C,MAAa,oBAAqB,SAAQ,8BAAU;IAC5C,UAAU,GAAG,iBAAU,CAAC,eAAwB,CAAC;IAGjD,KAAK,CAAmB;IAGxB,kBAAkB,CAAiB;IAGnC,uBAAuB,CAAc;CAC5C;AAXD,oDAWC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;mDACf;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;gEACJ;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;qEACC;AAGhC,QAAA,yBAAyB,GACrC,IAAA,yCAA6B,EAAC,0BAAW,EAAE,oBAAoB,EAAE,iBAAU,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { getDiscriminatorModelForClass, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { CouponType } from '../../../../utilities/enum';\r\nimport { BaseCoupon } from '../base/base-coupon.model';\r\nimport { CoreUser } from '../core-user.model';\r\nimport { Order } from '../order.model';\r\nimport { CouponModel } from '../coupon.model';\r\n\r\nexport class ReferralRewardCoupon extends BaseCoupon {\r\n\tpublic couponType = CouponType.REFERRAL_REWARD as const;\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic users!: Ref<CoreUser>[];\r\n\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic referralCodeUsedBy!: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, ref: () => Order })\r\n\tpublic referralCodeUsedOnOrder!: Ref<Order>;\r\n}\r\n\r\nexport const ReferralRewardCouponModel: ReturnModelType<typeof ReferralRewardCoupon> =\r\n\tgetDiscriminatorModelForClass(CouponModel, ReferralRewardCoupon, CouponType.REFERRAL_REWARD);\r\n"]}
@@ -1,9 +1,9 @@
1
1
  import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { User } from './user.model';
3
+ import { CoreUser } from './core-user.model';
4
4
  import { PunchMarketing } from './providers/punch-marketing.model';
5
5
  export declare class PunchMarketingHistory extends TimeStamps {
6
- user: Ref<User>;
6
+ user: Ref<CoreUser>;
7
7
  marketing: Ref<PunchMarketing>;
8
8
  completedOrders?: number;
9
9
  expiredAt?: Date;
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PunchMarketingHistoryModel = exports.PunchMarketingHistory = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const user_model_1 = require("./user.model");
15
+ const core_user_model_1 = require("./core-user.model");
16
16
  const punch_marketing_model_1 = require("./providers/punch-marketing.model");
17
17
  let PunchMarketingHistory = class PunchMarketingHistory extends defaultClasses_1.TimeStamps {
18
18
  user;
@@ -22,7 +22,7 @@ let PunchMarketingHistory = class PunchMarketingHistory extends defaultClasses_1
22
22
  };
23
23
  exports.PunchMarketingHistory = PunchMarketingHistory;
24
24
  __decorate([
25
- (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
25
+ (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
26
26
  __metadata("design:type", Object)
27
27
  ], PunchMarketingHistory.prototype, "user", void 0);
28
28
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"punch-marketing-history.model.js","sourceRoot":"/","sources":["libraries/mongo/models/punch-marketing-history.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,6CAAoC;AACpC,6EAAmE;AAG5D,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2BAAU;IAE7C,IAAI,CAAa;IAGjB,SAAS,CAAuB;IAGhC,eAAe,CAAU;IAGzB,SAAS,CAAQ;CACxB,CAAA;AAZY,sDAAqB;AAE1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mDAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,CAAC;;wDACb;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACF,IAAI;wDAAC;gCAXZ,qBAAqB;IADjC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,yBAAyB,EAAE,EAAE,CAAC;GAC9D,qBAAqB,CAYjC;AAEY,QAAA,0BAA0B,GACtC,IAAA,4BAAgB,EAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { User } from './user.model';\r\nimport { PunchMarketing } from './providers/punch-marketing.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'punchMarketingHistories' } })\r\nexport class PunchMarketingHistory extends TimeStamps {\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ required: true, ref: () => PunchMarketing })\r\n\tpublic marketing!: Ref<PunchMarketing>;\r\n\r\n\t@prop({ type: Number, default: 1 })\r\n\tpublic completedOrders?: number;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic expiredAt?: Date;\r\n}\r\n\r\nexport const PunchMarketingHistoryModel: ReturnModelType<typeof PunchMarketingHistory> =\r\n\tgetModelForClass(PunchMarketingHistory);\r\n"]}
1
+ {"version":3,"file":"punch-marketing-history.model.js","sourceRoot":"/","sources":["libraries/mongo/models/punch-marketing-history.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,uDAA6C;AAC7C,6EAAmE;AAG5D,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2BAAU;IAE7C,IAAI,CAAiB;IAGrB,SAAS,CAAuB;IAGhC,eAAe,CAAU;IAGzB,SAAS,CAAQ;CACxB,CAAA;AAZY,sDAAqB;AAE1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;mDAClB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,CAAC;;wDACb;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACF,IAAI;wDAAC;gCAXZ,qBAAqB;IADjC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,yBAAyB,EAAE,EAAE,CAAC;GAC9D,qBAAqB,CAYjC;AAEY,QAAA,0BAA0B,GACtC,IAAA,4BAAgB,EAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CoreUser } from './core-user.model';\r\nimport { PunchMarketing } from './providers/punch-marketing.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'punchMarketingHistories' } })\r\nexport class PunchMarketingHistory extends TimeStamps {\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, ref: () => PunchMarketing })\r\n\tpublic marketing!: Ref<PunchMarketing>;\r\n\r\n\t@prop({ type: Number, default: 1 })\r\n\tpublic completedOrders?: number;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic expiredAt?: Date;\r\n}\r\n\r\nexport const PunchMarketingHistoryModel: ReturnModelType<typeof PunchMarketingHistory> =\r\n\tgetModelForClass(PunchMarketingHistory);\r\n"]}
@@ -1,9 +1,9 @@
1
1
  import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { User } from './user.model';
3
+ import { CoreUser } from './core-user.model';
4
4
  import { Address } from './shared/address.model';
5
5
  export declare class RequestArea extends TimeStamps {
6
- user?: Ref<User>;
6
+ user?: Ref<CoreUser>;
7
7
  location: Address;
8
8
  }
9
9
  export declare const RequestAreaModel: ReturnModelType<typeof RequestArea>;
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RequestAreaModel = exports.RequestArea = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const user_model_1 = require("./user.model");
15
+ const core_user_model_1 = require("./core-user.model");
16
16
  const address_model_1 = require("./shared/address.model");
17
17
  let RequestArea = class RequestArea extends defaultClasses_1.TimeStamps {
18
18
  user;
@@ -20,7 +20,7 @@ let RequestArea = class RequestArea extends defaultClasses_1.TimeStamps {
20
20
  };
21
21
  exports.RequestArea = RequestArea;
22
22
  __decorate([
23
- (0, typegoose_1.prop)({ ref: () => user_model_1.User }),
23
+ (0, typegoose_1.prop)({ ref: () => core_user_model_1.CoreUser }),
24
24
  __metadata("design:type", Object)
25
25
  ], RequestArea.prototype, "user", void 0);
26
26
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"request-area.model.js","sourceRoot":"/","sources":["libraries/mongo/models/request-area.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,6CAAoC;AACpC,0DAAiD;AAG1C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,IAAI,CAAa;IAGjB,QAAQ,CAAW;CAC1B,CAAA;AANY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;yCACF;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAO,EAAE,CAAC;8BACtB,uBAAO;6CAAC;sBALd,WAAW;IADvB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,CAAC;GACnD,WAAW,CAMvB;AAEY,QAAA,gBAAgB,GAAwC,IAAA,4BAAgB,EAAC,WAAW,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { User } from './user.model';\r\nimport { Address } from './shared/address.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'requestAreas' } })\r\nexport class RequestArea extends TimeStamps {\r\n\t@prop({ ref: () => User })\r\n\tpublic user?: Ref<User>;\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic location!: Address;\r\n}\r\n\r\nexport const RequestAreaModel: ReturnModelType<typeof RequestArea> = getModelForClass(RequestArea);\r\n"]}
1
+ {"version":3,"file":"request-area.model.js","sourceRoot":"/","sources":["libraries/mongo/models/request-area.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,uDAA6C;AAC7C,0DAAiD;AAG1C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,IAAI,CAAiB;IAGrB,QAAQ,CAAW;CAC1B,CAAA;AANY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;yCACF;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAO,EAAE,CAAC;8BACtB,uBAAO;6CAAC;sBALd,WAAW;IADvB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,CAAC;GACnD,WAAW,CAMvB;AAEY,QAAA,gBAAgB,GAAwC,IAAA,4BAAgB,EAAC,WAAW,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CoreUser } from './core-user.model';\r\nimport { Address } from './shared/address.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'requestAreas' } })\r\nexport class RequestArea extends TimeStamps {\r\n\t@prop({ ref: () => CoreUser })\r\n\tpublic user?: Ref<CoreUser>;\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic location!: Address;\r\n}\r\n\r\nexport const RequestAreaModel: ReturnModelType<typeof RequestArea> = getModelForClass(RequestArea);\r\n"]}
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RoleModel = exports.Role = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
+ const __1 = require("..");
15
16
  let Role = class Role extends defaultClasses_1.TimeStamps {
16
17
  name;
17
18
  status;
@@ -33,5 +34,5 @@ __decorate([
33
34
  exports.Role = Role = __decorate([
34
35
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'roles' } })
35
36
  ], Role);
36
- exports.RoleModel = (0, typegoose_1.getModelForClass)(Role);
37
- //# sourceMappingURL=role.model.ts.js.map
37
+ exports.RoleModel = (0, __1.createGlobalModel)(Role);
38
+ //# sourceMappingURL=role.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.model.js","sourceRoot":"/","sources":["libraries/mongo/models/role.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,0BAAuC;AAGhC,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,MAAM,CAAW;IAGjB,WAAW,CAAU;CAC5B,CAAA;AATY,oBAAI;AAET;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oCAC/B;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACK;eARhB,IAAI;IADhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;GAC5C,IAAI,CAShB;AAEY,QAAA,SAAS,GAAiC,IAAA,qBAAiB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import { modelOptions, prop, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { createGlobalModel } from '..';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'roles' } })\r\nexport class Role extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: Boolean, default: true })\r\n\tpublic status!: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic description?: string;\r\n}\r\n\r\nexport const RoleModel: ReturnModelType<typeof Role> = createGlobalModel(Role);\r\n"]}
@@ -25,4 +25,4 @@ exports.ShopReview = ShopReview = __decorate([
25
25
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'shopReviews' } })
26
26
  ], ShopReview);
27
27
  exports.ShopReviewModel = (0, typegoose_1.getModelForClass)(ShopReview);
28
- //# sourceMappingURL=shop-review.js.map
28
+ //# sourceMappingURL=shop-review.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shop-review.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop-review.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,gEAAsD;AACtD,6CAAoC;AAG7B,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAU;IAElC,IAAI,CAAa;CACxB,CAAA;AAHY,gCAAU;AAEf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;wCAClB;qBAFZ,UAAU;IADtB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,CAAC;GAClD,UAAU,CAGtB;AAEY,QAAA,eAAe,GAAuC,IAAA,4BAAgB,EAAC,UAAU,CAAC,CAAC","sourcesContent":["import { prop, getModelForClass, modelOptions, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { BaseReview } from './base/base-review.model';\r\nimport { Shop } from './shop.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'shopReviews' } })\r\nexport class ShopReview extends BaseReview {\r\n\t@prop({ required: true, ref: () => Shop })\r\n\tpublic shop!: Ref<Shop>;\r\n}\r\n\r\nexport const ShopReviewModel: ReturnModelType<typeof ShopReview> = getModelForClass(ShopReview);\r\n"]}
@@ -1,13 +1,13 @@
1
1
  import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { Parent } from './parent.model';
4
- import { ItemType } from '../../../utilities/enum';
4
+ import { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';
5
5
  import { Brand } from './brand.model';
6
6
  import { Address } from './shared/address.model';
7
7
  import { ShopDocument } from './embedded/shop-document.model';
8
8
  import { WorkHourSetting } from './shared/work-hour.model';
9
9
  import { Tag } from './tag.model';
10
- import { Zone } from './zone.model.';
10
+ import { Zone } from './zone.model';
11
11
  export declare class Shop extends TimeStamps {
12
12
  slug: string;
13
13
  parent: Ref<Parent>;
@@ -17,7 +17,7 @@ export declare class Shop extends TimeStamps {
17
17
  ownerName: string;
18
18
  email: string;
19
19
  phoneNumber: string;
20
- userPhoneNumber?: string;
20
+ userPhoneNumber: string;
21
21
  additionalPhoneNumbers?: string[];
22
22
  address: Address;
23
23
  zone: Ref<Zone>;
@@ -26,8 +26,8 @@ export declare class Shop extends TimeStamps {
26
26
  document: ShopDocument;
27
27
  isBeirutAuthentic: boolean;
28
28
  isVisibleToUser: boolean;
29
- status: string;
30
- onlineStatus?: string;
29
+ status: Status;
30
+ onlineStatus?: ShopOnlineStatus;
31
31
  allowSpecialInstructions?: boolean;
32
32
  isRiderNoteVisible?: boolean;
33
33
  riderNote?: string;
@@ -41,9 +41,9 @@ export declare class Shop extends TimeStamps {
41
41
  defaultPreparationTime?: number;
42
42
  exchangeRate?: number;
43
43
  workHourSetting?: WorkHourSetting;
44
- showFavourites?: boolean;
45
- favouritesCategoryTitle?: string;
46
- showBestSellers?: boolean;
44
+ isFavouriteCategoryVisible?: boolean;
45
+ favouriteCategoryTitle?: string;
46
+ isBestSellerCategoryVisible?: boolean;
47
47
  bestSellerCategoryTitle?: string;
48
48
  sortingOrder?: number;
49
49
  }
@@ -19,7 +19,7 @@ const address_model_1 = require("./shared/address.model");
19
19
  const shop_document_model_1 = require("./embedded/shop-document.model");
20
20
  const work_hour_model_1 = require("./shared/work-hour.model");
21
21
  const tag_model_1 = require("./tag.model");
22
- const zone_model_1 = require("./zone.model.");
22
+ const zone_model_1 = require("./zone.model");
23
23
  let Shop = class Shop extends defaultClasses_1.TimeStamps {
24
24
  slug;
25
25
  parent;
@@ -53,9 +53,9 @@ let Shop = class Shop extends defaultClasses_1.TimeStamps {
53
53
  defaultPreparationTime;
54
54
  exchangeRate;
55
55
  workHourSetting;
56
- showFavourites;
57
- favouritesCategoryTitle;
58
- showBestSellers;
56
+ isFavouriteCategoryVisible;
57
+ favouriteCategoryTitle;
58
+ isBestSellerCategoryVisible;
59
59
  bestSellerCategoryTitle;
60
60
  sortingOrder;
61
61
  };
@@ -93,7 +93,7 @@ __decorate([
93
93
  __metadata("design:type", String)
94
94
  ], Shop.prototype, "phoneNumber", void 0);
95
95
  __decorate([
96
- (0, typegoose_1.prop)({ required: false, type: String }),
96
+ (0, typegoose_1.prop)({ required: true, type: String }),
97
97
  __metadata("design:type", String)
98
98
  ], Shop.prototype, "userPhoneNumber", void 0);
99
99
  __decorate([
@@ -169,11 +169,11 @@ __decorate([
169
169
  __metadata("design:type", Number)
170
170
  ], Shop.prototype, "deliveryFee", void 0);
171
171
  __decorate([
172
- (0, typegoose_1.prop)({ type: Number, default: Infinity }),
172
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
173
173
  __metadata("design:type", Number)
174
174
  ], Shop.prototype, "minimumOrderAmount", void 0);
175
175
  __decorate([
176
- (0, typegoose_1.prop)({ type: Number, default: null }),
176
+ (0, typegoose_1.prop)({ type: Number, default: Infinity }),
177
177
  __metadata("design:type", Number)
178
178
  ], Shop.prototype, "orderCapacity", void 0);
179
179
  __decorate([
@@ -191,15 +191,15 @@ __decorate([
191
191
  __decorate([
192
192
  (0, typegoose_1.prop)({ required: false, type: () => Boolean }),
193
193
  __metadata("design:type", Boolean)
194
- ], Shop.prototype, "showFavourites", void 0);
194
+ ], Shop.prototype, "isFavouriteCategoryVisible", void 0);
195
195
  __decorate([
196
196
  (0, typegoose_1.prop)({ required: false, type: () => String }),
197
197
  __metadata("design:type", String)
198
- ], Shop.prototype, "favouritesCategoryTitle", void 0);
198
+ ], Shop.prototype, "favouriteCategoryTitle", void 0);
199
199
  __decorate([
200
200
  (0, typegoose_1.prop)({ required: false, type: () => Boolean }),
201
201
  __metadata("design:type", Boolean)
202
- ], Shop.prototype, "showBestSellers", void 0);
202
+ ], Shop.prototype, "isBestSellerCategoryVisible", void 0);
203
203
  __decorate([
204
204
  (0, typegoose_1.prop)({ required: false, type: () => String }),
205
205
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"shop.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,4EAAqE;AACrE,iDAAwC;AACxC,kDAA6E;AAC7E,+CAAsC;AACtC,0DAAiD;AACjD,wEAA8D;AAC9D,8DAA2D;AAC3D,2CAAkC;AAClC,8CAAqC;AAG9B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB,IAAI,CAAU;IAGd,KAAK,CAAa;IAGlB,SAAS,CAAU;IAGnB,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,eAAe,CA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r\n\tmodelOptions,\r\n\tRef,\r\n\tmongoose,\r\n\tSeverity,\r\n\tReturnModelType,\r\n\tgetModelForClass,\r\n} from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Parent } from './parent.model';\r\nimport { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';\r\nimport { Brand } from './brand.model';\r\nimport { Address } from './shared/address.model';\r\nimport { ShopDocument } from './embedded/shop-document.model';\r\nimport { WorkHourSetting } from './shared/work-hour.model';\r\nimport { Tag } from './tag.model';\r\nimport { Zone } from './zone.model.';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'shops' }, options: { allowMixed: Severity.ALLOW } })\r\nexport class Shop extends TimeStamps {\r\n\t@prop({ required: true, unique: true, type: String })\r\n\tpublic slug!: string;\r\n\r\n\t@prop({ required: true, ref: () => Parent })\r\n\tpublic parent: Ref<Parent>;\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: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, ref: () => Brand })\r\n\tpublic brand: Ref<Brand>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic ownerName!: 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: false, type: String })\r\n\tpublic userPhoneNumber?: string;\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic additionalPhoneNumbers?: string[];\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic address!: Address;\r\n\r\n\t@prop({ required: true, ref: () => Zone })\r\n\tpublic zone!: Ref<Zone>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic logo!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic banner!: string;\r\n\r\n\t@prop({ required: true, type: ShopDocument })\r\n\tpublic document!: ShopDocument;\r\n\r\n\t@prop({ required: true, type: Boolean })\r\n\tpublic isBeirutAuthentic!: boolean;\r\n\r\n\t@prop({ required: true, type: Boolean })\r\n\tpublic isVisibleToUser!: boolean;\r\n\r\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status!: string;\r\n\r\n\t@prop({ type: String, enum: ShopOnlineStatus, default: ShopOnlineStatus.OFFLINE })\r\n\tpublic onlineStatus?: string;\r\n\r\n\t// Setting\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic allowSpecialInstructions?: boolean;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isRiderNoteVisible?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic riderNote?: string;\r\n\r\n\t@prop({ type: Number, default: 1, min: 1, max: 4 })\r\n\tpublic priceRange?: number;\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic dietaries?: string[];\r\n\r\n\t@prop({ ref: () => Tag, default: [] })\r\n\tpublic tags?: Ref<Tag>[];\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isSelfDelivery?: boolean;\r\n\r\n\t@prop({ type: Number })\r\n\tpublic deliveryFee?: number;\r\n\r\n\t@prop({ type: Number, default: Infinity })\r\n\tpublic minimumOrderAmount?: number;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic orderCapacity?: number;\r\n\r\n\t@prop({ type: Number, default: 10 })\r\n\tpublic defaultPreparationTime?: number;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\texchangeRate?: number;\r\n\r\n\t@prop({ type: WorkHourSetting })\r\n\tpublic workHourSetting?: WorkHourSetting;\r\n\r\n\t@prop({ required: false, type: () => Boolean })\r\n\tpublic showFavourites?: boolean;\r\n\r\n\t@prop({ required: false, type: () => String })\r\n\tpublic favouritesCategoryTitle?: string;\r\n\r\n\t@prop({ required: false, type: () => Boolean })\r\n\tpublic showBestSellers?: boolean;\r\n\r\n\t@prop({ required: false, type: () => String })\r\n\tpublic bestSellerCategoryTitle?: string;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic sortingOrder?: number;\r\n}\r\n\r\nexport const ShopModel: ReturnModelType<typeof Shop> = getModelForClass(Shop);\r\n"]}
1
+ {"version":3,"file":"shop.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAQ8B;AAC9B,4EAAqE;AACrE,iDAAwC;AACxC,kDAA6E;AAC7E,+CAAsC;AACtC,0DAAiD;AACjD,wEAA8D;AAC9D,8DAA2D;AAC3D,2CAAkC;AAClC,6CAAoC;AAG7B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB,IAAI,CAAU;IAGd,KAAK,CAAa;IAGlB,SAAS,CAAU;IAGnB,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,eAAe,CAAU;IAGzB,sBAAsB,CAAY;IAGlC,OAAO,CAAW;IAGlB,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,MAAM,CAAU;IAGhB,QAAQ,CAAgB;IAGxB,iBAAiB,CAAW;IAG5B,eAAe,CAAW;IAG1B,MAAM,CAAU;IAGhB,YAAY,CAAoB;IAIhC,wBAAwB,CAAW;IAGnC,kBAAkB,CAAW;IAG7B,SAAS,CAAU;IAGnB,UAAU,CAAU;IAGpB,SAAS,CAAY;IAGrB,IAAI,CAAc;IAGlB,cAAc,CAAW;IAGzB,WAAW,CAAU;IAGrB,kBAAkB,CAAU;IAG5B,aAAa,CAAU;IAGvB,sBAAsB,CAAU;IAGvC,YAAY,CAAU;IAGf,eAAe,CAAmB;IAGlC,0BAA0B,CAAW;IAGrC,sBAAsB,CAAU;IAGhC,2BAA2B,CAAW;IAGtC,uBAAuB,CAAU;IAGjC,YAAY,CAAU;CAC7B,CAAA;AAhHY,oBAAI;AAET;IADN,IAAA,gBAA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,EAAE,CAAC;;oDACP;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;;yDACF;AAGtC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;;qDACN;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0CACN;eA/GjB,IAAI;IADhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,oBAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;GACrF,IAAI,CAgHhB;AAEY,QAAA,SAAS,GAAiC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\r\n\tprop,\r\n\tmodelOptions,\r\n\tRef,\r\n\tmongoose,\r\n\tSeverity,\r\n\tReturnModelType,\r\n\tgetModelForClass,\r\n} from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { Parent } from './parent.model';\r\nimport { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';\r\nimport { Brand } from './brand.model';\r\nimport { Address } from './shared/address.model';\r\nimport { ShopDocument } from './embedded/shop-document.model';\r\nimport { WorkHourSetting } from './shared/work-hour.model';\r\nimport { Tag } from './tag.model';\r\nimport { Zone } from './zone.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'shops' }, options: { allowMixed: Severity.ALLOW } })\r\nexport class Shop extends TimeStamps {\r\n\t@prop({ required: true, unique: true, type: String })\r\n\tpublic slug!: string;\r\n\r\n\t@prop({ required: true, ref: () => Parent })\r\n\tpublic parent: Ref<Parent>;\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: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, ref: () => Brand })\r\n\tpublic brand: Ref<Brand>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic ownerName!: 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: String })\r\n\tpublic userPhoneNumber!: string;\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic additionalPhoneNumbers?: string[];\r\n\r\n\t@prop({ required: true, type: Address })\r\n\tpublic address!: Address;\r\n\r\n\t@prop({ required: true, ref: () => Zone })\r\n\tpublic zone!: Ref<Zone>;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic logo!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic banner!: string;\r\n\r\n\t@prop({ required: true, type: ShopDocument })\r\n\tpublic document!: ShopDocument;\r\n\r\n\t@prop({ required: true, type: Boolean })\r\n\tpublic isBeirutAuthentic!: boolean;\r\n\r\n\t@prop({ required: true, type: Boolean })\r\n\tpublic isVisibleToUser!: boolean;\r\n\r\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status!: Status;\r\n\r\n\t@prop({ type: String, enum: ShopOnlineStatus, default: ShopOnlineStatus.OFFLINE })\r\n\tpublic onlineStatus?: ShopOnlineStatus;\r\n\r\n\t// Setting\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic allowSpecialInstructions?: boolean;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isRiderNoteVisible?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic riderNote?: string;\r\n\r\n\t@prop({ type: Number, default: 1, min: 1, max: 4 })\r\n\tpublic priceRange?: number;\r\n\r\n\t@prop({ type: () => [String], default: [] })\r\n\tpublic dietaries?: string[];\r\n\r\n\t@prop({ ref: () => Tag, default: [] })\r\n\tpublic tags?: Ref<Tag>[];\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isSelfDelivery?: boolean;\r\n\r\n\t@prop({ type: Number })\r\n\tpublic deliveryFee?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic minimumOrderAmount?: number;\r\n\r\n\t@prop({ type: Number, default: Infinity })\r\n\tpublic orderCapacity?: number;\r\n\r\n\t@prop({ type: Number, default: 10 })\r\n\tpublic defaultPreparationTime?: number;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\texchangeRate?: number;\r\n\r\n\t@prop({ type: WorkHourSetting })\r\n\tpublic workHourSetting?: WorkHourSetting;\r\n\r\n\t@prop({ required: false, type: () => Boolean })\r\n\tpublic isFavouriteCategoryVisible?: boolean;\r\n\r\n\t@prop({ required: false, type: () => String })\r\n\tpublic favouriteCategoryTitle?: string;\r\n\r\n\t@prop({ required: false, type: () => Boolean })\r\n\tpublic isBestSellerCategoryVisible?: boolean;\r\n\r\n\t@prop({ required: false, type: () => String })\r\n\tpublic bestSellerCategoryTitle?: string;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic sortingOrder?: number;\r\n}\r\n\r\nexport const ShopModel: ReturnModelType<typeof Shop> = getModelForClass(Shop);\r\n"]}
@@ -3,10 +3,10 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { PaidCurrency, PaymentMethod, PaymentStatus, SubscriptionPackage, SubscriptionStatus } from '../../../utilities/enum';
4
4
  import { Duration } from './shared/duration.model';
5
5
  import { SubscriptionSummary } from './embedded/subscription-summary.model';
6
- import { User } from './user.model';
6
+ import { CoreUser } from './core-user.model';
7
7
  import { Transaction } from './transaction.model';
8
8
  export declare class Subscription extends TimeStamps {
9
- user: Ref<User>;
9
+ user: Ref<CoreUser>;
10
10
  package?: SubscriptionPackage;
11
11
  fee: number;
12
12
  secondaryFee: number;
@@ -15,7 +15,7 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  const enum_1 = require("../../../utilities/enum");
16
16
  const duration_model_1 = require("./shared/duration.model");
17
17
  const subscription_summary_model_1 = require("./embedded/subscription-summary.model");
18
- const user_model_1 = require("./user.model");
18
+ const core_user_model_1 = require("./core-user.model");
19
19
  const transaction_model_1 = require("./transaction.model");
20
20
  let Subscription = class Subscription extends defaultClasses_1.TimeStamps {
21
21
  user;
@@ -34,7 +34,7 @@ let Subscription = class Subscription extends defaultClasses_1.TimeStamps {
34
34
  };
35
35
  exports.Subscription = Subscription;
36
36
  __decorate([
37
- (0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
37
+ (0, typegoose_1.prop)({ required: true, ref: () => core_user_model_1.CoreUser }),
38
38
  __metadata("design:type", Object)
39
39
  ], Subscription.prototype, "user", void 0);
40
40
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.model.js","sourceRoot":"/","sources":["libraries/mongo/models/subscription.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,kDAMiC;AACjC,4DAAmD;AACnD,sFAA4E;AAC5E,6CAAoC;AACpC,2DAAkD;AAG3C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,2BAAU;IAEpC,IAAI,CAAa;IAGjB,OAAO,CAAuB;IAG9B,GAAG,CAAU;IAGb,YAAY,CAAU;IAGtB,OAAO,CAAuB;IAG9B,QAAQ,CAAY;IAGpB,MAAM,CAAsB;IAG5B,SAAS,CAAW;IAGpB,YAAY,CAAU;IAGtB,aAAa,CAAiB;IAG9B,aAAa,CAAiB;IAG9B,YAAY,CAAsB;IAGlC,YAAY,CAAgB;CACnC,CAAA;AAvCY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;0CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,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AAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAY,EAAE,OAAO,EAAE,mBAAY,CAAC,IAAI,EAAE,CAAC;;kDACpC;uBAtCvB,YAAY;IADxB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE,CAAC;GACpD,YAAY,CAuCxB;AAEY,QAAA,iBAAiB,GAAyC,IAAA,4BAAgB,EAAC,YAAY,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport {\r\n\tPaidCurrency,\r\n\tPaymentMethod,\r\n\tPaymentStatus,\r\n\tSubscriptionPackage,\r\n\tSubscriptionStatus,\r\n} from '../../../utilities/enum';\r\nimport { Duration } from './shared/duration.model';\r\nimport { SubscriptionSummary } from './embedded/subscription-summary.model';\r\nimport { User } from './user.model';\r\nimport { Transaction } from './transaction.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'subscriptions' } })\r\nexport class Subscription extends TimeStamps {\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ type: String, enum: SubscriptionPackage, default: SubscriptionPackage.MONTHLY })\r\n\tpublic package?: SubscriptionPackage;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic fee!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic secondaryFee!: number;\r\n\r\n\t@prop({ type: SubscriptionSummary })\r\n\tpublic summary?: SubscriptionSummary;\r\n\r\n\t@prop({ required: true, type: Duration })\r\n\tpublic duration!: Duration;\r\n\r\n\t@prop({ type: String, enum: SubscriptionStatus, default: SubscriptionStatus.ONGOING })\r\n\tpublic status?: SubscriptionStatus;\r\n\r\n\t@prop({ type: Boolean, default: true })\r\n\tpublic autoRenew?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic cancelReason?: string;\r\n\r\n\t@prop({ required: true, type: String, enum: PaymentMethod })\r\n\tpublic paymentMethod!: PaymentMethod;\r\n\r\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\r\n\tpublic paymentStatus?: PaymentStatus;\r\n\r\n\t@prop({ ref: () => Transaction, default: [] })\r\n\tpublic transactions?: Ref<Transaction>[];\r\n\r\n\t@prop({ type: String, enum: PaidCurrency, default: PaidCurrency.BASE })\r\n\tpublic paidCurrency?: PaidCurrency;\r\n}\r\n\r\nexport const SubscriptionModel: ReturnModelType<typeof Subscription> = getModelForClass(Subscription);\r\n"]}
1
+ {"version":3,"file":"subscription.model.js","sourceRoot":"/","sources":["libraries/mongo/models/subscription.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,kDAMiC;AACjC,4DAAmD;AACnD,sFAA4E;AAC5E,uDAA6C;AAC7C,2DAAkD;AAG3C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,2BAAU;IAEpC,IAAI,CAAiB;IAGrB,OAAO,CAAuB;IAG9B,GAAG,CAAU;IAGb,YAAY,CAAU;IAGtB,OAAO,CAAuB;IAG9B,QAAQ,CAAY;IAGpB,MAAM,CAAsB;IAG5B,SAAS,CAAW;IAGpB,YAAY,CAAU;IAGtB,aAAa,CAAiB;IAG9B,aAAa,CAAiB;IAG9B,YAAY,CAAsB;IAGlC,YAAY,CAAgB;CACnC,CAAA;AAvCY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;0CAClB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAAmB,EAAE,OAAO,EAAE,0BAAmB,CAAC,OAAO,EAAE,CAAC;;6CACnD;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE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EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE,CAAC;GACpD,YAAY,CAuCxB;AAEY,QAAA,iBAAiB,GAAyC,IAAA,4BAAgB,EAAC,YAAY,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport {\r\n\tPaidCurrency,\r\n\tPaymentMethod,\r\n\tPaymentStatus,\r\n\tSubscriptionPackage,\r\n\tSubscriptionStatus,\r\n} from '../../../utilities/enum';\r\nimport { Duration } from './shared/duration.model';\r\nimport { SubscriptionSummary } from './embedded/subscription-summary.model';\r\nimport { CoreUser } from './core-user.model';\r\nimport { Transaction } from './transaction.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'subscriptions' } })\r\nexport class Subscription extends TimeStamps {\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ type: String, enum: SubscriptionPackage, default: SubscriptionPackage.MONTHLY })\r\n\tpublic package?: SubscriptionPackage;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic fee!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic secondaryFee!: number;\r\n\r\n\t@prop({ type: SubscriptionSummary })\r\n\tpublic summary?: SubscriptionSummary;\r\n\r\n\t@prop({ required: true, type: Duration })\r\n\tpublic duration!: Duration;\r\n\r\n\t@prop({ type: String, enum: SubscriptionStatus, default: SubscriptionStatus.ONGOING })\r\n\tpublic status?: SubscriptionStatus;\r\n\r\n\t@prop({ type: Boolean, default: true })\r\n\tpublic autoRenew?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic cancelReason?: string;\r\n\r\n\t@prop({ required: true, type: String, enum: PaymentMethod })\r\n\tpublic paymentMethod!: PaymentMethod;\r\n\r\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\r\n\tpublic paymentStatus?: PaymentStatus;\r\n\r\n\t@prop({ ref: () => Transaction, default: [] })\r\n\tpublic transactions?: Ref<Transaction>[];\r\n\r\n\t@prop({ type: String, enum: PaidCurrency, default: PaidCurrency.BASE })\r\n\tpublic paidCurrency?: PaidCurrency;\r\n}\r\n\r\nexport const SubscriptionModel: ReturnModelType<typeof Subscription> = getModelForClass(Subscription);\r\n"]}
@@ -61,4 +61,4 @@ exports.Zone = Zone = __decorate([
61
61
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'zones' } })
62
62
  ], Zone);
63
63
  exports.ZoneModel = (0, typegoose_1.getModelForClass)(Zone);
64
- //# sourceMappingURL=zone.js.map
64
+ //# sourceMappingURL=zone.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zone.model.js","sourceRoot":"/","sources":["libraries/mongo/models/zone.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6F;AAC7F,4EAAqE;AACrE,kDAAqD;AACrD,sEAA6D;AAGtD,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,QAAQ,CAAU;IAGlB,QAAQ,CAAU;IAGlB,YAAY,CAAgB;IAG5B,MAAM,CAAc;IAGpB,aAAa,CAAU;IAGvB,mBAAmB,CAAU;IAI7B,iBAAiB,CAAU;IAG3B,iBAAiB,CAAU;CAClC,CAAA;AAzBY,oBAAI;AAET;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACE;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iCAAY,EAAE,CAAC;8BACvB,iCAAY;0CAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAU,EAAE,OAAO,EAAE,iBAAU,CAAC,MAAM,EAAE,CAAC;;oCAC1C;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACO;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACa;AAI7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACD;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACD;eAxBtB,IAAI;IADhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;GAC5C,IAAI,CAyBhB;AAEY,QAAA,SAAS,GAAiC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import { modelOptions, prop, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ZoneStatus } from '../../../utilities/enum';\r\nimport { ZoneGeometry } from './embedded/zone-geometry.mode';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'zones' } })\r\nexport class Zone extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic zoneName!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneArea?: string;\r\n\r\n\t@prop({ required: true, type: ZoneGeometry })\r\n\tpublic zoneGeometry!: ZoneGeometry;\r\n\r\n\t@prop({ type: String, enum: ZoneStatus, default: ZoneStatus.ACTIVE })\r\n\tpublic status?: ZoneStatus;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyTitle?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyDescription?: string;\r\n\r\n\t// Rider reward feature when he reached the target\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyTarget?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyReward?: number;\r\n}\r\n\r\nexport const ZoneModel: ReturnModelType<typeof Zone> = getModelForClass(Zone);\r\n"]}
@@ -1,13 +1,14 @@
1
- import { Schema, Model } from 'mongoose';
2
- import { ReturnModelType } from '@typegoose/typegoose';
3
- import { AnyParamConstructor } from '@typegoose/typegoose/lib/types';
1
+ import { Schema, Model } from "mongoose";
2
+ import { ReturnModelType, mongoose } from "@typegoose/typegoose";
3
+ import { AnyParamConstructor } from "@typegoose/typegoose/lib/types";
4
+ import { FilterDTO } from "../../../utilities/validation";
4
5
  export interface SoftDeleteModel<T> extends Model<T> {
5
- softDelete(id: string): Promise<any>;
6
- softDeleteMany(filter?: any): Promise<any>;
7
- restore(id: string): Promise<any>;
8
- restoreMany(filter?: any): Promise<any>;
9
- findWithDeleted(filter?: any): any;
10
- findDeleted(filter?: any): any;
6
+ softDelete(_id: mongoose.Types.ObjectId): Promise<any>;
7
+ softDeleteMany(filter?: FilterDTO): Promise<any>;
8
+ restore(_id: mongoose.Types.ObjectId): Promise<any>;
9
+ restoreMany(filter?: FilterDTO): Promise<any>;
10
+ findWithDeleted(filter?: FilterDTO): any;
11
+ findDeleted(filter?: FilterDTO): any;
11
12
  }
12
13
  export declare class SoftDeleteBase {
13
14
  deletedAt?: Date | null;
@@ -8,7 +8,7 @@ class SoftDeleteBase {
8
8
  exports.SoftDeleteBase = SoftDeleteBase;
9
9
  class SoftDelete {
10
10
  static applyToSchema(schema) {
11
- if (!schema.path('deletedAt')) {
11
+ if (!schema.path("deletedAt")) {
12
12
  schema.add({
13
13
  deletedAt: {
14
14
  type: Date,
@@ -22,7 +22,7 @@ class SoftDelete {
22
22
  this.addStaticMethods(schema);
23
23
  }
24
24
  static applyGlobally() {
25
- const mongoose = require('mongoose');
25
+ const mongoose = require("mongoose");
26
26
  mongoose.plugin((schema) => this.applyToSchema(schema));
27
27
  }
28
28
  static createModel(modelClass) {
@@ -35,17 +35,17 @@ class SoftDelete {
35
35
  this.where({ deletedAt: null });
36
36
  }
37
37
  };
38
- schema.pre('find', queryMiddleware);
39
- schema.pre('findOne', queryMiddleware);
40
- schema.pre('findOneAndUpdate', queryMiddleware);
41
- schema.pre('findOneAndDelete', queryMiddleware);
42
- schema.pre('findOneAndReplace', queryMiddleware);
43
- schema.pre('updateOne', queryMiddleware);
44
- schema.pre('updateMany', queryMiddleware);
45
- schema.pre('count', queryMiddleware);
46
- schema.pre('countDocuments', queryMiddleware);
47
- schema.statics.findById = function (id, projection, options) {
48
- return this.findOne({ _id: id, deletedAt: null }, projection, options);
38
+ schema.pre("find", queryMiddleware);
39
+ schema.pre("findOne", queryMiddleware);
40
+ schema.pre("findOneAndUpdate", queryMiddleware);
41
+ schema.pre("findOneAndDelete", queryMiddleware);
42
+ schema.pre("findOneAndReplace", queryMiddleware);
43
+ schema.pre("updateOne", queryMiddleware);
44
+ schema.pre("updateMany", queryMiddleware);
45
+ schema.pre("count", queryMiddleware);
46
+ schema.pre("countDocuments", queryMiddleware);
47
+ schema.statics.findById = function (_id, projection, options) {
48
+ return this.findOne({ _id, deletedAt: null }, projection, options);
49
49
  };
50
50
  }
51
51
  static addInstanceMethods(schema) {
@@ -59,15 +59,15 @@ class SoftDelete {
59
59
  };
60
60
  }
61
61
  static addStaticMethods(schema) {
62
- schema.statics.softDelete = async function (id) {
63
- const result = await this.updateOne({ _id: id }, { deletedAt: new Date() });
62
+ schema.statics.softDelete = async function (_id) {
63
+ const result = await this.updateOne({ _id }, { deletedAt: new Date() });
64
64
  return result.modifiedCount > 0;
65
65
  };
66
66
  schema.statics.softDeleteMany = function (filter = {}) {
67
67
  return this.updateMany(filter, { deletedAt: new Date() });
68
68
  };
69
- schema.statics.restore = function (id) {
70
- return this.updateOne({ _id: id }, { deletedAt: null });
69
+ schema.statics.restore = function (_id) {
70
+ return this.updateOne({ _id }, { deletedAt: null });
71
71
  };
72
72
  schema.statics.restoreMany = function (filter = {}) {
73
73
  return this.updateMany(filter, { deletedAt: null });
@@ -1 +1 @@
1
- {"version":3,"file":"soft-delete-plugin.js","sourceRoot":"/","sources":["libraries/mongo/plugins/soft-delete-plugin.ts"],"names":[],"mappings":";;;AACA,oDAAyE;AAkBzE,MAAa,cAAc;IACzB,SAAS,CAAe;CACzB;AAFD,wCAEC;AAKD,MAAa,UAAU;IAKd,MAAM,CAAC,aAAa,CAAC,MAAc;QAExC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC;gBACT,SAAS,EAAE;oBACT,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;QAGD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAGhC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAGhC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAKM,MAAM,CAAC,aAAa;QACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACrC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IAOM,MAAM,CAAC,WAAW,CACvB,UAAkC;QAElC,MAAM,KAAK,GAAG,IAAA,4BAAgB,EAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,KAAY,CAAC;IACtB,CAAC;IAMO,MAAM,CAAC,kBAAkB,CAAC,MAAc;QAC9C,MAAM,eAAe,GAAG;YACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;gBAC/B,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC;QAGF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AC,MAAM,CAAC,CAAC;AAA9E,QAAA,gBAAgB,oBAA8D;AACpF,MAAM,qBAAqB,GAAG,GAAS,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;AAA/D,QAAA,qBAAqB,yBAA0C;AACrE,MAAM,qBAAqB,GAAG,CACnC,UAAkC,EAC4B,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAFzF,QAAA,qBAAqB,yBAEoE","sourcesContent":["import { Schema, Query, Model } from 'mongoose';\r\nimport { getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { AnyParamConstructor } from '@typegoose/typegoose/lib/types';\r\n\r\n/**\r\n * Interface for models with soft delete capabilities\r\n */\r\nexport interface SoftDeleteModel<T> extends Model<T> {\r\n softDelete(id: string): Promise<any>;\r\n softDeleteMany(filter?: any): Promise<any>;\r\n restore(id: string): Promise<any>;\r\n restoreMany(filter?: any): Promise<any>;\r\n findWithDeleted(filter?: any): any;\r\n findDeleted(filter?: any): any;\r\n}\r\n\r\n/**\r\n * Base class for models with soft delete functionality\r\n */\r\nexport class SoftDeleteBase {\r\n deletedAt?: Date | null;\r\n}\r\n\r\n/**\r\n * SoftDelete class providing soft deletion functionality for mongoose models\r\n */\r\nexport class SoftDelete {\r\n /**\r\n * Apply soft delete plugin to a specific schema\r\n * @param schema Mongoose schema to enhance with soft delete functionality\r\n */\r\n public static applyToSchema(schema: Schema): void {\r\n // Add deletedAt field if it doesn't exist\r\n if (!schema.path('deletedAt')) {\r\n schema.add({\r\n deletedAt: {\r\n type: Date,\r\n default: null,\r\n index: true,\r\n },\r\n });\r\n }\r\n\r\n // Add schema middleware\r\n this.addQueryMiddleware(schema);\r\n \r\n // Add instance methods\r\n this.addInstanceMethods(schema);\r\n \r\n // Add static methods\r\n this.addStaticMethods(schema);\r\n }\r\n\r\n /**\r\n * Apply soft delete plugin globally to all mongoose schemas\r\n */\r\n public static applyGlobally(): void {\r\n const mongoose = require('mongoose');\r\n mongoose.plugin((schema: Schema) => this.applyToSchema(schema));\r\n }\r\n\r\n /**\r\n * Create a model with soft delete capabilities and proper TypeScript types\r\n * @param modelClass The class to create a model from\r\n * @returns A model with soft delete functionality\r\n */\r\n public static createModel<T extends SoftDeleteBase>(\r\n modelClass: AnyParamConstructor<T>\r\n ): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> {\r\n const model = getModelForClass(modelClass);\r\n return model as any; // The plugin adds the methods, we just need to tell TypeScript they exist\r\n }\r\n\r\n /**\r\n * Add query middleware to filter out soft-deleted documents\r\n * @param schema Schema to add middleware to\r\n */\r\n private static addQueryMiddleware(schema: Schema): void {\r\n const queryMiddleware = function(this: Query<any, any>) {\r\n if (!this.getQuery().deletedAt) {\r\n this.where({ deletedAt: null });\r\n }\r\n };\r\n\r\n // Apply middleware to relevant query methods\r\n schema.pre('find', queryMiddleware);\r\n schema.pre('findOne', queryMiddleware);\r\n schema.pre('findOneAndUpdate', queryMiddleware);\r\n schema.pre('findOneAndDelete', queryMiddleware);\r\n schema.pre('findOneAndReplace', queryMiddleware);\r\n schema.pre('updateOne', queryMiddleware);\r\n schema.pre('updateMany', queryMiddleware);\r\n // TypeScript workaround for count hook\r\n (schema as any).pre('count', queryMiddleware);\r\n schema.pre('countDocuments', queryMiddleware);\r\n\r\n // Override findById to respect soft delete\r\n schema.statics.findById = function(id: any, projection?: any, options?: any) {\r\n return this.findOne({ _id: id, deletedAt: null }, projection, options);\r\n };\r\n }\r\n\r\n /**\r\n * Add instance methods for soft delete operations\r\n * @param schema Schema to add methods to\r\n */\r\n private static addInstanceMethods(schema: Schema): void {\r\n schema.methods.softDelete = function() {\r\n this.deletedAt = new Date();\r\n return this.save();\r\n };\r\n\r\n schema.methods.restore = function() {\r\n this.deletedAt = null;\r\n return this.save();\r\n };\r\n }\r\n\r\n /**\r\n * Add static methods for soft delete operations\r\n * @param schema Schema to add methods to\r\n */\r\n private static addStaticMethods(schema: Schema): void {\r\n schema.statics.softDelete = async function(id: string) {\r\n \r\n const result = await this.updateOne({ _id: id }, { deletedAt: new Date() });\r\n return result.modifiedCount > 0;\r\n };\r\n\r\n schema.statics.softDeleteMany = function(filter = {}) {\r\n return this.updateMany(filter, { deletedAt: new Date() });\r\n };\r\n\r\n schema.statics.restore = function(id: string) {\r\n return this.updateOne({ _id: id }, { deletedAt: null });\r\n };\r\n\r\n schema.statics.restoreMany = function(filter = {}) {\r\n return this.updateMany(filter, { deletedAt: null });\r\n };\r\n\r\n schema.statics.findWithDeleted = function(filter = {}) {\r\n return this.find(filter);\r\n };\r\n\r\n schema.statics.findDeleted = function(filter = {}) {\r\n return this.find({ ...filter, deletedAt: { $ne: null } });\r\n };\r\n }\r\n}\r\n\r\n// Export convenience functions with the same names as before for backward compatibility\r\nexport const softDeletePlugin = (schema: Schema): void => SoftDelete.applyToSchema(schema);\r\nexport const applySoftDeletePlugin = (): void => SoftDelete.applyGlobally();\r\nexport const createSoftDeleteModel = <T extends SoftDeleteBase>(\r\n modelClass: AnyParamConstructor<T>\r\n): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> => SoftDelete.createModel(modelClass);"]}
1
+ {"version":3,"file":"soft-delete-plugin.js","sourceRoot":"/","sources":["libraries/mongo/plugins/soft-delete-plugin.ts"],"names":[],"mappings":";;;AACA,oDAI8B;AAmB9B,MAAa,cAAc;IACzB,SAAS,CAAe;CACzB;AAFD,wCAEC;AAKD,MAAa,UAAU;IAKd,MAAM,CAAC,aAAa,CAAC,MAAc;QAExC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC;gBACT,SAAS,EAAE;oBACT,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;QAGD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAGhC,IAAI,CAAC,kBAAkB,CAAC,MA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CAAC,OAAO,CAAC,WAAW,GAAG,UAAU,MAAM,GAAG,EAAE;YAChD,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,eAAe,GAAG,UAAU,MAAM,GAAG,EAAE;YACpD,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,UAAU,MAAM,GAAG,EAAE;YAChD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC;CACF;AAjID,gCAiIC;AAGM,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAQ,EAAE,CACvD,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AADtB,QAAA,gBAAgB,oBACM;AAC5B,MAAM,qBAAqB,GAAG,GAAS,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;AAA/D,QAAA,qBAAqB,yBAA0C;AACrE,MAAM,qBAAqB,GAAG,CACnC,UAAkC,EAC4B,EAAE,CAChE,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAHxB,QAAA,qBAAqB,yBAGG","sourcesContent":["import { Schema, Query, Model } from \"mongoose\";\r\nimport {\r\n getModelForClass,\r\n ReturnModelType,\r\n mongoose,\r\n} from \"@typegoose/typegoose\";\r\nimport { AnyParamConstructor } from \"@typegoose/typegoose/lib/types\";\r\nimport { FilterDTO } from \"../../../utilities/validation\";\r\n\r\n/**\r\n * Interface for models with soft delete capabilities\r\n */\r\nexport interface SoftDeleteModel<T> extends Model<T> {\r\n softDelete(_id: mongoose.Types.ObjectId): Promise<any>;\r\n softDeleteMany(filter?: FilterDTO): Promise<any>;\r\n restore(_id: mongoose.Types.ObjectId): Promise<any>;\r\n restoreMany(filter?: FilterDTO): Promise<any>;\r\n findWithDeleted(filter?: FilterDTO): any;\r\n findDeleted(filter?: FilterDTO): any;\r\n}\r\n\r\n/**\r\n * Base class for models with soft delete functionality\r\n */\r\nexport class SoftDeleteBase {\r\n deletedAt?: Date | null;\r\n}\r\n\r\n/**\r\n * SoftDelete class providing soft deletion functionality for mongoose models\r\n */\r\nexport class SoftDelete {\r\n /**\r\n * Apply soft delete plugin to a specific schema\r\n * @param schema Mongoose schema to enhance with soft delete functionality\r\n */\r\n public static applyToSchema(schema: Schema): void {\r\n // Add deletedAt field if it doesn't exist\r\n if (!schema.path(\"deletedAt\")) {\r\n schema.add({\r\n deletedAt: {\r\n type: Date,\r\n default: null,\r\n index: true,\r\n },\r\n });\r\n }\r\n\r\n // Add schema middleware\r\n this.addQueryMiddleware(schema);\r\n\r\n // Add instance methods\r\n this.addInstanceMethods(schema);\r\n\r\n // Add static methods\r\n this.addStaticMethods(schema);\r\n }\r\n\r\n /**\r\n * Apply soft delete plugin globally to all mongoose schemas\r\n */\r\n public static applyGlobally(): void {\r\n const mongoose = require(\"mongoose\");\r\n mongoose.plugin((schema: Schema) => this.applyToSchema(schema));\r\n }\r\n\r\n /**\r\n * Create a model with soft delete capabilities and proper TypeScript types\r\n * @param modelClass The class to create a model from\r\n * @returns A model with soft delete functionality\r\n */\r\n public static createModel<T extends SoftDeleteBase>(\r\n modelClass: AnyParamConstructor<T>\r\n ): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> {\r\n const model = getModelForClass(modelClass);\r\n return model as any; // The plugin adds the methods, we just need to tell TypeScript they exist\r\n }\r\n\r\n /**\r\n * Add query middleware to filter out soft-deleted documents\r\n * @param schema Schema to add middleware to\r\n */\r\n private static addQueryMiddleware(schema: Schema): void {\r\n const queryMiddleware = function (this: Query<any, any>) {\r\n if (!this.getQuery().deletedAt) {\r\n this.where({ deletedAt: null });\r\n }\r\n };\r\n\r\n // Apply middleware to relevant query methods\r\n schema.pre(\"find\", queryMiddleware);\r\n schema.pre(\"findOne\", queryMiddleware);\r\n schema.pre(\"findOneAndUpdate\", queryMiddleware);\r\n schema.pre(\"findOneAndDelete\", queryMiddleware);\r\n schema.pre(\"findOneAndReplace\", queryMiddleware);\r\n schema.pre(\"updateOne\", queryMiddleware);\r\n schema.pre(\"updateMany\", queryMiddleware);\r\n // TypeScript workaround for count hook\r\n (schema as any).pre(\"count\", queryMiddleware);\r\n schema.pre(\"countDocuments\", queryMiddleware);\r\n\r\n // Override findById to respect soft delete\r\n schema.statics.findById = function (\r\n _id: mongoose.Types.ObjectId,\r\n projection?: any,\r\n options?: any\r\n ) {\r\n return this.findOne({ _id, deletedAt: null }, projection, options);\r\n };\r\n }\r\n\r\n /**\r\n * Add instance methods for soft delete operations\r\n * @param schema Schema to add methods to\r\n */\r\n private static addInstanceMethods(schema: Schema): void {\r\n schema.methods.softDelete = function () {\r\n this.deletedAt = new Date();\r\n return this.save();\r\n };\r\n\r\n schema.methods.restore = function () {\r\n this.deletedAt = null;\r\n return this.save();\r\n };\r\n }\r\n\r\n /**\r\n * Add static methods for soft delete operations\r\n * @param schema Schema to add methods to\r\n */\r\n private static addStaticMethods(schema: Schema): void {\r\n schema.statics.softDelete = async function (_id: mongoose.Types.ObjectId) {\r\n const result = await this.updateOne(\r\n { _id },\r\n { deletedAt: new Date() }\r\n );\r\n return result.modifiedCount > 0;\r\n };\r\n\r\n schema.statics.softDeleteMany = function (filter = {}) {\r\n return this.updateMany(filter, { deletedAt: new Date() });\r\n };\r\n\r\n schema.statics.restore = function (_id: mongoose.Types.ObjectId) {\r\n return this.updateOne({ _id }, { deletedAt: null });\r\n };\r\n\r\n schema.statics.restoreMany = function (filter = {}) {\r\n return this.updateMany(filter, { deletedAt: null });\r\n };\r\n\r\n schema.statics.findWithDeleted = function (filter = {}) {\r\n return this.find(filter);\r\n };\r\n\r\n schema.statics.findDeleted = function (filter = {}) {\r\n return this.find({ ...filter, deletedAt: { $ne: null } });\r\n };\r\n }\r\n}\r\n\r\n// Export convenience functions with the same names as before for backward compatibility\r\nexport const softDeletePlugin = (schema: Schema): void =>\r\n SoftDelete.applyToSchema(schema);\r\nexport const applySoftDeletePlugin = (): void => SoftDelete.applyGlobally();\r\nexport const createSoftDeleteModel = <T extends SoftDeleteBase>(\r\n modelClass: AnyParamConstructor<T>\r\n): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> =>\r\n SoftDelete.createModel(modelClass);"]}
@@ -0,0 +1,12 @@
1
+ import type { IncomingMessage, ServerResponse } from 'http';
2
+ interface CorsOptions {
3
+ origin?: string | string[];
4
+ methods?: string[];
5
+ allowedHeaders?: string[];
6
+ exposedHeaders?: string[];
7
+ credentials?: boolean;
8
+ maxAge?: number;
9
+ preflightContinue?: boolean;
10
+ }
11
+ export declare function corsMiddleware(options?: CorsOptions): (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
12
+ export {};