@lyxa.ai/core 1.4.305-alpha.1 → 1.4.306-alpha

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 (26) hide show
  1. package/dist/libraries/mongo/models/embedded/service-control-product-config.model.d.ts +9 -0
  2. package/dist/libraries/mongo/models/embedded/service-control-product-config.model.js +52 -0
  3. package/dist/libraries/mongo/models/embedded/service-control-product-config.model.js.map +1 -0
  4. package/dist/libraries/mongo/models/embedded/service-line-item.model.d.ts +6 -4
  5. package/dist/libraries/mongo/models/embedded/service-line-item.model.js +18 -8
  6. package/dist/libraries/mongo/models/embedded/service-line-item.model.js.map +1 -1
  7. package/dist/libraries/mongo/models/service-booking.model.d.ts +1 -0
  8. package/dist/libraries/mongo/models/service-booking.model.js +5 -0
  9. package/dist/libraries/mongo/models/service-booking.model.js.map +1 -1
  10. package/dist/libraries/mongo/models/service-control.model.d.ts +10 -2
  11. package/dist/libraries/mongo/models/service-control.model.js +40 -4
  12. package/dist/libraries/mongo/models/service-control.model.js.map +1 -1
  13. package/dist/libraries/trpc/middlewares/auth.d.ts +2 -2
  14. package/dist/libraries/trpc/middlewares/auth.js +0 -2
  15. package/dist/libraries/trpc/middlewares/auth.js.map +1 -1
  16. package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +2 -2
  17. package/dist/libraries/trpc/middlewares/phone-verified.d.ts +2 -2
  18. package/dist/types/README.md +1 -1
  19. package/dist/types/package.json +1 -1
  20. package/dist/types/utilities/enum.d.ts +9 -0
  21. package/dist/types/utilities/enum.js +15 -5
  22. package/dist/types/utilities/enum.js.map +1 -1
  23. package/dist/utilities/enum.d.ts +9 -0
  24. package/dist/utilities/enum.js +15 -5
  25. package/dist/utilities/enum.js.map +1 -1
  26. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ export declare class ServiceControlProductConfig {
2
+ unitQuantity?: boolean;
3
+ notes?: boolean;
4
+ productBrand?: boolean;
5
+ productType?: boolean;
6
+ storedTemperature?: boolean;
7
+ dietary?: boolean;
8
+ nutrition?: boolean;
9
+ }
@@ -0,0 +1,52 @@
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.ServiceControlProductConfig = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ class ServiceControlProductConfig {
15
+ unitQuantity;
16
+ notes;
17
+ productBrand;
18
+ productType;
19
+ storedTemperature;
20
+ dietary;
21
+ nutrition;
22
+ }
23
+ exports.ServiceControlProductConfig = ServiceControlProductConfig;
24
+ __decorate([
25
+ (0, typegoose_1.prop)({ type: Boolean }),
26
+ __metadata("design:type", Boolean)
27
+ ], ServiceControlProductConfig.prototype, "unitQuantity", void 0);
28
+ __decorate([
29
+ (0, typegoose_1.prop)({ type: Boolean }),
30
+ __metadata("design:type", Boolean)
31
+ ], ServiceControlProductConfig.prototype, "notes", void 0);
32
+ __decorate([
33
+ (0, typegoose_1.prop)({ type: Boolean }),
34
+ __metadata("design:type", Boolean)
35
+ ], ServiceControlProductConfig.prototype, "productBrand", void 0);
36
+ __decorate([
37
+ (0, typegoose_1.prop)({ type: Boolean }),
38
+ __metadata("design:type", Boolean)
39
+ ], ServiceControlProductConfig.prototype, "productType", void 0);
40
+ __decorate([
41
+ (0, typegoose_1.prop)({ type: Boolean }),
42
+ __metadata("design:type", Boolean)
43
+ ], ServiceControlProductConfig.prototype, "storedTemperature", void 0);
44
+ __decorate([
45
+ (0, typegoose_1.prop)({ type: Boolean }),
46
+ __metadata("design:type", Boolean)
47
+ ], ServiceControlProductConfig.prototype, "dietary", void 0);
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ type: Boolean }),
50
+ __metadata("design:type", Boolean)
51
+ ], ServiceControlProductConfig.prototype, "nutrition", void 0);
52
+ //# sourceMappingURL=service-control-product-config.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-control-product-config.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-control-product-config.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,2BAA2B;IAEvC,YAAY,CAAW;IAGvB,KAAK,CAAW;IAGhB,YAAY,CAAW;IAGvB,WAAW,CAAW;IAGtB,iBAAiB,CAAW;IAG5B,OAAO,CAAW;IAGlB,SAAS,CAAW;CACpB;AArBD,kEAqBC;AAnBA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;iEACD;AAGvB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DACR;AAGhB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;iEACD;AAGvB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gEACF;AAGtB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;sEACI;AAG5B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;4DACN;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;8DACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class ServiceControlProductConfig {\n\t@prop({ type: Boolean })\n\tunitQuantity?: boolean;\n\n\t@prop({ type: Boolean })\n\tnotes?: boolean;\n\n\t@prop({ type: Boolean })\n\tproductBrand?: boolean;\n\n\t@prop({ type: Boolean })\n\tproductType?: boolean;\n\n\t@prop({ type: Boolean })\n\tstoredTemperature?: boolean;\n\n\t@prop({ type: Boolean })\n\tdietary?: boolean;\n\n\t@prop({ type: Boolean })\n\tnutrition?: boolean;\n}\n"]}
@@ -28,11 +28,13 @@ export declare class ServiceLineItem {
28
28
  price: number;
29
29
  quantity: number;
30
30
  lineItemSnap?: LineItemSnap;
31
+ totalPrice?: number;
31
32
  secondaryPrice?: number;
32
- discountedPrice?: number;
33
- secondaryDiscountedPrice?: number;
34
- discountAmount?: number;
35
- secondaryDiscountAmount?: number;
33
+ totalSecondaryPrice?: number;
34
+ totalDiscountedPrice?: number;
35
+ totalSecondaryDiscountedPrice?: number;
36
+ totalDiscountAmount?: number;
37
+ totalSecondaryDiscountAmount?: number;
36
38
  promotionSnaps?: PromotionSnap[];
37
39
  discount?: ServicePromotionCut;
38
40
  }
@@ -90,11 +90,13 @@ class ServiceLineItem {
90
90
  price;
91
91
  quantity;
92
92
  lineItemSnap;
93
+ totalPrice;
93
94
  secondaryPrice;
94
- discountedPrice;
95
- secondaryDiscountedPrice;
96
- discountAmount;
97
- secondaryDiscountAmount;
95
+ totalSecondaryPrice;
96
+ totalDiscountedPrice;
97
+ totalSecondaryDiscountedPrice;
98
+ totalDiscountAmount;
99
+ totalSecondaryDiscountAmount;
98
100
  promotionSnaps;
99
101
  discount;
100
102
  }
@@ -123,6 +125,10 @@ __decorate([
123
125
  (0, typegoose_1.prop)({ type: LineItemSnap, _id: false }),
124
126
  __metadata("design:type", LineItemSnap)
125
127
  ], ServiceLineItem.prototype, "lineItemSnap", void 0);
