@lyxa.ai/core 1.0.122-test → 1.0.122
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.
- package/dist/libraries/event/EventEnums.d.ts +3 -0
- package/dist/libraries/event/EventEnums.js +8 -0
- package/dist/libraries/event/EventEnums.js.map +1 -0
- package/dist/libraries/event/events/admin-logs-event.d.ts +25 -0
- package/dist/libraries/event/events/admin-logs-event.js +23 -0
- package/dist/libraries/event/events/admin-logs-event.js.map +1 -0
- package/dist/libraries/mongo/models/activity-log.model.d.ts +2 -2
- package/dist/libraries/mongo/models/activity-log.model.js +2 -2
- package/dist/libraries/mongo/models/activity-log.model.js.map +1 -1
- package/dist/libraries/mongo/models/agent-performance.model.js +0 -1
- package/dist/libraries/mongo/models/agent-performance.model.js.map +1 -1
- package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +9 -0
- package/dist/libraries/mongo/models/app-screen-setting.model.js +72 -0
- package/dist/libraries/mongo/models/app-screen-setting.model.js.map +1 -0
- package/dist/libraries/mongo/models/attribute.model.js +2 -2
- package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js +2 -2
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/replacement-order.model.d.ts +3 -3
- package/dist/libraries/mongo/models/embedded/replacement-order.model.js +6 -6
- package/dist/libraries/mongo/models/embedded/replacement-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/filter-container.model.d.ts +1 -0
- package/dist/libraries/mongo/models/filter-container.model.js +5 -0
- package/dist/libraries/mongo/models/filter-container.model.js.map +1 -1
- package/dist/libraries/mongo/models/list-container.model.d.ts +1 -0
- package/dist/libraries/mongo/models/list-container.model.js +5 -0
- package/dist/libraries/mongo/models/list-container.model.js.map +1 -1
- package/dist/libraries/mongo/models/order-payment.model.d.ts +17 -0
- package/dist/libraries/mongo/models/order-payment.model.js +84 -0
- package/dist/libraries/mongo/models/order-payment.model.js.map +1 -0
- package/dist/libraries/mongo/models/product.model.d.ts +1 -2
- package/dist/libraries/mongo/models/product.model.js +10 -19
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/regular-order.model.d.ts +1 -0
- package/dist/libraries/mongo/models/providers/regular-order.model.js +5 -0
- package/dist/libraries/mongo/models/providers/regular-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/ticket.model.js +0 -1
- package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
- package/dist/libraries/trpc/middlewares/auth.js +0 -1
- package/dist/libraries/trpc/middlewares/auth.js.map +1 -1
- package/dist/utilities/common/logs-common-methods.d.ts +15 -0
- package/dist/utilities/common/logs-common-methods.js +33 -0
- package/dist/utilities/common/logs-common-methods.js.map +1 -0
- package/dist/utilities/enum.d.ts +57 -0
- package/dist/utilities/enum.js +60 -2
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/validation/common-validation.d.ts +13 -225
- package/dist/utilities/validation/common-validation.js +4 -3
- package/dist/utilities/validation/common-validation.js.map +1 -1
- package/package.json +1 -1
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.d.ts +0 -16
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js +0 -61
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-payment.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-payment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,+CAAsC;AACtC,kDAAuE;AACvE,oFAA0E;AAC1E,4EAA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YAAY;IAfxB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,eAAe;YAC3B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACnB,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpB,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;GACZ,YAAY,CA2BxB","sourcesContent":["import { index, modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Order } from './order.model';\nimport { PaymentMethod, PaymentStatus } from '../../../utilities/enum';\nimport { PaymentInformation } from './embedded/payment-infromation.model';\nimport { PaymentAttempt } from './embedded/payment-attempt.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\ttimestamps: true,\n\t\tcollection: 'orderPayments',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ order: 1 })\n@index({ status: 1 })\n@index({ paymentMethod: 1 })\n@index({ createdAt: -1 })\nexport class OrderPayment extends TimeStamps {\n\t@prop({ required: true, ref: () => Order, index: true, unique: true })\n\torder: Ref<Order>;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpaymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation })\n\tpaymentInformation?: PaymentInformation;\n\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\n\tstatus?: PaymentStatus;\n\n\t@prop()\n\treceiptUrl?: string;\n\n\t@prop({ type: [PaymentAttempt], default: [] })\n\tattempts?: PaymentAttempt[];\n\n\t@prop({ type: String })\n\tcurrency: string;\n\n\t@prop({ required: true, type: Number })\n\tamount: number;\n\n\t@prop({ type: Number })\n\tsecondaryAmount?: number;\n}\n"]}
|
|
@@ -20,10 +20,9 @@ export declare class Product extends TimeStamps {
|
|
|
20
20
|
description?: string;
|
|
21
21
|
attributeMaps?: AttributeMap[];
|
|
22
22
|
addons?: Ref<Product>[];
|
|
23
|
+
isNutritionEnabled?: boolean;
|
|
23
24
|
nutritionPackSize?: number;
|
|
24
25
|
nutritionPackSizeUnit?: string;
|
|
25
|
-
nutritionServingSize?: number;
|
|
26
|
-
nutritionCalories?: number;
|
|
27
26
|
nutritions?: ProductNutrition[];
|
|
28
27
|
dietaryTypes?: ProductDietaryType[];
|
|
29
28
|
storedTemperature?: number;
|
|
@@ -33,10 +33,9 @@ let Product = class Product extends defaultClasses_1.TimeStamps {
|
|
|
33
33
|
description;
|
|
34
34
|
attributeMaps;
|
|
35
35
|
addons;
|
|
36
|
+
isNutritionEnabled;
|
|
36
37
|
nutritionPackSize;
|
|
37
38
|
nutritionPackSizeUnit;
|
|
38
|
-
nutritionServingSize;
|
|
39
|
-
nutritionCalories;
|
|
40
39
|
nutritions;
|
|
41
40
|
dietaryTypes;
|
|
42
41
|
storedTemperature;
|
|
@@ -57,11 +56,11 @@ __decorate([
|
|
|
57
56
|
__metadata("design:type", Object)
|
|
58
57
|
], Product.prototype, "shop", void 0);
|
|
59
58
|
__decorate([
|
|
60
|
-
(0, typegoose_1.prop)({ required: true, type: String, maxlength: 100 }),
|
|
59
|
+
(0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 100 }),
|
|
61
60
|
__metadata("design:type", String)
|
|
62
61
|
], Product.prototype, "name", void 0);
|
|
63
62
|
__decorate([
|
|
64
|
-
(0, typegoose_1.prop)({ type: String,
|
|
63
|
+
(0, typegoose_1.prop)({ type: String, trim: true, maxlength: 50 }),
|
|
65
64
|
__metadata("design:type", String)
|
|
66
65
|
], Product.prototype, "barcode", void 0);
|
|
67
66
|
__decorate([
|
|
@@ -73,7 +72,7 @@ __decorate([
|
|
|
73
72
|
__metadata("design:type", String)
|
|
74
73
|
], Product.prototype, "itemType", void 0);
|
|
75
74
|
__decorate([
|
|
76
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.ProductType
|
|
75
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.ProductType }),
|
|
77
76
|
__metadata("design:type", String)
|
|
78
77
|
], Product.prototype, "productType", void 0);
|
|
79
78
|
__decorate([
|
|
@@ -104,6 +103,10 @@ __decorate([
|
|
|
104
103
|
(0, typegoose_1.prop)({ ref: () => Product, default: [] }),
|
|
105
104
|
__metadata("design:type", Array)
|
|
106
105
|
], Product.prototype, "addons", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
108
|
+
__metadata("design:type", Boolean)
|
|
109
|
+
], Product.prototype, "isNutritionEnabled", void 0);
|
|
107
110
|
__decorate([
|
|
108
111
|
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
109
112
|
__metadata("design:type", Number)
|
|
@@ -112,14 +115,6 @@ __decorate([
|
|
|
112
115
|
(0, typegoose_1.prop)({ type: String }),
|
|
113
116
|
__metadata("design:type", String)
|
|
114
117
|
], Product.prototype, "nutritionPackSizeUnit", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
117
|
-
__metadata("design:type", Number)
|
|
118
|
-
], Product.prototype, "nutritionServingSize", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
121
|
-
__metadata("design:type", Number)
|
|
122
|
-
], Product.prototype, "nutritionCalories", void 0);
|
|
123
118
|
__decorate([
|
|
124
119
|
(0, typegoose_1.prop)({ type: [product_nutrition_model_1.ProductNutrition], default: [] }),
|
|
125
120
|
__metadata("design:type", Array)
|
|
@@ -137,7 +132,7 @@ __decorate([
|
|
|
137
132
|
__metadata("design:type", Boolean)
|
|
138
133
|
], Product.prototype, "isStockEnabled", void 0);
|
|
139
134
|
__decorate([
|
|
140
|
-
(0, typegoose_1.prop)({ type: Number }),
|
|
135
|
+
(0, typegoose_1.prop)({ type: Number, max: 999999999 }),
|
|
141
136
|
__metadata("design:type", Number)
|
|
142
137
|
], Product.prototype, "stockQuantity", void 0);
|
|
143
138
|
__decorate([
|
|
@@ -157,7 +152,7 @@ __decorate([
|
|
|
157
152
|
__metadata("design:type", Number)
|
|
158
153
|
], Product.prototype, "numberOfPreparingHours", void 0);
|
|
159
154
|
__decorate([
|
|
160
|
-
(0, typegoose_1.prop)({ type: Number,
|
|
155
|
+
(0, typegoose_1.prop)({ type: Number, min: 0, max: 999999999 }),
|
|
161
156
|
__metadata("design:type", Number)
|
|
162
157
|
], Product.prototype, "orderQuantityLimit", void 0);
|
|
163
158
|
__decorate([
|
|
@@ -175,10 +170,6 @@ __decorate([
|
|
|
175
170
|
exports.Product = Product = __decorate([
|
|
176
171
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'products' } }),
|
|
177
172
|
(0, typegoose_1.Index)({ name: 1, shop: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
|
|
178
|
-
(0, typegoose_1.Index)({ barcode: 1, shop: 1 }, {
|
|
179
|
-
unique: true,
|
|
180
|
-
partialFilterExpression: { barcode: { $exists: true, $nin: [null, '0000000'] }, deletedAt: null },
|
|
181
|
-
}),
|
|
182
173
|
(0, typegoose_1.Index)({ shop: 1, shopCategory: 1, deletedAt: 1 }),
|
|
183
174
|
(0, typegoose_1.Index)({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 }),
|
|
184
175
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAyG;AACzG,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiC;
|
|
1
|
+
{"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAyG;AACzG,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiC;AAmC1B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,YAAY,CAAqB;IAGjC,QAAQ,CAAY;IAGpB,WAAW,CAAe;IAG1B,IAAI,CAAU;IAGd,MAAM,CAAY;IAGlB,WAAW,CAAe;IAG1B,eAAe,CAAoB;IAGnC,WAAW,CAAU;IAGrB,aAAa,CAAkB;IAG/B,MAAM,CAAkB;IAGxB,kBAAkB,CAAW;IAG7B,iBAAiB,CAAU;IAG3B,qBAAqB,CAAU;IAG/B,UAAU,CAAsB;IAGhC,YAAY,CAAwB;IAGpC,iBAAiB,CAAU;IAG3B,cAAc,CAAW;IAGzB,aAAa,CAAU;IAGvB,eAAe,CAAW;IAG1B,WAAW,CAAW;IAGtB,iBAAiB,CAAW;IAG5B,sBAAsB,CAAU;IAGhC,kBAAkB,CAAU;IAG5B,IAAI,CAAU;IAGd,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAvFY,0BAAO;AAEZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,E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,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,eAAY,CAAC,SAAS,CAA8B;oBACjF;wBACC,MAAM,EAAE;4BACP,IAAI,EAAE,IAAI,CAAC,IAAI;4BACf,YAAY,EAAE,IAAI,CAAC,YAAY;4BAC/B,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,OAAO,CAuFnB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ProductType, ItemType, ProductDietaryType, Status, PriceOption } from '../../../utilities/enum';\nimport { ProductNutrition } from './embedded/product-nutrition.model';\nimport { Shop } from './shop.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { AttributeMap } from './embedded/attribute-map.model';\nimport { ShopCategory } from './shop-category.model';\nimport { ProductModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'products' } })\n@Index({ name: 1, shop: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ shop: 1, shopCategory: 1, deletedAt: 1 })\n@Index({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 })\n@pre<Product>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for products with the same shop and shopCategory that aren't deleted\n\t\t\tconst maxSortingOrder = await ProductModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tshop: this.shop,\n\t\t\t\t\t\tshopCategory: this.shopCategory,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class Product extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, trim: true, maxlength: 100 })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, maxlength: 50 })\n\tpublic barcode?: string;\n\n\t@prop({ required: true, ref: () => ShopCategory })\n\tpublic shopCategory!: Ref<ShopCategory>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: String, enum: ProductType })\n\tpublic productType?: ProductType;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: [String], default: [] })\n\tpublic images?: string[];\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: [PriceBreakdown] })\n\tpublic priceBreakdowns?: PriceBreakdown[];\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: [AttributeMap], default: [] })\n\tpublic attributeMaps?: AttributeMap[];\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic addons?: Ref<Product>[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isNutritionEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionPackSize?: number;\n\n\t@prop({ type: String })\n\tpublic nutritionPackSizeUnit?: string;\n\n\t@prop({ type: [ProductNutrition], default: [] })\n\tpublic nutritions?: ProductNutrition[];\n\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\n\tpublic dietaryTypes?: ProductDietaryType[];\n\n\t@prop({ type: Number, min: -9999, max: 9999 })\n\tpublic storedTemperature?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isStockEnabled?: boolean;\n\n\t@prop({ type: Number, max: 999999999 }) // isStockEnabled: true and stockQuantity < 1 means out of stock\n\tpublic stockQuantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isDrinkIncluded?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLargeItem?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPreOrderEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic numberOfPreparingHours?: number;\n\n\t@prop({ type: Number, min: 0, max: 999999999 }) // 0 means, it is disable\n\tpublic orderQuantityLimit?: number;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic note?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
|
|
@@ -33,6 +33,7 @@ class RegularOrder extends order_model_1.Order {
|
|
|
33
33
|
shop;
|
|
34
34
|
cart;
|
|
35
35
|
isShopDelivery;
|
|
36
|
+
isShopReject;
|
|
36
37
|
preparingTimeInMinutes;
|
|
37
38
|
isReplacementOrder;
|
|
38
39
|
originalOrderForReplacement;
|
|
@@ -81,6 +82,10 @@ __decorate([
|
|
|
81
82
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
82
83
|
__metadata("design:type", Boolean)
|
|
83
84
|
], RegularOrder.prototype, "isShopDelivery", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
87
|
+
__metadata("design:type", Boolean)
|
|
88
|
+
], RegularOrder.prototype, "isShopReject", void 0);
|
|
84
89
|
__decorate([
|
|
85
90
|
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
86
91
|
__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regular-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/regular-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,gDAAuC;AACvC,qDAAqF;AACrF,kDAAyC;AACzC,8CAAqC;AACrC,8CAAqC;AACrC,2DAA+D;AAC/D,6EAA+E;AAC/E,uEAA6D;AAC7D,yFAA8E;AAC9E,uEAA6D;AAC7D,iFAAuE;AAEvE,MAAa,YAAa,SAAQ,mBAAK;IAC/B,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,MAAM,CAAS;IAGf,cAAc,CAA+B;IAG7C,QAAQ,CAAU;IAGlB,aAAa,CAAU;IAGvB,eAAe,CAAc;IAG7B,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,cAAc,CAAW;IAGzB,sBAAsB,CAAU;IAGhC,kBAAkB,CAAW;IAG7B,2BAA2B,CAAc;IAGzC,2BAA2B,CAAoB;IAG/C,UAAU,CAAW;IAGrB,iBAAiB,CAAe;IAGhC,oBAAoB,CAAW;IAG/B,sBAAsB,CAAe;IAGrC,OAAO,CAAsB;IAG7B,eAAe,CAAuB;CAC7C;
|
|
1
|
+
{"version":3,"file":"regular-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/regular-order.model.ts"],"names":[],"mappings":";;;;;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AI,EAAE,gCAAW,EAAE,CAAC;8BACD,gCAAW;uDAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;0DACF;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,gCAAW,EAAE,CAAC;8BACF,gCAAW;4DAAC;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iDAAmB,EAAE,CAAC;8BACpC,iDAAmB;6CAAC;AAG7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,iDAAmB,EAAE,CAAC;8BACX,iDAAmB;qDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { Order } from '../order.model';\nimport { ItemType, OrderType, RegularOrderStatus } from '../../../../utilities/enum';\nimport { Parent } from '../parent.model';\nimport { Shop } from '../shop.model';\nimport { Cart } from '../cart.model';\nimport { Address, UserAddress } from '../shared/address.model';\nimport { RegularOrderStatusTimeline } from '../embedded/status-timeline.model';\nimport { OrderRefund } from '../embedded/order-refund.model';\nimport { RegularOrderFinance } from '../embedded/regular-order-finance.model';\nimport { EndorseLoss } from '../embedded/order-cancel.model';\nimport { ReplacementOrder } from '../embedded/replacement-order.model';\n\nexport class RegularOrder extends Order {\n\tpublic orderType = OrderType.REGULAR as const;\n\n\t@prop({ type: String, enum: RegularOrderStatus, default: RegularOrderStatus.PLACED })\n\tpublic status: string;\n\n\t@prop({ type: () => [RegularOrderStatusTimeline], default: [] })\n\tpublic statusTimeline: RegularOrderStatusTimeline[];\n\n\t@prop({ type: String, enum: ItemType, default: ItemType.FOOD })\n\tpublic itemType?: string;\n\n\t@prop({ required: true, type: Address })\n\tpublic pickupAddress: Address;\n\n\t@prop({ required: true, type: UserAddress })\n\tpublic deliveryAddress: UserAddress;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent!: Ref<Parent>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, ref: () => Cart, unique: true })\n\tpublic cart!: Ref<Cart>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopDelivery?: boolean;\n\n\t@prop({type: Boolean,default: false})\n\tpublic isShopReject?: boolean\n\n\t@prop({ type: Number, default: 0 })\n\tpublic preparingTimeInMinutes?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isReplacementOrder?: boolean;\n\n\t@prop({ ref: () => Order })\n\tpublic originalOrderForReplacement?: Ref<Order>;\n\n\t@prop({ type: () => ReplacementOrder })\n\tpublic replacementOrderInformation?: ReplacementOrder;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRefunded?: boolean;\n\n\t@prop({ type: OrderRefund })\n\tpublic refundInformation?: OrderRefund;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isEndorseLossApplied?: boolean;\n\n\t@prop({ type: () => EndorseLoss })\n\tpublic endorseLossInformation?: EndorseLoss;\n\n\t@prop({ required: true, type: RegularOrderFinance })\n\tpublic finance: RegularOrderFinance;\n\n\t@prop({ type: RegularOrderFinance })\n\tpublic adjustedFinance?: RegularOrderFinance;\n}\n"]}
|
|
@@ -172,7 +172,6 @@ exports.Ticket = Ticket = __decorate([
|
|
|
172
172
|
(0, typegoose_1.index)({ type: 1, status: 1, priority: 1 }),
|
|
173
173
|
(0, typegoose_1.index)({ client: 1, clientType: 1, status: 1 }),
|
|
174
174
|
(0, typegoose_1.index)({ createdAt: -1 }),
|
|
175
|
-
(0, typegoose_1.index)({ ticketId: 1 }, { unique: true }),
|
|
176
175
|
(0, typegoose_1.index)({ chatroom: 1 })
|
|
177
176
|
], Ticket);
|
|
178
177
|
//# sourceMappingURL=ticket.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticket.model.js","sourceRoot":"/","sources":["libraries/mongo/models/ticket.model.ts"],"names":[],"mappings":";;;;;;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BAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC1C,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9C,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;GACV,MAAM,CAyDlB","sourcesContent":["import { prop, Ref, index, modelOptions, pre, post } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Order } from './order.model';\nimport { Admin } from './admin.model';\nimport { TicketType, TicketStatus } from '../../../utilities/enum';\nimport { Chatroom } from './chat-room.model';\n\n@pre<Ticket>('save', async function (next) {\n\tif (this.isNew && !this.ticketId) {\n\t\tconst { CounterModel } = await import('.');\n\n\t\ttry {\n\t\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t\t{ counterType: 'ticket' },\n\t\t\t\t{ $inc: { value: 1 } },\n\t\t\t\t{ new: true, upsert: true }\n\t\t\t);\n\n\t\t\tconst currentDate = new Date().toISOString().slice(0, 10).replace(/-/g, '');\n\t\t\tthis.ticketId = `TKT-${currentDate}-${String(counter.value).padStart(4, '0')}`;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'tickets',\n\t\ttimestamps: true,\n\t},\n})\n@index({ assignedAgent: 1, status: 1 })\n@index({ type: 1, status: 1, priority: 1 })\n@index({ client: 1, clientType: 1, status: 1 })\n@index({ createdAt: -1 })\n@index({ chatroom: 1 })\nexport class Ticket extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic ticketId!: string;\n\n\t@prop({ required: true, type: String, enum: TicketType })\n\tpublic type!: TicketType;\n\n\t@prop({ required: true, type: String, enum: TicketStatus, default: TicketStatus.PENDING })\n\tpublic status!: TicketStatus;\n\n\t@prop({ refPath: 'clientType', required: true })\n\tpublic client!: Ref<User | Shop>;\n\n\t@prop({ required: true, type: String, enum: ['User', 'Shop'] })\n\tpublic clientType!: string;\n\n\t@prop({ type: String, required: true })\n\tpublic subject!: string;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n\n\t@prop({ ref: () => Order })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Admin })\n\tpublic assignedAgent?: Ref<Admin>;\n\n\t@prop({ type: Date })\n\tpublic assignedAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic assignmentAttempts?: number;\n\n\t@prop({ ref: () => Chatroom, required: true })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ type: Date })\n\tpublic resolvedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic closedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic resolutionTimeMinutes?: number;\n\n\t@prop({ type: Number, min: 1, max: 5 })\n\tpublic customerRating?: number;\n\n\t@prop({ type: String })\n\tpublic customerFeedback?: string;\n\n\t@prop({ type: Number })\n\tpublic agentScore?: number;\n\n\t@prop({ type: [String], default: [] })\n\tpublic tags?: string[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/auth.ts"],"names":[],"mappings":";;AAuBA,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/auth.ts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AAC;gBACnB,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,0BAA0B;aACnC,CAAC,CAAC;QACJ,CAAC;QAED,GAAG,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QAClC,GAAG,CAAC,SAAS,GAAG,gBAAS,CAAC,OAAO,CAAC;QAClC,GAAG,CAAC,gBAAgB,GAAG,IAAI,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 {\n\tAuthEntityType,\n\tverifyAccessToken,\n\tvalidateRefreshToken,\n\tsignAccessToken,\n\tTokenType,\n\trefreshTokens,\n\thandleTokenRenewal,\n} from '../../auth';\nimport { UserModel } from '../../mongo/models';\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) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'Missing access token' });\n\t\t}\n\n\t\tlet entity = await verifyAccessToken(entityTypes, accessToken);\n\n\t\tif (entity?.type == 'USER') {\n\t\t\tconst user = await UserModel.findOne({ _id: entity.id });\n\t\t\tif (!user) {\n\t\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'User not found' });\n\t\t\t}\n\t\t}\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\t\t\treturn next({ ctx });\n\t\t}\n\n\t\tif (!allowRefreshToken || !refreshToken) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'UNAUTHORIZED',\n\t\t\t\tmessage: 'Invalid access token',\n\t\t\t});\n\t\t}\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\tthrow new TRPCError({\n\t\t\t\tcode: 'UNAUTHORIZED',\n\t\t\t\tmessage: errorMessage,\n\t\t\t});\n\t\t}\n\n\t\tif (!entityTypes.includes(renewalResult.entity!.type)) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'UNAUTHORIZED',\n\t\t\t\tmessage: 'Unauthorized entity type',\n\t\t\t});\n\t\t}\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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function getChangedFields<T extends Record<string, any>>(oldDoc: T, newDoc: T, payload?: Partial<T>): Record<keyof T, {
|
|
2
|
+
old: any;
|
|
3
|
+
new: any;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function filterRelevantChanges<T>(allChanges: Record<string, {
|
|
6
|
+
old: any;
|
|
7
|
+
new: any;
|
|
8
|
+
}>, payload: Partial<T>): Record<string, {
|
|
9
|
+
old: any;
|
|
10
|
+
new: any;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function extractChangedDocument(changes: Record<string, {
|
|
13
|
+
old: any;
|
|
14
|
+
new: any;
|
|
15
|
+
}>, type: 'old' | 'new'): Record<string, any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChangedFields = getChangedFields;
|
|
4
|
+
exports.filterRelevantChanges = filterRelevantChanges;
|
|
5
|
+
exports.extractChangedDocument = extractChangedDocument;
|
|
6
|
+
function getChangedFields(oldDoc, newDoc, payload) {
|
|
7
|
+
const changes = {};
|
|
8
|
+
const oldObj = typeof oldDoc.toObject === 'function' ? oldDoc.toObject() : oldDoc;
|
|
9
|
+
const newObj = typeof newDoc.toObject === 'function' ? newDoc.toObject() : newDoc;
|
|
10
|
+
const keysToCheck = payload
|
|
11
|
+
? Object.keys(payload)
|
|
12
|
+
: Array.from(new Set([...Object.keys(oldObj), ...Object.keys(newObj)]));
|
|
13
|
+
for (const key of keysToCheck) {
|
|
14
|
+
const oldValue = oldObj[key];
|
|
15
|
+
const newValue = newObj[key];
|
|
16
|
+
if (payload || JSON.stringify(oldValue) !== JSON.stringify(newValue)) {
|
|
17
|
+
changes[key] = { old: oldValue, new: newValue };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return changes;
|
|
21
|
+
}
|
|
22
|
+
function filterRelevantChanges(allChanges, payload) {
|
|
23
|
+
return Object.keys(payload).reduce((acc, key) => {
|
|
24
|
+
if (allChanges[key]) {
|
|
25
|
+
acc[key] = allChanges[key];
|
|
26
|
+
}
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
}
|
|
30
|
+
function extractChangedDocument(changes, type) {
|
|
31
|
+
return Object.fromEntries(Object.entries(changes).map(([key, value]) => [key, value[type]]));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=logs-common-methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs-common-methods.js","sourceRoot":"/","sources":["utilities/common/logs-common-methods.ts"],"names":[],"mappings":";;AAGC,4CAwBC;AAMD,sDAUC;AAKD,wDAOC;AApDD,SAAgB,gBAAgB,CAC/B,MAAS,EACT,MAAS,EACT,OAAoB;IAEpB,MAAM,OAAO,GAAG,EAA6C,CAAC;IAE9D,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM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,EAC/C,IAAmB;IAEnB,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CACjE,CAAC;AACH,CAAC","sourcesContent":["/**\n\t * Returns changed fields between two objects (shallow comparison).\n\t */\n\texport function getChangedFields<T extends Record<string, any>>(\n\t\toldDoc: T,\n\t\tnewDoc: T,\n\t\tpayload?: Partial<T>\n\t): Record<keyof T, { old: any; new: any }> {\n\t\tconst changes = {} as Record<keyof T, { old: any; new: any }>;\n\n\t\tconst oldObj = typeof oldDoc.toObject === 'function' ? oldDoc.toObject() : oldDoc;\n\t\tconst newObj = typeof newDoc.toObject === 'function' ? newDoc.toObject() : newDoc;\n\n\t\tconst keysToCheck = payload\n\t\t\t? Object.keys(payload)\n\t\t\t: Array.from(new Set([...Object.keys(oldObj), ...Object.keys(newObj)]));\n\n\t\tfor (const key of keysToCheck) {\n\t\t\tconst oldValue = oldObj[key];\n\t\t\tconst newValue = newObj[key];\n\n\t\t\tif (payload || JSON.stringify(oldValue) !== JSON.stringify(newValue)) {\n\t\t\t\tchanges[key as keyof T] = { old: oldValue, new: newValue };\n\t\t\t}\n\t\t}\n\n\t\treturn changes;\n\t}\n\n\n\t/**\n\t * Filters changed fields to only those that exist in the payload.\n\t */\n\texport function filterRelevantChanges<T>(\n\t\tallChanges: Record<string, { old: any; new: any }>,\n\t\tpayload: Partial<T>\n\t): Record<string, { old: any; new: any }> {\n\t\treturn Object.keys(payload).reduce((acc, key) => {\n\t\t\tif (allChanges[key]) {\n\t\t\t\tacc[key] = allChanges[key];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} as Record<string, { old: any; new: any }>);\n\t}\n\n\t/**\n\t * Extracts either 'old' or 'new' values from the changes object.\n\t */\n\texport function extractChangedDocument(\n\t\tchanges: Record<string, { old: any; new: any }>,\n\t\ttype: 'old' | 'new'\n\t): Record<string, any> {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(changes).map(([key, value]) => [key, value[type]])\n\t\t);\n\t}\n"]}
|
package/dist/utilities/enum.d.ts
CHANGED
|
@@ -99,6 +99,61 @@ export declare enum UpdatedField {
|
|
|
99
99
|
IS_GROUND_ORDER_ENABLED = "is_ground_order_enabled",
|
|
100
100
|
CUSTOMER_SUPPORT_PHONE_NUMBER = "customer_support_phone_number"
|
|
101
101
|
}
|
|
102
|
+
export declare enum AdminLogsUpdatedFieldsType {
|
|
103
|
+
CHARGE_SETTINGS = "charge_settings",
|
|
104
|
+
SERVICE_FEE_SETTINGS = "service_fee_settings",
|
|
105
|
+
PAYOUT_SETTINGS = "payout_settings",
|
|
106
|
+
COURIER_SETTINGS = "courier_settings",
|
|
107
|
+
RIDER_SETTINGS = "rider_settings",
|
|
108
|
+
BUSINESS_DEVELOPMENT_EXECUTIVE = "business_development_executive",
|
|
109
|
+
PAY_LIMIT_FOR_USER = "pay_limit_for_user",
|
|
110
|
+
VAT_PERCENTAGE = "vat_percentage",
|
|
111
|
+
RIDER_SEARCH_RANGES = "rider_search_ranges",
|
|
112
|
+
RIDER_BATCHES = "rider_batches",
|
|
113
|
+
NEARBY_SHOP_DISTANCE = "nearby_shop_distance",
|
|
114
|
+
NEAR_BY_SHOP_DISTANCE_IN_HOME_SCREEN = "nearby_shop_distance_in_home_screen",
|
|
115
|
+
UNITS = "units",
|
|
116
|
+
CURRENCY_SETTING = "currency_setting",
|
|
117
|
+
PAYMENT_METHODS = "payment_methods",
|
|
118
|
+
IS_GROUPED_ORDER_ENABLED = "is_grouped_order_enabled",
|
|
119
|
+
CUSTOMER_SUPPORT = "customer_support",
|
|
120
|
+
CUSTOMER_SUPPORT_BATCHES = "customer_support_batches",
|
|
121
|
+
WORK_HOUR_SETTINGS = "work_hour_settings",
|
|
122
|
+
PLUS_SETTING = "plus_setting",
|
|
123
|
+
DELIVERY_CHARGES = "delivery_charges",
|
|
124
|
+
SETTINGS_DELETED = "settings_deleted",
|
|
125
|
+
SHOP_ACTIVATED = "shop_activated",
|
|
126
|
+
SHOP_DEACTIVATED = "shop_deactivated",
|
|
127
|
+
SHOP_DELETED = "shop_deleted",
|
|
128
|
+
SHOW_SHOP_IN_USER_APP = "show_shop_in_user_app",
|
|
129
|
+
HIDE_SHOP_IN_USER_APP = "hide_shop_in_user_app",
|
|
130
|
+
PARENT_ACTIVATED = "parent_activated",
|
|
131
|
+
PARENT_DEACTIVATED = "parent_deactivated",
|
|
132
|
+
PARENT_DELETED = "parent_deleted",
|
|
133
|
+
RIDER_ACTIVATED = "rider_activated",
|
|
134
|
+
RIDER_DEACTIVATED = "rider_deactivated",
|
|
135
|
+
RIDER_DELETED = "rider_deleted",
|
|
136
|
+
ACTIVATED_MARKETING_PROMOTIONS = "activated_marketing_promotions",
|
|
137
|
+
EDITED_MARKETING_PROMOTIONS = "edited_marketing_promotions",
|
|
138
|
+
PAUSED_MARKETING_PROMOTIONS = "paused_marketing_promotions",
|
|
139
|
+
DELETED_MARKETING_PROMOTIONS = "deleted_marketing_promotions",
|
|
140
|
+
ACTIVATED_ZONE = "activated_zone",
|
|
141
|
+
DEACTIVATED_ZONE = "deactivated_zone",
|
|
142
|
+
CHANGE_IN_MARKETING_SETTINGS = "change_in_marketing_settings",
|
|
143
|
+
CHANGE_IN_PRIVACY_POLICY = "change_in_privacy_policy",
|
|
144
|
+
CHANGE_IN_USER_TERMS_AND_CONDITIONS = "change_in_user_terms_and_conditions",
|
|
145
|
+
CHANGE_IN_SHOP_TERMS_AND_CONDITIONS = "change_in_shop_terms_and_conditions",
|
|
146
|
+
CHANGE_IN_RIDER_TERMS_AND_CONDITIONS = "change_in_rider_terms_and_conditions",
|
|
147
|
+
CHANGE_IN_LYXA_PLUS_TERMS_AND_CONDITIONS = "lyxa_plux_terms_and_conditions",
|
|
148
|
+
CHANGE_IN_SUPPORT_REASON = "change_in_support_reason",
|
|
149
|
+
DELETE_SUPPORT_REASON = "delete_support_reason",
|
|
150
|
+
CHANGE_IN_CANCELLATION_REASON = "change_in_cancellation_reason",
|
|
151
|
+
DELETE_CANCELLATION_REASON = "delete_cancellation_reason",
|
|
152
|
+
CHANGE_IN_SETTINGS_OPENING_HOURS = "change_in_settings_opening_hours",
|
|
153
|
+
CHANGE_IN_DEFAULT_CHAT_MESSAGE = "change_in_default_chat_messages",
|
|
154
|
+
DELETE_DEFAULT_CHAT_MESSAGE = "delete_default_chat_message",
|
|
155
|
+
CHANGE_IN_LYXA_PLUS_CONFIGURATION = "change_in_lyxa_plux_configuration"
|
|
156
|
+
}
|
|
102
157
|
export declare enum UserAppSectionType {
|
|
103
158
|
SHOW_ALL = "show_all",
|
|
104
159
|
STORE_PUNCHES = "store_punches",
|
|
@@ -361,6 +416,8 @@ export declare enum RegularOrderStatus {
|
|
|
361
416
|
PLACED = "placed",
|
|
362
417
|
ACCEPTED_BY_RIDER = "accepted_by_rider",
|
|
363
418
|
PREPARING = "preparing",
|
|
419
|
+
ACCEPTED_BY_SHOP = "accepted_by_shop",
|
|
420
|
+
REJECTED_BY_SHOP = "rejected_by_shop",
|
|
364
421
|
READY_FOR_PICKUP = "ready_to_pickup",
|
|
365
422
|
ON_THE_WAY = "on_the_way",
|
|
366
423
|
DELIVERED = "delivered",
|
package/dist/utilities/enum.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.ChatroomType = exports.MessageSender = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.LogUser = exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = exports.SettlementType = exports.MediaType = exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.OrderFinanceStatus = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.LiveStatus = void 0;
|
|
3
|
+
exports.CardUserType = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.AdminRole = exports.MarketingStatus = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.ShopRole = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.PriceOption = exports.ProductType = exports.CoreAuthIdentityType = exports.UserAppSectionItemType = exports.UserAppSectionType = exports.AdminLogsUpdatedFieldsType = exports.UpdatedField = exports.GeoLocationType = exports.RatingAccountType = exports.SubscriptionStatus = exports.SubscriptionPackage = exports.PaidCurrency = exports.PaymentStatus = exports.PaymentMethod = exports.ValueType = exports.HolidayWorkStatus = exports.WorkStatus = exports.WeekDay = exports.GlobalItemType = exports.ItemType = exports.Status = exports.AccountType = void 0;
|
|
4
|
+
exports.ChatroomType = exports.MessageSender = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.LogUser = exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = exports.SettlementType = exports.MediaType = exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.OrderFinanceStatus = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.LiveStatus = exports.AreebaCardStatus = void 0;
|
|
5
5
|
var AccountType;
|
|
6
6
|
(function (AccountType) {
|
|
7
7
|
AccountType["USER"] = "user";
|
|
@@ -119,6 +119,62 @@ var UpdatedField;
|
|
|
119
119
|
UpdatedField["IS_GROUND_ORDER_ENABLED"] = "is_ground_order_enabled";
|
|
120
120
|
UpdatedField["CUSTOMER_SUPPORT_PHONE_NUMBER"] = "customer_support_phone_number";
|
|
121
121
|
})(UpdatedField || (exports.UpdatedField = UpdatedField = {}));
|
|
122
|
+
var AdminLogsUpdatedFieldsType;
|
|
123
|
+
(function (AdminLogsUpdatedFieldsType) {
|
|
124
|
+
AdminLogsUpdatedFieldsType["CHARGE_SETTINGS"] = "charge_settings";
|
|
125
|
+
AdminLogsUpdatedFieldsType["SERVICE_FEE_SETTINGS"] = "service_fee_settings";
|
|
126
|
+
AdminLogsUpdatedFieldsType["PAYOUT_SETTINGS"] = "payout_settings";
|
|
127
|
+
AdminLogsUpdatedFieldsType["COURIER_SETTINGS"] = "courier_settings";
|
|
128
|
+
AdminLogsUpdatedFieldsType["RIDER_SETTINGS"] = "rider_settings";
|
|
129
|
+
AdminLogsUpdatedFieldsType["BUSINESS_DEVELOPMENT_EXECUTIVE"] = "business_development_executive";
|
|
130
|
+
AdminLogsUpdatedFieldsType["PAY_LIMIT_FOR_USER"] = "pay_limit_for_user";
|
|
131
|
+
AdminLogsUpdatedFieldsType["VAT_PERCENTAGE"] = "vat_percentage";
|
|
132
|
+
AdminLogsUpdatedFieldsType["RIDER_SEARCH_RANGES"] = "rider_search_ranges";
|
|
133
|
+
AdminLogsUpdatedFieldsType["RIDER_BATCHES"] = "rider_batches";
|
|
134
|
+
AdminLogsUpdatedFieldsType["NEARBY_SHOP_DISTANCE"] = "nearby_shop_distance";
|
|
135
|
+
AdminLogsUpdatedFieldsType["NEAR_BY_SHOP_DISTANCE_IN_HOME_SCREEN"] = "nearby_shop_distance_in_home_screen";
|
|
136
|
+
AdminLogsUpdatedFieldsType["UNITS"] = "units";
|
|
137
|
+
AdminLogsUpdatedFieldsType["CURRENCY_SETTING"] = "currency_setting";
|
|
138
|
+
AdminLogsUpdatedFieldsType["PAYMENT_METHODS"] = "payment_methods";
|
|
139
|
+
AdminLogsUpdatedFieldsType["IS_GROUPED_ORDER_ENABLED"] = "is_grouped_order_enabled";
|
|
140
|
+
AdminLogsUpdatedFieldsType["CUSTOMER_SUPPORT"] = "customer_support";
|
|
141
|
+
AdminLogsUpdatedFieldsType["CUSTOMER_SUPPORT_BATCHES"] = "customer_support_batches";
|
|
142
|
+
AdminLogsUpdatedFieldsType["WORK_HOUR_SETTINGS"] = "work_hour_settings";
|
|
143
|
+
AdminLogsUpdatedFieldsType["PLUS_SETTING"] = "plus_setting";
|
|
144
|
+
AdminLogsUpdatedFieldsType["DELIVERY_CHARGES"] = "delivery_charges";
|
|
145
|
+
AdminLogsUpdatedFieldsType["SETTINGS_DELETED"] = "settings_deleted";
|
|
146
|
+
AdminLogsUpdatedFieldsType["SHOP_ACTIVATED"] = "shop_activated";
|
|
147
|
+
AdminLogsUpdatedFieldsType["SHOP_DEACTIVATED"] = "shop_deactivated";
|
|
148
|
+
AdminLogsUpdatedFieldsType["SHOP_DELETED"] = "shop_deleted";
|
|
149
|
+
AdminLogsUpdatedFieldsType["SHOW_SHOP_IN_USER_APP"] = "show_shop_in_user_app";
|
|
150
|
+
AdminLogsUpdatedFieldsType["HIDE_SHOP_IN_USER_APP"] = "hide_shop_in_user_app";
|
|
151
|
+
AdminLogsUpdatedFieldsType["PARENT_ACTIVATED"] = "parent_activated";
|
|
152
|
+
AdminLogsUpdatedFieldsType["PARENT_DEACTIVATED"] = "parent_deactivated";
|
|
153
|
+
AdminLogsUpdatedFieldsType["PARENT_DELETED"] = "parent_deleted";
|
|
154
|
+
AdminLogsUpdatedFieldsType["RIDER_ACTIVATED"] = "rider_activated";
|
|
155
|
+
AdminLogsUpdatedFieldsType["RIDER_DEACTIVATED"] = "rider_deactivated";
|
|
156
|
+
AdminLogsUpdatedFieldsType["RIDER_DELETED"] = "rider_deleted";
|
|
157
|
+
AdminLogsUpdatedFieldsType["ACTIVATED_MARKETING_PROMOTIONS"] = "activated_marketing_promotions";
|
|
158
|
+
AdminLogsUpdatedFieldsType["EDITED_MARKETING_PROMOTIONS"] = "edited_marketing_promotions";
|
|
159
|
+
AdminLogsUpdatedFieldsType["PAUSED_MARKETING_PROMOTIONS"] = "paused_marketing_promotions";
|
|
160
|
+
AdminLogsUpdatedFieldsType["DELETED_MARKETING_PROMOTIONS"] = "deleted_marketing_promotions";
|
|
161
|
+
AdminLogsUpdatedFieldsType["ACTIVATED_ZONE"] = "activated_zone";
|
|
162
|
+
AdminLogsUpdatedFieldsType["DEACTIVATED_ZONE"] = "deactivated_zone";
|
|
163
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_MARKETING_SETTINGS"] = "change_in_marketing_settings";
|
|
164
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_PRIVACY_POLICY"] = "change_in_privacy_policy";
|
|
165
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_USER_TERMS_AND_CONDITIONS"] = "change_in_user_terms_and_conditions";
|
|
166
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_SHOP_TERMS_AND_CONDITIONS"] = "change_in_shop_terms_and_conditions";
|
|
167
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_RIDER_TERMS_AND_CONDITIONS"] = "change_in_rider_terms_and_conditions";
|
|
168
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_LYXA_PLUS_TERMS_AND_CONDITIONS"] = "lyxa_plux_terms_and_conditions";
|
|
169
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_SUPPORT_REASON"] = "change_in_support_reason";
|
|
170
|
+
AdminLogsUpdatedFieldsType["DELETE_SUPPORT_REASON"] = "delete_support_reason";
|
|
171
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_CANCELLATION_REASON"] = "change_in_cancellation_reason";
|
|
172
|
+
AdminLogsUpdatedFieldsType["DELETE_CANCELLATION_REASON"] = "delete_cancellation_reason";
|
|
173
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_SETTINGS_OPENING_HOURS"] = "change_in_settings_opening_hours";
|
|
174
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_DEFAULT_CHAT_MESSAGE"] = "change_in_default_chat_messages";
|
|
175
|
+
AdminLogsUpdatedFieldsType["DELETE_DEFAULT_CHAT_MESSAGE"] = "delete_default_chat_message";
|
|
176
|
+
AdminLogsUpdatedFieldsType["CHANGE_IN_LYXA_PLUS_CONFIGURATION"] = "change_in_lyxa_plux_configuration";
|
|
177
|
+
})(AdminLogsUpdatedFieldsType || (exports.AdminLogsUpdatedFieldsType = AdminLogsUpdatedFieldsType = {}));
|
|
122
178
|
var UserAppSectionType;
|
|
123
179
|
(function (UserAppSectionType) {
|
|
124
180
|
UserAppSectionType["SHOW_ALL"] = "show_all";
|
|
@@ -423,6 +479,8 @@ var RegularOrderStatus;
|
|
|
423
479
|
RegularOrderStatus["PLACED"] = "placed";
|
|
424
480
|
RegularOrderStatus["ACCEPTED_BY_RIDER"] = "accepted_by_rider";
|
|
425
481
|
RegularOrderStatus["PREPARING"] = "preparing";
|
|
482
|
+
RegularOrderStatus["ACCEPTED_BY_SHOP"] = "accepted_by_shop";
|
|
483
|
+
RegularOrderStatus["REJECTED_BY_SHOP"] = "rejected_by_shop";
|
|
426
484
|
RegularOrderStatus["READY_FOR_PICKUP"] = "ready_to_pickup";
|
|
427
485
|
RegularOrderStatus["ON_THE_WAY"] = "on_the_way";
|
|
428
486
|
RegularOrderStatus["DELIVERED"] = "delivered";
|