128
+ __decorate([
129
+ (0, typegoose_1.prop)({ type: Number }),
130
+ __metadata("design:type", Number)
131
+ ], ServiceLineItem.prototype, "totalPrice", void 0);
126
132
  __decorate([
127
133
  (0, typegoose_1.prop)({ type: Number }),
128
134
  __metadata("design:type", Number)
@@ -130,19 +136,23 @@ __decorate([
130
136
  __decorate([
131
137
  (0, typegoose_1.prop)({ type: Number }),
132
138
  __metadata("design:type", Number)
133
- ], ServiceLineItem.prototype, "discountedPrice", void 0);
139
+ ], ServiceLineItem.prototype, "totalSecondaryPrice", void 0);
140
+ __decorate([
141
+ (0, typegoose_1.prop)({ type: Number }),
142
+ __metadata("design:type", Number)
143
+ ], ServiceLineItem.prototype, "totalDiscountedPrice", void 0);
134
144
  __decorate([
135
145
  (0, typegoose_1.prop)({ type: Number }),
136
146
  __metadata("design:type", Number)
137
- ], ServiceLineItem.prototype, "secondaryDiscountedPrice", void 0);
147
+ ], ServiceLineItem.prototype, "totalSecondaryDiscountedPrice", void 0);
138
148
  __decorate([
139
149
  (0, typegoose_1.prop)({ type: Number }),
140
150
  __metadata("design:type", Number)
141
- ], ServiceLineItem.prototype, "discountAmount", void 0);
151
+ ], ServiceLineItem.prototype, "totalDiscountAmount", void 0);
142
152
  __decorate([
143
153
  (0, typegoose_1.prop)({ type: Number }),
144
154
  __metadata("design:type", Number)
145
- ], ServiceLineItem.prototype, "secondaryDiscountAmount", void 0);
155
+ ], ServiceLineItem.prototype, "totalSecondaryDiscountAmount", void 0);
146
156
  __decorate([
147
157
  (0, typegoose_1.prop)({ type: [PromotionSnap], _id: false }),
148
158
  __metadata("design:type", Array)
@@ -1 +1 @@
1
- {"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA4E;AAC5E,oEAA0D;AAC1D,gEAAsD;AACtD,iEAAuD;AACvD,wEAA8D;AAC9D,+DAA4D;AAE5D,MAAa,YAAY;IAEjB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,QAAQ,CAAiB;IAGzB,YAAY,CAAU;IAGtB,qBAAqB,CA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Q;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gEACiB;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;;uDACJ;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,yCAAmB,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;8BACpC,yCAAmB;iDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ServiceLineItemType, ValueType } from '../../../../utilities/enum';\nimport { ServicePackage } from '../service-package.model';\nimport { ServiceAddon } from '../service-addon.model';\nimport { PreparingTime } from './preparing-time.model';\nimport { ServicePromotion } from '../service-promotion.model';\nimport { ServicePromotionCut } from './marketing-cut.model';\n\nexport class LineItemSnap {\n\t@prop({ type: String })\n\tpublic name?: string;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n\n\t@prop({ type: PreparingTime })\n\tpublic duration?: PreparingTime;\n\n\t@prop({ type: Number })\n\tpublic materialCost?: number;\n\n\t@prop({ type: Number })\n\tpublic secondaryMaterialCost?: number;\n}\n\nexport class PromotionSnap {\n\t@prop({ ref: () => ServicePromotion })\n\tpublic servicePromotion?: Ref<ServicePromotion>;\n\n\t@prop({ type: Boolean })\n\tpublic isAppliedByCompany?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMaxDiscountPerOrderEnabled?: boolean;\n\n\t@prop({ type: Number })\n\tpublic maxDiscountPerOrder?: number;\n\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n}\n\n/**\n * A single line item in the service cart.\n *\n * Each line item is either a PACKAGE or an ADDON — never both.\n * The `lineItemType` field is the discriminator:\n *\n * - lineItemType = PACKAGE → `servicePackage` + `lineItemSnap` are set; addon field is absent.\n * - lineItemType = ADDON → `addon` + `lineItemSnap` are set; servicePackage field is absent.\n *\n * `price` — unit price of the item (package price or addon price).\n * `quantity` — how many units of this item are being booked.\n */\nexport class ServiceLineItem {\n\t@prop({ required: true, type: String, enum: ServiceLineItemType })\n\tpublic lineItemType!: ServiceLineItemType;\n\n\t@prop({ ref: () => ServicePackage })\n\tpublic servicePackage?: Ref<ServicePackage>;\n\n\t@prop({ ref: () => ServiceAddon })\n\tpublic addon?: Ref<ServiceAddon>;\n\n\t@prop({ required: true, type: Number })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic quantity!: number;\n\n\t// Add these fields when cart will be submitted\n\t@prop({ type: LineItemSnap, _id: false })\n\tpublic lineItemSnap?: LineItemSnap;\n\n\t@prop({ type: Number })\n\tpublic secondaryPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic discountedPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic secondaryDiscountedPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic discountAmount?: number;\n\n\t@prop({ type: Number })\n\tpublic secondaryDiscountAmount?: number;\n\n\t@prop({ type: [PromotionSnap], _id: false })\n\tpublic promotionSnaps?: PromotionSnap[];\n\n\t@prop({ type: () => ServicePromotionCut, _id: false })\n\tpublic discount?: ServicePromotionCut;\n}\n"]}
1
+ {"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA4E;AAC5E,oEAA0D;AAC1D,gEAAsD;AACtD,iEAAuD;AACvD,wEAA8D;AAC9D,+DAA4D;AAE5D,MAAa,YAAY;IAEjB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,QAAQ,CAAiB;IAGzB,YAAY,CAAU;IAGtB,qBAAqB,CAAU;CACtC;AAlBD,oCAkBC;AAhBO;IADN,IA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;6DACc;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sEACuB;AAGvC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DACa;AAG7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qEACsB;AAGtC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;;uDACJ;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,yCAAmB,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;8BACpC,yCAAmB;iDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ServiceLineItemType, ValueType } from '../../../../utilities/enum';\nimport { ServicePackage } from '../service-package.model';\nimport { ServiceAddon } from '../service-addon.model';\nimport { PreparingTime } from './preparing-time.model';\nimport { ServicePromotion } from '../service-promotion.model';\nimport { ServicePromotionCut } from './marketing-cut.model';\n\nexport class LineItemSnap {\n\t@prop({ type: String })\n\tpublic name?: string;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n\n\t@prop({ type: PreparingTime })\n\tpublic duration?: PreparingTime;\n\n\t@prop({ type: Number })\n\tpublic materialCost?: number;\n\n\t@prop({ type: Number })\n\tpublic secondaryMaterialCost?: number;\n}\n\nexport class PromotionSnap {\n\t@prop({ ref: () => ServicePromotion })\n\tpublic servicePromotion?: Ref<ServicePromotion>;\n\n\t@prop({ type: Boolean })\n\tpublic isAppliedByCompany?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMaxDiscountPerOrderEnabled?: boolean;\n\n\t@prop({ type: Number })\n\tpublic maxDiscountPerOrder?: number;\n\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n}\n\n/**\n * A single line item in the service cart.\n *\n * Each line item is either a PACKAGE or an ADDON — never both.\n * The `lineItemType` field is the discriminator:\n *\n * - lineItemType = PACKAGE → `servicePackage` + `lineItemSnap` are set; addon field is absent.\n * - lineItemType = ADDON → `addon` + `lineItemSnap` are set; servicePackage field is absent.\n *\n * `price` — unit price of the item (package price or addon price).\n * `quantity` — how many units of this item are being booked.\n */\nexport class ServiceLineItem {\n\t@prop({ required: true, type: String, enum: ServiceLineItemType })\n\tpublic lineItemType!: ServiceLineItemType;\n\n\t@prop({ ref: () => ServicePackage })\n\tpublic servicePackage?: Ref<ServicePackage>;\n\n\t@prop({ ref: () => ServiceAddon })\n\tpublic addon?: Ref<ServiceAddon>;\n\n\t@prop({ required: true, type: Number })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic quantity!: number;\n\n\t// Add these fields when cart will be submitted\n\t@prop({ type: LineItemSnap, _id: false })\n\tpublic lineItemSnap?: LineItemSnap;\n\n\t@prop({ type: Number })\n\tpublic totalPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic secondaryPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic totalSecondaryPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic totalDiscountedPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic totalSecondaryDiscountedPrice?: number;\n\n\t@prop({ type: Number })\n\tpublic totalDiscountAmount?: number;\n\n\t@prop({ type: Number })\n\tpublic totalSecondaryDiscountAmount?: number;\n\n\t@prop({ type: [PromotionSnap], _id: false })\n\tpublic promotionSnaps?: PromotionSnap[];\n\n\t@prop({ type: () => ServicePromotionCut, _id: false })\n\tpublic discount?: ServicePromotionCut;\n}\n"]}
@@ -58,6 +58,7 @@ export declare class ServiceBooking extends TimeStamps {
58
58
  isReviewNotificationSent?: boolean;
59
59
  isLowRated?: boolean;
60
60
  servicePromotions?: Ref<ServicePromotion>[];
61
+ maxDiscountPerOrder?: number | null;
61
62
  onlinePaymentStatus?: OnlinePaymentStatus;
62
63
  specialInstructions?: string;
63
64
  professionalStartNotificationSentAt?: Date;
@@ -71,6 +71,7 @@ let ServiceBooking = class ServiceBooking extends defaultClasses_1.TimeStamps {
71
71
  isReviewNotificationSent;
72
72
  isLowRated;
73
73
  servicePromotions;
74
+ maxDiscountPerOrder;
74
75
  onlinePaymentStatus;
75
76
  specialInstructions;
76
77
  professionalStartNotificationSentAt;
@@ -248,6 +249,10 @@ __decorate([
248
249
  (0, typegoose_1.prop)({ ref: () => service_promotion_model_1.ServicePromotion }),
249
250
  __metadata("design:type", Array)
250
251
  ], ServiceBooking.prototype, "servicePromotions", void 0);
252
+ __decorate([
253
+ (0, typegoose_1.prop)({ type: Number }),
254
+ __metadata("design:type", Object)
255
+ ], ServiceBooking.prototype, "maxDiscountPerOrder", void 0);
251
256
  __decorate([
252
257
  (0, typegoose_1.prop)({ type: String, enum: enum_1.OnlinePaymentStatus }),
253
258
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"service-booking.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-booking.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA8E;AAC9E,6CAAoC;AACpC,iDAAwC;AACxC,kDAOiC;AACjC,6DAAoD;AACpD,6DAAmD;AACnD,4FAAiF;AACjF,sHAG+D;AAC/D,4EAAgF;AAChF,wBAAuD;AACvD,uEAA6D;AAC7D,0DAA6D;AAC7D,4DAAyD;AACzD,4EAAqE;AACrE,kHAAsG;AACtG,4HAAgH;AAChH,6DAAmD;AACnD,oDAAiD;AA4B1C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,OAAO,CAAU;IAGjB,IAAI,CAAa;IAGjB,MAAM,CAAe;IAGrB,YAAY,CAAqB;IAGjC,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,IAAI,CAAoB;IAGxB,WAAW,CAAuB;IAGlC,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AAU,EAAE,KAAK;KACjB,CAAC;;+CAC6B;yBA3JnB,cAAc;IA3B1B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE;QAClE,OAAO,EAAE,EAAE,UAAU,EAAE,oBAAQ,CAAC,KAAK,EAAE;KACvC,CAAC;IACD,IAAA,eAAG,EAAiB,UAAU,EAAE,KAAK,WAAW,IAAI;QACpD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,KAAK,GAAG,IAAA,aAAK,GAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEvC,MAAM,OAAO,GAAG,MAAM,eAAY,CAAC,gBAAgB,CAClD,EAAE,WAAW,EAAE,kBAAW,CAAC,KAAK,EAAE,EAClC;gBACC;oBACC,IAAI,EAAE;wBACL,KAAK,EAAE;4BACN,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;yBAC/D;wBACD,KAAK,EAAE,KAAK;qBACZ;iBACD;aACD,EACD,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAC3B,CAAC;YAEF,IAAI,CAAC,OAAO,GAAG,GAAG,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QACvE,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,cAAc,CA4J1B","sourcesContent":["import { modelOptions, pre, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { User } from './user.model';\nimport { Vendor } from './vendor.model';\nimport {\n\tServiceBookingStatus,\n\tCounterType,\n\tServiceType,\n\tSubServiceType,\n\tAdjustmentStatus,\n\tOnlinePaymentStatus,\n} from '../../../utilities/enum';\nimport { Professional } from './professional.model';\nimport { ServiceCart } from './service-cart.model';\nimport { ServiceBookingFinance } from './embedded/service-booking-finance.model';\nimport {\n\tServiceBookingCancellationDetails,\n\tServiceBookingEndorseLoss,\n} from './embedded/service-booking-cancellation-details.model';\nimport { ServiceBookingStatusTimeline } from './embedded/status-timeline.model';\nimport { CounterModel, Review, VendorParent } from '.';\nimport { ServicePromotion } from './service-promotion.model';\nimport { RegularOrderAddress } from './shared/address.model';\nimport { OrderSlotRange } from './shared/duration.model';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceBookingRefundInformation } from './embedded/service-booking-refund-information.model';\nimport { ServiceBookingReplacementInformation } from './embedded/service-booking-replacement-information.model';\nimport { ServiceFlag } from './service-flag.model';\nimport { dayjs } from '../../../utilities/dayjs';\n@modelOptions({\n\tschemaOptions: { collection: 'serviceBookings', timestamps: true },\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@pre<ServiceBooking>('validate', async function (next) {\n\tif (this.isNew) {\n\t\tconst today = dayjs().format('DDMMYY');\n\n\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t{ counterType: CounterType.ORDER },\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t$cond: [{ $eq: ['$today', today] }, { $add: ['$value', 1] }, 1],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttoday: today,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ new: true, upsert: true }\n\t\t);\n\n\t\tthis.orderId = `${today}${counter.value.toString().padStart(6, '0')}`;\n\t}\n\tnext();\n})\nexport class ServiceBooking extends TimeStamps {\n\t@prop({ type: String, unique: true })\n\tpublic orderId?: string;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, ref: () => VendorParent })\n\tpublic vendorParent!: Ref<VendorParent>;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ required: true, ref: () => ServiceCart })\n\tpublic cart!: Ref<ServiceCart>;\n\n\t@prop({ required: true, type: () => RegularOrderAddress })\n\tpublic userAddress!: RegularOrderAddress;\n\n\t@prop({ required: true, type: OrderSlotRange, _id: false })\n\tpublic slotRange!: OrderSlotRange;\n\n\t@prop({ type: String, enum: ServiceBookingStatus, default: ServiceBookingStatus.PENDING })\n\tpublic status!: ServiceBookingStatus;\n\n\t@prop({ ref: () => Professional })\n\tpublic professionals?: Ref<Professional>[];\n\n\t@prop({ ref: () => Professional })\n\tpublic responsibleProfessional?: Ref<Professional>;\n\n\t@prop({ type: Date, default: new Date() })\n\tpublic processedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic placedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic startedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic estimatedCompletionAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic estimatedCompletionInMinutes?: number;\n\n\t@prop({ type: Date })\n\tpublic completedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic actualCompletionInMinutes?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isUrgent?: boolean;\n\n\t@prop({ type: Date })\n\tpublic urgentAt?: Date;\n\n\t@prop({ required: true, type: ServiceBookingFinance, _id: false })\n\tpublic finance!: ServiceBookingFinance;\n\n\t@prop({ required: true, type: ServiceBookingFinance, _id: false })\n\tpublic adjustedFinance!: ServiceBookingFinance;\n\n\t@prop({ type: () => ServiceBookingCancellationDetails, _id: false })\n\tpublic cancellationDetails?: ServiceBookingCancellationDetails;\n\n\t@prop({ type: Date })\n\tpublic cancelledAt?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isEndorseLossApplied?: boolean;\n\n\t@prop({ type: () => ServiceBookingEndorseLoss, _id: false })\n\tpublic endorseLossInformation?: ServiceBookingEndorseLoss;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isAdjusted?: boolean;\n\n\t@prop({ type: String, enum: AdjustmentStatus, default: AdjustmentStatus.NONE })\n\tpublic adjustmentStatus?: AdjustmentStatus;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isFlagged?: boolean;\n\n\t@prop({ type: Date })\n\tpublic flaggedAt?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRefunded?: boolean;\n\n\t@prop({ type: ServiceBookingRefundInformation, _id: false })\n\tpublic refundInformation?: ServiceBookingRefundInformation;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReplacement?: boolean;\n\n\t@prop({ type: () => ServiceBookingReplacementInformation, _id: false })\n\tpublic replacementInformation?: ServiceBookingReplacementInformation;\n\n\t@prop({ ref: () => ServiceBooking })\n\tpublic replacementBooking?: Ref<ServiceBooking>;\n\n\t@prop({ type: () => [ServiceBookingStatusTimeline], default: [] })\n\tpublic statusTimeline?: ServiceBookingStatusTimeline[];\n\n\t@prop({ type: Number })\n\tpublic bufferTime?: number; // minutes\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReviewed?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReviewNotificationSent?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLowRated?: boolean;\n\n\t@prop({ ref: () => ServicePromotion })\n\tpublic servicePromotions?: Ref<ServicePromotion>[];\n\n\t@prop({ type: String, enum: OnlinePaymentStatus })\n\tpublic onlinePaymentStatus?: OnlinePaymentStatus;\n\n\t@prop({ type: String })\n\tpublic specialInstructions?: string;\n\n\t@prop({ type: Date, default: null })\n\tpublic professionalStartNotificationSentAt?: Date;\n\n\t@prop({ type: Date, default: null })\n\tpublic professionalEndNotificationSentAt?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLate?: boolean;\n\n\t// Virtual field\n\t@prop({\n\t\tref: () => ServiceFlag,\n\t\tforeignField: 'serviceBooking',\n\t\tlocalField: '_id',\n\t})\n\tpublic flags?: Ref<ServiceFlag>[];\n\n\t@prop({\n\t\tref: () => Review,\n\t\tforeignField: 'serviceBooking',\n\t\tlocalField: '_id',\n\t})\n\tpublic reviews?: Ref<Review>[];\n}\n"]}
1
+ {"version":3,"file":"service-booking.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-booking.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA8E;AAC9E,6CAAoC;AACpC,iDAAwC;AACxC,kDAOiC;AACjC,6DAAoD;AACpD,6DAAmD;AACnD,4FAAiF;AACjF,sHAG+D;AAC/D,4EAAgF;AAChF,wBAAuD;AACvD,uEAA6D;AAC7D,0DAA6D;AAC7D,4DAAyD;AACzD,4EAAqE;AACrE,kHAAsG;AACtG,4HAAgH;AAChH,6DAAmD;AACnD,oDAAiD;AA4B1C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,OAAO,CAAU;IAGjB,IAAI,CAAa;IAGjB,MAAM,CAAe;IAGrB,YAAY,CAAqB;IAGjC,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,IAAI,CAAoB;IAGxB,WAAW,CAAuB;IAGlC,SAAS,CAAkB;IAG3B,MAAM,CAAwB;IAG9B,aAAa,CAAuB;IAGpC,uBAAuB,CAAqB;IAG5C,WAAW,CAAQ;IAGnB,QAAQ,CAAQ;IAGhB,SAAS,CAAQ;IAGjB,qBAAqB,CAAQ;IAG7B,4BAA4B,CAAU;IAGtC,WAAW,CAAQ;IAGnB,yBAAyB,CAAU;IAGnC,QAAQ,CAAW;IAGnB,QAAQ,CAAQ;IAGhB,OAAO,CAAyB;IAGhC,eAAe,CAAyB;IAGxC,mBAAmB,CAAqC;IAGxD,WAAW,CAAQ;IAGnB,oBAAoB,CAAW;IAG/B,sBAAsB,CAA6B;IAGnD,UAAU,CAAW;IAGrB,gBA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ChB,MAAM,KAAK,GAAG,IAAA,aAAK,GAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEvC,MAAM,OAAO,GAAG,MAAM,eAAY,CAAC,gBAAgB,CAClD,EAAE,WAAW,EAAE,kBAAW,CAAC,KAAK,EAAE,EAClC;gBACC;oBACC,IAAI,EAAE;wBACL,KAAK,EAAE;4BACN,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;yBAC/D;wBACD,KAAK,EAAE,KAAK;qBACZ;iBACD;aACD,EACD,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAC3B,CAAC;YAEF,IAAI,CAAC,OAAO,GAAG,GAAG,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QACvE,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,cAAc,CA+J1B","sourcesContent":["import { modelOptions, pre, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { User } from './user.model';\nimport { Vendor } from './vendor.model';\nimport {\n\tServiceBookingStatus,\n\tCounterType,\n\tServiceType,\n\tSubServiceType,\n\tAdjustmentStatus,\n\tOnlinePaymentStatus,\n} from '../../../utilities/enum';\nimport { Professional } from './professional.model';\nimport { ServiceCart } from './service-cart.model';\nimport { ServiceBookingFinance } from './embedded/service-booking-finance.model';\nimport {\n\tServiceBookingCancellationDetails,\n\tServiceBookingEndorseLoss,\n} from './embedded/service-booking-cancellation-details.model';\nimport { ServiceBookingStatusTimeline } from './embedded/status-timeline.model';\nimport { CounterModel, Review, VendorParent } from '.';\nimport { ServicePromotion } from './service-promotion.model';\nimport { RegularOrderAddress } from './shared/address.model';\nimport { OrderSlotRange } from './shared/duration.model';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceBookingRefundInformation } from './embedded/service-booking-refund-information.model';\nimport { ServiceBookingReplacementInformation } from './embedded/service-booking-replacement-information.model';\nimport { ServiceFlag } from './service-flag.model';\nimport { dayjs } from '../../../utilities/dayjs';\n@modelOptions({\n\tschemaOptions: { collection: 'serviceBookings', timestamps: true },\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@pre<ServiceBooking>('validate', async function (next) {\n\tif (this.isNew) {\n\t\tconst today = dayjs().format('DDMMYY');\n\n\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t{ counterType: CounterType.ORDER },\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t$cond: [{ $eq: ['$today', today] }, { $add: ['$value', 1] }, 1],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttoday: today,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ new: true, upsert: true }\n\t\t);\n\n\t\tthis.orderId = `${today}${counter.value.toString().padStart(6, '0')}`;\n\t}\n\tnext();\n})\nexport class ServiceBooking extends TimeStamps {\n\t@prop({ type: String, unique: true })\n\tpublic orderId?: string;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, ref: () => VendorParent })\n\tpublic vendorParent!: Ref<VendorParent>;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ required: true, ref: () => ServiceCart })\n\tpublic cart!: Ref<ServiceCart>;\n\n\t@prop({ required: true, type: () => RegularOrderAddress })\n\tpublic userAddress!: RegularOrderAddress;\n\n\t@prop({ required: true, type: OrderSlotRange, _id: false })\n\tpublic slotRange!: OrderSlotRange;\n\n\t@prop({ type: String, enum: ServiceBookingStatus, default: ServiceBookingStatus.PENDING })\n\tpublic status!: ServiceBookingStatus;\n\n\t@prop({ ref: () => Professional })\n\tpublic professionals?: Ref<Professional>[];\n\n\t@prop({ ref: () => Professional })\n\tpublic responsibleProfessional?: Ref<Professional>;\n\n\t@prop({ type: Date, default: new Date() })\n\tpublic processedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic placedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic startedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic estimatedCompletionAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic estimatedCompletionInMinutes?: number;\n\n\t@prop({ type: Date })\n\tpublic completedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic actualCompletionInMinutes?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isUrgent?: boolean;\n\n\t@prop({ type: Date })\n\tpublic urgentAt?: Date;\n\n\t@prop({ required: true, type: ServiceBookingFinance, _id: false })\n\tpublic finance!: ServiceBookingFinance;\n\n\t@prop({ required: true, type: ServiceBookingFinance, _id: false })\n\tpublic adjustedFinance!: ServiceBookingFinance;\n\n\t@prop({ type: () => ServiceBookingCancellationDetails, _id: false })\n\tpublic cancellationDetails?: ServiceBookingCancellationDetails;\n\n\t@prop({ type: Date })\n\tpublic cancelledAt?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isEndorseLossApplied?: boolean;\n\n\t@prop({ type: () => ServiceBookingEndorseLoss, _id: false })\n\tpublic endorseLossInformation?: ServiceBookingEndorseLoss;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isAdjusted?: boolean;\n\n\t@prop({ type: String, enum: AdjustmentStatus, default: AdjustmentStatus.NONE })\n\tpublic adjustmentStatus?: AdjustmentStatus;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isFlagged?: boolean;\n\n\t@prop({ type: Date })\n\tpublic flaggedAt?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRefunded?: boolean;\n\n\t@prop({ type: ServiceBookingRefundInformation, _id: false })\n\tpublic refundInformation?: ServiceBookingRefundInformation;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReplacement?: boolean;\n\n\t@prop({ type: () => ServiceBookingReplacementInformation, _id: false })\n\tpublic replacementInformation?: ServiceBookingReplacementInformation;\n\n\t@prop({ ref: () => ServiceBooking })\n\tpublic replacementBooking?: Ref<ServiceBooking>;\n\n\t@prop({ type: () => [ServiceBookingStatusTimeline], default: [] })\n\tpublic statusTimeline?: ServiceBookingStatusTimeline[];\n\n\t@prop({ type: Number })\n\tpublic bufferTime?: number; // minutes\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReviewed?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReviewNotificationSent?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLowRated?: boolean;\n\n\t@prop({ ref: () => ServicePromotion })\n\tpublic servicePromotions?: Ref<ServicePromotion>[];\n\n\t@prop({ type: Number })\n\tpublic maxDiscountPerOrder?: number | null;\n\n\t@prop({ type: String, enum: OnlinePaymentStatus })\n\tpublic onlinePaymentStatus?: OnlinePaymentStatus;\n\n\t@prop({ type: String })\n\tpublic specialInstructions?: string;\n\n\t@prop({ type: Date, default: null })\n\tpublic professionalStartNotificationSentAt?: Date;\n\n\t@prop({ type: Date, default: null })\n\tpublic professionalEndNotificationSentAt?: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLate?: boolean;\n\n\t// Virtual field\n\t@prop({\n\t\tref: () => ServiceFlag,\n\t\tforeignField: 'serviceBooking',\n\t\tlocalField: '_id',\n\t})\n\tpublic flags?: Ref<ServiceFlag>[];\n\n\t@prop({\n\t\tref: () => Review,\n\t\tforeignField: 'serviceBooking',\n\t\tlocalField: '_id',\n\t})\n\tpublic reviews?: Ref<Review>[];\n}\n"]}
@@ -1,8 +1,16 @@
1
- import { ServiceItemType } from '../../../utilities/enum';
1
+ import { ServiceFamilyType, ServiceType } from '../../../utilities/enum';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
+ import { ServiceControlProductConfig } from './embedded/service-control-product-config.model';
3
4
  export declare class ServiceControl extends TimeStamps {
4
5
  name: string;
5
- serviceItemType: ServiceItemType;
6
+ alias?: string;
7
+ serviceType: ServiceType;
8
+ serviceFamilyType?: ServiceFamilyType;
9
+ isCoffee?: boolean;
6
10
  isVisibleToUserApp: boolean;
11
+ isTagVisible?: boolean;
12
+ isListContainerVisible?: boolean;
13
+ productConfig?: ServiceControlProductConfig;
14
+ imageUrl?: string;
7
15
  sortingOrder?: number;
8
16
  }
@@ -15,10 +15,18 @@ const enum_1 = require("../../../utilities/enum");
15
15
  const typegoose_1 = require("@typegoose/typegoose");
16
16
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
17
17
  const sorting_order_hooks_1 = require("../utilities/sorting-order.hooks");
18
+ const service_control_product_config_model_1 = require("./embedded/service-control-product-config.model");
18
19
  let ServiceControl = class ServiceControl extends defaultClasses_1.TimeStamps {
19
20
  name;
20
- serviceItemType;
21
+ alias;
22
+ serviceType;
23
+ serviceFamilyType;
24
+ isCoffee;
21
25
  isVisibleToUserApp;
26
+ isTagVisible;
27
+ isListContainerVisible;
28
+ productConfig;
29
+ imageUrl;
22
30
  sortingOrder;
23
31
  };
24
32
  exports.ServiceControl = ServiceControl;
@@ -27,20 +35,48 @@ __decorate([
27
35
  __metadata("design:type", String)
28
36
  ], ServiceControl.prototype, "name", void 0);
29
37
  __decorate([
30
- (0, typegoose_1.prop)({ required: true, enum: enum_1.ServiceItemType }),
38
+ (0, typegoose_1.prop)({ type: String }),
31
39
  __metadata("design:type", String)
32
- ], ServiceControl.prototype, "serviceItemType", void 0);
40
+ ], ServiceControl.prototype, "alias", void 0);
41
+ __decorate([
42
+ (0, typegoose_1.prop)({ required: true, enum: enum_1.ServiceType }),
43
+ __metadata("design:type", String)
44
+ ], ServiceControl.prototype, "serviceType", void 0);
45
+ __decorate([
46
+ (0, typegoose_1.prop)({ enum: enum_1.ServiceFamilyType }),
47
+ __metadata("design:type", String)
48
+ ], ServiceControl.prototype, "serviceFamilyType", void 0);
49
+ __decorate([
50
+ (0, typegoose_1.prop)({ type: Boolean }),
51
+ __metadata("design:type", Boolean)
52
+ ], ServiceControl.prototype, "isCoffee", void 0);
33
53
  __decorate([
34
54
  (0, typegoose_1.prop)({ required: true, type: Boolean }),
35
55
  __metadata("design:type", Boolean)
36
56
  ], ServiceControl.prototype, "isVisibleToUserApp", void 0);
57
+ __decorate([
58
+ (0, typegoose_1.prop)({ type: Boolean }),
59
+ __metadata("design:type", Boolean)
60
+ ], ServiceControl.prototype, "isTagVisible", void 0);
61
+ __decorate([
62
+ (0, typegoose_1.prop)({ type: Boolean }),
63
+ __metadata("design:type", Boolean)
64
+ ], ServiceControl.prototype, "isListContainerVisible", void 0);
65
+ __decorate([
66
+ (0, typegoose_1.prop)({ type: service_control_product_config_model_1.ServiceControlProductConfig }),
67
+ __metadata("design:type", service_control_product_config_model_1.ServiceControlProductConfig)
68
+ ], ServiceControl.prototype, "productConfig", void 0);
69
+ __decorate([
70
+ (0, typegoose_1.prop)({ type: String }),
71
+ __metadata("design:type", String)
72
+ ], ServiceControl.prototype, "imageUrl", void 0);
37
73
  __decorate([
38
74
  (0, typegoose_1.prop)({ type: Number }),
39
75
  __metadata("design:type", Number)
40
76
  ], ServiceControl.prototype, "sortingOrder", void 0);
41
77
  exports.ServiceControl = ServiceControl = __decorate([
42
78
  (0, typegoose_1.Index)({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
43
- (0, typegoose_1.Index)({ serviceItemType: 1, sortingOrder: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
79
+ (0, typegoose_1.Index)({ sortingOrder: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
44
80
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'service-control' } }),
45
81
  (0, typegoose_1.pre)('save', async function (next) {
46
82
  await sorting_order_hooks_1.handlePreSaveForSorting.call(this, _1.ServiceControlModel);
@@ -1 +1 @@
1
- {"version":3,"file":"service-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wBAAwC;AACxC,kDAAoE;AACpE,oDAAsE;AACtE,4EAAqE;AACrE,0EAA2E;AAcpE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGd,eAAe,CAAmB;IAGlC,kBAAkB,CAAW;IAG7B,YAAY,CAAU;CAC7B,CAAA;AAZY,wCAAc;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,sBAAe,EAAE,CAAC;;uDACP;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DACJ;AAG7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACM;yBAXjB,cAAc;IAZ1B,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAClF,IAAA,iBAAK,EACL,EAAE,eAAe,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,EACvC,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC9D;IACA,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,CAAC;IAClE,IAAA,eAAG,EAAiB,MAAM,EAAE,KAAK,WAAW,IAAI;QAEhD,MAAM,6CAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,sBAAmB,CAAC,CAAC;QAE9D,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,cAAc,CAY1B","sourcesContent":["import { ServiceControlModel } from '.';\nimport { ItemType, ServiceItemType } from '../../../utilities/enum';\nimport { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { handlePreSaveForSorting } from '../utilities/sorting-order.hooks';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n\t{ serviceItemType: 1, sortingOrder: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@modelOptions({ schemaOptions: { collection: 'service-control' } })\n@pre<ServiceControl>('save', async function (next) {\n\t// Set sortingOrder\n\tawait handlePreSaveForSorting.call(this, ServiceControlModel);\n\n\tnext();\n})\nexport class ServiceControl extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, enum: ServiceItemType })\n\tpublic serviceItemType!: ServiceItemType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUserApp!: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
1
+ {"version":3,"file":"service-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wBAAwC;AACxC,kDAAyE;AACzE,oDAAsE;AACtE,4EAAqE;AACrE,0EAA2E;AAC3E,0GAA8F;AAWvF,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,WAAW,CAAe;IAG1B,iBAAiB,CAAqB;IAGtC,QAAQ,CAAW;IAGnB,kBAAkB,CAAW;IAG7B,YAAY,CAAW;IAGvB,sBAAsB,CAAW;IAGjC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,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAC1F,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,CAAC;IAClE,IAAA,eAAG,EAAiB,MAAM,EAAE,KAAK,WAAW,IAAI;QAEhD,MAAM,6CAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,sBAAmB,CAAC,CAAC;QAE9D,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,cAAc,CAiC1B","sourcesContent":["import { ServiceControlModel } from '.';\nimport { ServiceFamilyType, ServiceType } from '../../../utilities/enum';\nimport { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { handlePreSaveForSorting } from '../utilities/sorting-order.hooks';\nimport { ServiceControlProductConfig } from './embedded/service-control-product-config.model';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ sortingOrder: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@modelOptions({ schemaOptions: { collection: 'service-control' } })\n@pre<ServiceControl>('save', async function (next) {\n\t// Set sortingOrder\n\tawait handlePreSaveForSorting.call(this, ServiceControlModel);\n\n\tnext();\n})\nexport class ServiceControl extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic alias?: string;\n\n\t@prop({ required: true, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ enum: ServiceFamilyType })\n\tpublic serviceFamilyType?: ServiceFamilyType;\n\n\t@prop({ type: Boolean })\n\tpublic isCoffee?: boolean;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUserApp!: boolean;\n\n\t@prop({ type: Boolean })\n\tpublic isTagVisible?: boolean;\n\n\t@prop({ type: Boolean })\n\tpublic isListContainerVisible?: boolean;\n\n\t@prop({ type: ServiceControlProductConfig })\n\tpublic productConfig?: ServiceControlProductConfig;\n\n\t@prop({ type: String })\n\tpublic imageUrl?: string;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -5,10 +5,10 @@ interface AuthOptions {
5
5
  autoRefresh?: boolean;
6
6
  }
7
7
  export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
8
+ requestId: string | undefined;
9
+ entity: import("../context").EntityContext | undefined;
8
10
  req: import("http").IncomingMessage;
9
11
  res: import("http").ServerResponse<import("http").IncomingMessage>;
10
- entity: import("../context").EntityContext | undefined;
11
- requestId: string | undefined;
12
12
  tokenType: TokenType | undefined;
13
13
  usedRefreshToken: boolean | undefined;
14
14
  tokenRenewed: boolean | undefined;
@@ -7,7 +7,6 @@ const auth_1 = require("../../auth");
7
7
  const models_1 = require("../../mongo/models");
8
8
  const enum_1 = require("../../../utilities/enum");
9
9
  const error_common_1 = require("../../../utilities/error-common");
10
- const presence_1 = require("../../socket/connections/presence");
11
10
  function createAuthenticatedProcedure(options) {
12
11
  const { entityTypes, allowRefreshToken = true, autoRefresh = true } = options;
13
12
  return index_1.publicProcedure.use(async ({ ctx, next }) => {
@@ -75,7 +74,6 @@ function createAuthenticatedProcedure(options) {
75
74
  else {
76
75
  (0, error_common_1.unauthorizedError)('You have been logged out, Please login in again');
77
76
  }
78
- (0, presence_1.setUserOnline)(rider._id.toString(), auth_1.AuthEntityType.DELIVERY_BOY);
79
77
  }
80
78
  if (entity) {
81
79
  ctx.entity = entity;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/auth.ts"],"names":[],"mappings":";;AA0BA,oEAoIC;AA9JD,yCAAyC;AACzC,oCAA2C;AAC3C,qCAA8F;AAC9F,+CAO4B;AAC5B,kDAAiD;AACjD,kEAAoE;AAEpE,gEAAkE;AAYlE,SAAgB,4BAA4B,CAAC,OA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AI,CAAC;QAE5B,GAAG,CAAC,YAAY,GAAG,aAAa,CAAC,WAAW,KAAK,SAAS,CAAC;QAE3D,IAAI,WAAW,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;YAC5C,IAAI,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,oBAAoB,EAAE,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;YAC9E,CAAC;YAED,IAAI,aAAa,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;gBAC1C,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,qBAAqB,EAAE,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAChF,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\nimport { publicProcedure } from '../index';\nimport { AuthEntityType, handleTokenRenewal, TokenType, verifyAccessToken } from '../../auth';\nimport {\n\tAdminModel,\n\tgetCoreUserModel,\n\tParentModel,\n\tRiderModel,\n\tShopAccessControlModel,\n\tShopModel,\n} from '../../mongo/models';\nimport { Status } from '../../../utilities/enum';\nimport { unauthorizedError } from '../../../utilities/error-common';\nimport { getLibraries } from '../../..';\nimport { setUserOnline } from '../../socket/connections/presence';\n\ninterface AuthOptions {\n\tentityTypes: AuthEntityType[];\n\tallowRefreshToken?: boolean;\n\tautoRefresh?: boolean;\n}\n\n/**\n * A factory that creates an authenticated procedure, optionally allowing\n * refresh tokens and auto-refreshing expired access tokens.\n */\nexport function createAuthenticatedProcedure(options: AuthOptions) {\n\tconst { entityTypes, allowRefreshToken = true, autoRefresh = true } = options;\n\n\treturn publicProcedure.use(async ({ ctx, next }) => {\n\t\tconst authHeader = ctx.req.headers['authorization'];\n\t\tconst refreshTokenHeader = ctx.req.headers['x-refresh-token'];\n\n\t\tif (!authHeader) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'No authorization header' });\n\t\t}\n\n\t\tconst accessToken = authHeader.replace(/^Bearer\\s+/, '');\n\t\tlet refreshToken = '';\n\n\t\tif (refreshTokenHeader) {\n\t\t\trefreshToken =\n\t\t\t\ttypeof refreshTokenHeader === 'string'\n\t\t\t\t\t? refreshTokenHeader.replace(/^Bearer\\s+/, '')\n\t\t\t\t\t: refreshTokenHeader[0].replace(/^Bearer\\s+/, '');\n\t\t}\n\n\t\tif (!accessToken) unauthorizedError('Missing access token');\n\n\t\tlet entity = await verifyAccessToken(entityTypes, accessToken);\n\n\t\tif (entity?.type == AuthEntityType.USER) {\n\t\t\tconst user = await getCoreUserModel().findOne({ _id: entity.parameters.coreUserId });\n\n\t\t\tif (!user) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'User not found' });\n\t\t\tif (user.status !== Status.ACTIVE) unauthorizedError('User is not active');\n\t\t}\n\n\t\tif (entity?.type == AuthEntityType.CRM) {\n\t\t\tconst admin = await AdminModel.findOne({ _id: entity.parameters.adminId });\n\n\t\t\tif (!admin) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Admin not found' });\n\t\t\tif (admin.status !== Status.ACTIVE) unauthorizedError('Admin is not active');\n\t\t}\n\n\t\t// Seller\n\t\tif (entity?.type == AuthEntityType.SELLER) {\n\t\t\tconst shopAccessControlModel = await ShopAccessControlModel.findOne({ _id: entity.id });\n\t\t\tif (!shopAccessControlModel) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Seller not found' });\n\n\t\t\t// For Parent\n\t\t\tif (['parent', 'parent_manager', 'parent_order_manager'].includes(shopAccessControlModel.role)) {\n\t\t\t\tconst parent = await ParentModel.findOne({ _id: shopAccessControlModel.parent });\n\n\t\t\t\tif (!parent) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Seller not found' });\n\t\t\t\tif (parent.status !== Status.ACTIVE) unauthorizedError('Seller is not active');\n\t\t\t}\n\n\t\t\t// For Shop\n\t\t\tconst shops = shopAccessControlModel.shops ?? [];\n\n\t\t\tif (\n\t\t\t\tshops.length > 0 &&\n\t\t\t\t['shop', 'shop_manager', 'shop_order_manager'].includes(shopAccessControlModel.role)\n\t\t\t) {\n\t\t\t\tconst shopId = shops[0];\n\t\t\t\tconst shop = await ShopModel.findOne({ _id: shopId });\n\n\t\t\t\tif (!shop) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Seller not found' });\n\t\t\t\tif (shop.status !== Status.ACTIVE) unauthorizedError('Seller is not active');\n\t\t\t}\n\t\t}\n\n\t\t// For rider\n\t\tif (entity?.type == AuthEntityType.DELIVERY_BOY) {\n\t\t\tconst rider = await RiderModel.findOne({ _id: entity.id });\n\n\t\t\t// Check the rider exists or not\n\t\t\tif (!rider) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Admin not found' });\n\n\t\t\t// Check the rider isLogin true or false\n\t\t\tif (rider.isLogin) {\n\t\t\t\tif (rider.lastLoginDeviceId !== entity.parameters.deviceId) {\n\t\t\t\t\tunauthorizedError('You already logged in another device');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunauthorizedError('You have been logged out, Please login in again');\n\t\t\t}\n\n\t\t\t// set rider as connected\n\t\t\t// const redis = getLibraries().getRedisService();\n\t\t\t// const key = `connectedRiders:${rider._id.toString()}`;\n\t\t\t// const expiryInSeconds = 5 * 60;\n\t\t\t// await redis.cacheObject(key, { updatedAt: new Date() }, expiryInSeconds);\n\n\t\t\tsetUserOnline(rider._id.toString(), AuthEntityType.DELIVERY_BOY)\n\t\t}\n\n\t\tif (entity) {\n\t\t\tctx.entity = entity;\n\t\t\tctx.tokenType = TokenType.ACCESS;\n\t\t\tctx.usedRefreshToken = false;\n\t\t\tctx.tokenRenewed = false;\n\n\t\t\treturn next({ ctx });\n\t\t}\n\n\t\tif (!allowRefreshToken || !refreshToken) unauthorizedError('Invalid access token');\n\n\t\tconst renewalResult = await handleTokenRenewal(refreshToken);\n\n\t\tif (!renewalResult.success) {\n\t\t\tconst errorMessage =\n\t\t\t\trenewalResult.tokenStatus === 'revoked' ? 'Refresh token has been revoked' : 'Invalid refresh token';\n\n\t\t\tunauthorizedError(errorMessage);\n\t\t}\n\n\t\tif (!entityTypes.includes(renewalResult.entity!.type)) unauthorizedError('Unauthorized entity type');\n\n\t\tctx.entity = renewalResult.entity;\n\t\tctx.tokenType = TokenType.REFRESH;\n\t\tctx.usedRefreshToken = true;\n\n\t\tctx.tokenRenewed = renewalResult.tokenStatus === 'expired';\n\n\t\tif (autoRefresh && renewalResult.newTokens) {\n\t\t\tif (renewalResult.newTokens.accessToken) {\n\t\t\t\tctx.res.setHeader('X-New-Access-Token', renewalResult.newTokens.accessToken);\n\t\t\t}\n\n\t\t\tif (renewalResult.newTokens.refreshToken) {\n\t\t\t\tctx.res.setHeader('X-New-Refresh-Token', renewalResult.newTokens.refreshToken);\n\t\t\t}\n\t\t}\n\n\t\treturn next({ ctx });\n\t});\n}\n"]}
1
+ {"version":3,"file":"auth.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/auth.ts"],"names":[],"mappings":";;AAwBA,oEA4HC;AApJD,yCAAyC;AACzC,oCAA2C;AAC3C,qCAA+F;AAC/F,+CAO4B;AAC5B,kDAAiD;AACjD,kEAAoE;AAYpE,SAAgB,4BAA4B,CAAC,OAAoB;IAChE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAE9E,OAAO,uBAAe,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;QAClD,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACpD,MAAM,kBAAkB,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAE9D,IAAI,CAAC,UAAU,EAAE,CAAC;YACjB,MAAM,I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AG,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\nimport { publicProcedure } from '../index';\nimport { AuthEntityType, handleTokenRenewal, TokenType, verifyAccessToken, } from '../../auth';\nimport {\n\tAdminModel,\n\tgetCoreUserModel,\n\tParentModel,\n\tRiderModel,\n\tShopAccessControlModel,\n\tShopModel,\n} from '../../mongo/models';\nimport { Status } from '../../../utilities/enum';\nimport { unauthorizedError } from '../../../utilities/error-common';\n\ninterface AuthOptions {\n\tentityTypes: AuthEntityType[];\n\tallowRefreshToken?: boolean;\n\tautoRefresh?: boolean;\n}\n\n/**\n * A factory that creates an authenticated procedure, optionally allowing\n * refresh tokens and auto-refreshing expired access tokens.\n */\nexport function createAuthenticatedProcedure(options: AuthOptions) {\n\tconst { entityTypes, allowRefreshToken = true, autoRefresh = true } = options;\n\n\treturn publicProcedure.use(async ({ ctx, next }) => {\n\t\tconst authHeader = ctx.req.headers['authorization'];\n\t\tconst refreshTokenHeader = ctx.req.headers['x-refresh-token'];\n\n\t\tif (!authHeader) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'No authorization header' });\n\t\t}\n\n\t\tconst accessToken = authHeader.replace(/^Bearer\\s+/, '');\n\t\tlet refreshToken = '';\n\n\t\tif (refreshTokenHeader) {\n\t\t\trefreshToken =\n\t\t\t\ttypeof refreshTokenHeader === 'string'\n\t\t\t\t\t? refreshTokenHeader.replace(/^Bearer\\s+/, '')\n\t\t\t\t\t: refreshTokenHeader[0].replace(/^Bearer\\s+/, '');\n\t\t}\n\n\t\tif (!accessToken) unauthorizedError('Missing access token');\n\n\t\tlet entity = await verifyAccessToken(entityTypes, accessToken);\n\n\t\tif (entity?.type == AuthEntityType.USER) {\n\t\t\tconst user = await getCoreUserModel().findOne({ _id: entity.parameters.coreUserId });\n\n\t\t\tif (!user) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'User not found' });\n\t\t\tif (user.status !== Status.ACTIVE) unauthorizedError('User is not active');\n\t\t}\n\n\t\tif (entity?.type == AuthEntityType.CRM) {\n\t\t\tconst admin = await AdminModel.findOne({ _id: entity.parameters.adminId });\n\n\t\t\tif (!admin) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Admin not found' });\n\t\t\tif (admin.status !== Status.ACTIVE) unauthorizedError('Admin is not active');\n\t\t}\n\n\t\t// Seller\n\t\tif (entity?.type == AuthEntityType.SELLER) {\n\t\t\tconst shopAccessControlModel = await ShopAccessControlModel.findOne({ _id: entity.id });\n\t\t\tif (!shopAccessControlModel) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Seller not found' });\n\n\t\t\t// For Parent\n\t\t\tif (['parent', 'parent_manager', 'parent_order_manager'].includes(shopAccessControlModel.role)) {\n\t\t\t\tconst parent = await ParentModel.findOne({ _id: shopAccessControlModel.parent });\n\n\t\t\t\tif (!parent) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Seller not found' });\n\t\t\t\tif (parent.status !== Status.ACTIVE) unauthorizedError('Seller is not active');\n\t\t\t}\n\n\t\t\t// For Shop\n\t\t\tconst shops = shopAccessControlModel.shops ?? [];\n\n\t\t\tif (\n\t\t\t\tshops.length > 0 &&\n\t\t\t\t['shop', 'shop_manager', 'shop_order_manager'].includes(shopAccessControlModel.role)\n\t\t\t) {\n\t\t\t\tconst shopId = shops[0];\n\t\t\t\tconst shop = await ShopModel.findOne({ _id: shopId });\n\n\t\t\t\tif (!shop) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Seller not found' });\n\t\t\t\tif (shop.status !== Status.ACTIVE) unauthorizedError('Seller is not active');\n\t\t\t}\n\t\t}\n\n\t\t// For rider\n\t\tif (entity?.type == AuthEntityType.DELIVERY_BOY) {\n\t\t\tconst rider = await RiderModel.findOne({ _id: entity.id });\n\n\t\t\t// Check the rider exists or not\n\t\t\tif (!rider) throw new TRPCError({ code: 'UNAUTHORIZED', message: 'Admin not found' });\n\n\t\t\t// Check the rider isLogin true or false\n\t\t\tif (rider.isLogin) {\n\t\t\t\tif (rider.lastLoginDeviceId !== entity.parameters.deviceId) {\n\t\t\t\t\tunauthorizedError('You already logged in another device');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunauthorizedError('You have been logged out, Please login in again');\n\t\t\t}\n\t\t}\n\n\t\tif (entity) {\n\t\t\tctx.entity = entity;\n\t\t\tctx.tokenType = TokenType.ACCESS;\n\t\t\tctx.usedRefreshToken = false;\n\t\t\tctx.tokenRenewed = false;\n\n\t\t\treturn next({ ctx });\n\t\t}\n\n\t\tif (!allowRefreshToken || !refreshToken) unauthorizedError('Invalid access token');\n\n\t\tconst renewalResult = await handleTokenRenewal(refreshToken);\n\n\t\tif (!renewalResult.success) {\n\t\t\tconst errorMessage =\n\t\t\t\trenewalResult.tokenStatus === 'revoked' ? 'Refresh token has been revoked' : 'Invalid refresh token';\n\n\t\t\tunauthorizedError(errorMessage);\n\t\t}\n\n\t\tif (!entityTypes.includes(renewalResult.entity!.type)) unauthorizedError('Unauthorized entity type');\n\n\t\tctx.entity = renewalResult.entity;\n\t\tctx.tokenType = TokenType.REFRESH;\n\t\tctx.usedRefreshToken = true;\n\n\t\tctx.tokenRenewed = renewalResult.tokenStatus === 'expired';\n\n\t\tif (autoRefresh && renewalResult.newTokens) {\n\t\t\tif (renewalResult.newTokens.accessToken) {\n\t\t\t\tctx.res.setHeader('X-New-Access-Token', renewalResult.newTokens.accessToken);\n\t\t\t}\n\n\t\t\tif (renewalResult.newTokens.refreshToken) {\n\t\t\t\tctx.res.setHeader('X-New-Refresh-Token', renewalResult.newTokens.refreshToken);\n\t\t\t}\n\t\t}\n\n\t\treturn next({ ctx });\n\t});\n}\n"]}
@@ -4,10 +4,10 @@ interface RoleProtectedOptions {
4
4
  allowedRoles: string[];
5
5
  }
6
6
  export declare function createRoleProtectedProcedure(options: RoleProtectedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
7
+ requestId: string | undefined;
8
+ entity: import("../context").EntityContext | undefined;
7
9
  req: import("http").IncomingMessage;
8
10
  res: import("http").ServerResponse<import("http").IncomingMessage>;
9
- entity: import("../context").EntityContext | undefined;
10
- requestId: string | undefined;
11
11
  tokenType: import("../../auth").TokenType | undefined;
12
12
  usedRefreshToken: boolean | undefined;
13
13
  tokenRenewed: boolean | undefined;
@@ -3,10 +3,10 @@ interface PhoneVerifiedOptions {
3
3
  entityTypes: AuthEntityType[];
4
4
  }
5
5
  export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
6
+ requestId: string | undefined;
7
+ entity: import("../context").EntityContext | undefined;
6
8
  req: import("http").IncomingMessage;
7
9
  res: import("http").ServerResponse<import("http").IncomingMessage>;
8
- entity: import("../context").EntityContext | undefined;
9
- requestId: string | undefined;
10
10
  tokenType: import("../../auth").TokenType | undefined;
11
11
  usedRefreshToken: boolean | undefined;
12
12
  tokenRenewed: boolean | undefined;
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.4.305-alpha.1
25
+ Version: 1.4.306-alpha
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.4.305-alpha.1",
3
+ "version": "1.4.306-alpha",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -54,6 +54,15 @@ export declare enum ServiceItemType {
54
54
  ELECTRONICS = "electronics",
55
55
  BEAUTY = "beauty"
56
56
  }
57
+ export declare enum ServiceType {
58
+ REGULAR = "regular",
59
+ SERVICE = "service",
60
+ COURIER = "courier"
61
+ }
62
+ export declare enum ServiceFamilyType {
63
+ FOOD = "food",
64
+ GROCERY = "grocery"
65
+ }
57
66
  export declare enum AdjustmentStatus {
58
67
  NONE = "none",
59
68
  PENDING = "pending",
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.VendorRole = exports.ShopRole = exports.OnlineStatus = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.ShopDietaryType = exports.PriceOption = exports.ProductBrandType = exports.ProductType = exports.CoreAuthIdentityType = exports.ShopSectionMode = exports.UserAppSectionItemType = exports.UserAppSectionType = exports.AdminLogsUpdatedFieldsType = exports.UpdatedField = exports.GeoLocationType = exports.RatingAccountType = exports.SubscriptionStatus = exports.SubscriptionPackage = exports.PaidCurrency = exports.PaymentStatus = exports.ChangeReturnMethod = exports.PaymentMethod = exports.SpendToGetRewardType = exports.ValueType = exports.HolidayWorkStatus = exports.WorkStatus = exports.WeekDay = exports.GlobalItemType = exports.AdjustmentStatus = exports.ServiceItemType = exports.ItemType = exports.Status = exports.AppPlatform = exports.AccountType = exports.AgentLiveStatus = exports.AuthEntityType = void 0;
4
- exports.SettlementType = exports.MediaType = exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.TripLegStatus = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.UserActionReason = exports.UserActionType = exports.ShopCourierOrderStatus = exports.ServiceBookingStatus = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.AdjustmentType = exports.ServiceBookingStatusTimelineType = exports.StatusTimelineType = exports.DeliveryChargeType = exports.OrderType = exports.Language = exports.OrderSize = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.RiderCashEventTag = exports.RiderCashLimitReason = exports.RiderAvailability = exports.LiveStatus = exports.PaymentIntentStatus = exports.CardStatus = exports.CardUserType = exports.PaymentProvider = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.LimitedTimeOfferCampaignStatus = exports.AdminRole = exports.PunchMarketingStatus = exports.MarketingCampaignType = exports.MarketingStatus = exports.ServiceMarketingType = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobChannelType = exports.BobModel = void 0;
5
- exports.GroupCartNotificationStatus = exports.Currency = exports.RequestFrom = exports.UploadState = exports.SubServiceType = exports.ServiceType = exports.ActionType = exports.DeviceType = exports.PushNotificationEventType = exports.SocketEventType = exports.SocketServiceQueue = exports.OtpMethodType = exports.ReviewType = exports.FoodNutritionType = exports.AdjustmentReason = exports.UrgentOrderReasons = exports.ServiceFlagReasonType = exports.ServiceFlagType = exports.FlagReasonType = exports.FlagType = exports.PromotionType = exports.ServiceBookingCanceledBy = exports.TRPCErrorEnum = exports.ShopFilterSortByEnum = exports.BookingStatus = exports.ProfessionalScheduleType = exports.ServiceBookingRecurrencePattern = exports.ProfessionalRecurrencePattern = exports.ServiceBookingPriority = exports.ProfessionalStatus = exports.Service = exports.ServiceLineItemType = exports.ServiceCartStatus = exports.ChatroomType = exports.UserRef = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.OrderCanceledBy = exports.LogUser = exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = void 0;
6
- exports.DefaultCategoryType = exports.TranslatedLanguage = exports.TimeUnit = exports.CancellationReschedulingFeeType = exports.CartType = exports.TournamentParticipantStatus = exports.TournamentMatchStatus = exports.TournamentScheduledNotificationTarget = exports.TournamentNotificationTag = exports.TournamentProvider = exports.TournamentRewardType = exports.OnlinePaymentStatus = exports.BarcodeTypes = exports.RiderScoreEventTag = exports.WhishPaymentType = exports.AreebaPaymentType = exports.HttpStatus = exports.LogTag = exports.LogLevel = exports.SyncCacheEnumType = exports.DateFormatType = exports.AppAppearanceType = exports.GraphType = exports.CalendarEventType = exports.CalendarViewType = exports.LyxaTimeZoneEnum = exports.UserOrderCompletionScope = void 0;
3
+ exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.VendorRole = exports.ShopRole = exports.OnlineStatus = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.ShopDietaryType = exports.PriceOption = exports.ProductBrandType = exports.ProductType = exports.CoreAuthIdentityType = exports.ShopSectionMode = exports.UserAppSectionItemType = exports.UserAppSectionType = exports.AdminLogsUpdatedFieldsType = exports.UpdatedField = exports.GeoLocationType = exports.RatingAccountType = exports.SubscriptionStatus = exports.SubscriptionPackage = exports.PaidCurrency = exports.PaymentStatus = exports.ChangeReturnMethod = exports.PaymentMethod = exports.SpendToGetRewardType = exports.ValueType = exports.HolidayWorkStatus = exports.WorkStatus = exports.WeekDay = exports.GlobalItemType = exports.AdjustmentStatus = exports.ServiceFamilyType = exports.ServiceType = exports.ServiceItemType = exports.ItemType = exports.Status = exports.AppPlatform = exports.AccountType = exports.AgentLiveStatus = exports.AuthEntityType = void 0;
4
+ exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.TripLegStatus = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.UserActionReason = exports.UserActionType = exports.ShopCourierOrderStatus = exports.ServiceBookingStatus = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.AdjustmentType = exports.ServiceBookingStatusTimelineType = exports.StatusTimelineType = exports.DeliveryChargeType = exports.OrderType = exports.Language = exports.OrderSize = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.RiderCashEventTag = exports.RiderCashLimitReason = exports.RiderAvailability = exports.LiveStatus = exports.PaymentIntentStatus = exports.CardStatus = exports.CardUserType = exports.PaymentProvider = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.LimitedTimeOfferCampaignStatus = exports.AdminRole = exports.PunchMarketingStatus = exports.MarketingCampaignType = exports.MarketingStatus = exports.ServiceMarketingType = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobChannelType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = void 0;
5
+ exports.Currency = exports.RequestFrom = exports.UploadState = exports.SubServiceType = exports.ActionType = exports.DeviceType = exports.PushNotificationEventType = exports.SocketEventType = exports.SocketServiceQueue = exports.OtpMethodType = exports.ReviewType = exports.FoodNutritionType = exports.AdjustmentReason = exports.UrgentOrderReasons = exports.ServiceFlagReasonType = exports.ServiceFlagType = exports.FlagReasonType = exports.FlagType = exports.PromotionType = exports.ServiceBookingCanceledBy = exports.TRPCErrorEnum = exports.ShopFilterSortByEnum = exports.BookingStatus = exports.ProfessionalScheduleType = exports.ServiceBookingRecurrencePattern = exports.ProfessionalRecurrencePattern = exports.ServiceBookingPriority = exports.ProfessionalStatus = exports.Service = exports.ServiceLineItemType = exports.ServiceCartStatus = exports.ChatroomType = exports.UserRef = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.OrderCanceledBy = exports.LogUser = exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = exports.SettlementType = exports.MediaType = void 0;
6
+ exports.DefaultCategoryType = exports.TranslatedLanguage = exports.TimeUnit = exports.CancellationReschedulingFeeType = exports.CartType = exports.TournamentParticipantStatus = exports.TournamentMatchStatus = exports.TournamentScheduledNotificationTarget = exports.TournamentNotificationTag = exports.TournamentProvider = exports.TournamentRewardType = exports.OnlinePaymentStatus = exports.BarcodeTypes = exports.RiderScoreEventTag = exports.WhishPaymentType = exports.AreebaPaymentType = exports.HttpStatus = exports.LogTag = exports.LogLevel = exports.SyncCacheEnumType = exports.DateFormatType = exports.AppAppearanceType = exports.GraphType = exports.CalendarEventType = exports.CalendarViewType = exports.LyxaTimeZoneEnum = exports.UserOrderCompletionScope = exports.GroupCartNotificationStatus = void 0;
7
7
  var AuthEntityType;
8
8
  (function (AuthEntityType) {
9
9
  AuthEntityType["USER"] = "USER";
@@ -67,6 +67,17 @@ var ServiceItemType;
67
67
  ServiceItemType["ELECTRONICS"] = "electronics";
68
68
  ServiceItemType["BEAUTY"] = "beauty";
69
69
  })(ServiceItemType || (exports.ServiceItemType = ServiceItemType = {}));
70
+ var ServiceType;
71
+ (function (ServiceType) {
72
+ ServiceType["REGULAR"] = "regular";
73
+ ServiceType["SERVICE"] = "service";
74
+ ServiceType["COURIER"] = "courier";
75
+ })(ServiceType || (exports.ServiceType = ServiceType = {}));
76
+ var ServiceFamilyType;
77
+ (function (ServiceFamilyType) {
78
+ ServiceFamilyType["FOOD"] = "food";
79
+ ServiceFamilyType["GROCERY"] = "grocery";
80
+ })(ServiceFamilyType || (exports.ServiceFamilyType = ServiceFamilyType = {}));
70
81
  var AdjustmentStatus;
71
82
  (function (AdjustmentStatus) {
72
83
  AdjustmentStatus["NONE"] = "none";
@@ -1178,7 +1189,6 @@ var ActionType;
1178
1189
  ActionType["ADD"] = "add";
1179
1190
  ActionType["REMOVE"] = "remove";
1180
1191
  })(ActionType || (exports.ActionType = ActionType = {}));
1181
- var ServiceType;
1182
1192
  (function (ServiceType) {
1183
1193
  ServiceType["CLEANING"] = "cleaning";
1184
1194
  ServiceType["LAUNDRY"] = "laundry";