@lyxa.ai/core 1.0.94 → 1.0.95
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/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/embedded/order-cancel.model.d.ts +8 -8
- package/dist/libraries/mongo/models/embedded/order-cancel.model.js +16 -16
- package/dist/libraries/mongo/models/embedded/order-cancel.model.js.map +1 -1
- package/dist/libraries/mongo/models/line-item.model.d.ts +1 -0
- package/dist/libraries/mongo/models/line-item.model.js +5 -0
- package/dist/libraries/mongo/models/line-item.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/providers/courier-order-finance.model.d.ts +7 -0
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js +26 -0
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/courier-order.model.d.ts +1 -0
- package/dist/libraries/mongo/models/providers/courier-order.model.js +5 -0
- package/dist/libraries/mongo/models/providers/courier-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.d.ts +25 -0
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js +95 -0
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js.map +1 -0
- 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/shop.model.d.ts +1 -0
- package/dist/libraries/mongo/models/shop.model.js +5 -0
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
2
|
+
import { ItemType, SectionType, Status } from '../../../utilities/enum';
|
|
3
|
+
export declare class AppScreenSetting extends TimeStamps {
|
|
4
|
+
itemType: ItemType;
|
|
5
|
+
section: SectionType;
|
|
6
|
+
alias: string;
|
|
7
|
+
status?: Status;
|
|
8
|
+
sortingOrder?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.AppScreenSetting = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
+
const enum_1 = require("../../../utilities/enum");
|
|
16
|
+
const _1 = require(".");
|
|
17
|
+
let AppScreenSetting = class AppScreenSetting extends defaultClasses_1.TimeStamps {
|
|
18
|
+
itemType;
|
|
19
|
+
section;
|
|
20
|
+
alias;
|
|
21
|
+
status;
|
|
22
|
+
sortingOrder;
|
|
23
|
+
};
|
|
24
|
+
exports.AppScreenSetting = AppScreenSetting;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], AppScreenSetting.prototype, "itemType", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.SectionType }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], AppScreenSetting.prototype, "section", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AppScreenSetting.prototype, "alias", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], AppScreenSetting.prototype, "status", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typegoose_1.prop)({ type: Number }),
|
|
43
|
+
__metadata("design:type", Number)
|
|
44
|
+
], AppScreenSetting.prototype, "sortingOrder", void 0);
|
|
45
|
+
exports.AppScreenSetting = AppScreenSetting = __decorate([
|
|
46
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'appScreenSettings' } }),
|
|
47
|
+
(0, typegoose_1.pre)('save', async function (next) {
|
|
48
|
+
if (this.isNew || typeof this.sortingOrder === 'undefined') {
|
|
49
|
+
try {
|
|
50
|
+
const maxSortingOrder = await _1.AppScreenSettingModel.aggregate([
|
|
51
|
+
{
|
|
52
|
+
$match: {
|
|
53
|
+
deletedAt: null,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
$group: {
|
|
58
|
+
_id: null,
|
|
59
|
+
maxSortingOrder: { $max: '$sortingOrder' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
]).exec();
|
|
63
|
+
this.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return next(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
next();
|
|
70
|
+
})
|
|
71
|
+
], AppScreenSetting);
|
|
72
|
+
//# sourceMappingURL=app-screen-setting.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-screen-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/app-screen-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,kDAAwE;AACxE,wBAA0C;AA8BnC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAU;IAExC,QAAQ,CAAY;IAGpB,OAAO,CAAe;IAGtB,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAfY,4CAAgB;AAErB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;kDAC5B;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;iDAC7B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;gDACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACM;2BAdjB,gBAAgB;IA5B5B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,EAAE,CAAC;IACpE,IAAA,eAAG,EAAmB,MAAM,EAAE,KAAK,WAAW,IAAI;QAElD,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,wBAAqB,CAAC,SAAS,CAA8B;oBAC1F;wBACC,MAAM,EAAE;4BACP,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,gBAAgB,CAe5B","sourcesContent":["import { modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, SectionType, Status } from '../../../utilities/enum';\nimport { AppScreenSettingModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'appScreenSettings' } })\n@pre<AppScreenSetting>('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 that aren't deleted\n\t\t\tconst maxSortingOrder = await AppScreenSettingModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\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 AppScreenSetting extends TimeStamps {\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, type: String, enum: SectionType })\n\tpublic section!: SectionType;\n\n\t@prop({ required: true, type: String })\n\tpublic alias!: 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"]}
|
|
@@ -10,14 +10,14 @@ export declare class OrderCancel {
|
|
|
10
10
|
canceledBy: string;
|
|
11
11
|
admin?: Ref<Admin>;
|
|
12
12
|
cancelReason?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
endorseLossByShopForItems: number;
|
|
14
|
+
secondaryEndorseLossByShopForItems: number;
|
|
15
|
+
endorseLossByShopForDelivery: number;
|
|
16
|
+
secondaryEndorseLossByShopForDelivery: number;
|
|
17
|
+
endorseLossByCompanyForItems: number;
|
|
18
|
+
secondaryEndorseLossByCompanyForItems: number;
|
|
19
|
+
endorseLossByCompanyForDelivery: number;
|
|
20
|
+
secondaryEndorseLossByCompanyForDelivery: number;
|
|
21
21
|
totalAmount: number;
|
|
22
22
|
secondaryTotalAmount: number;
|
|
23
23
|
}
|
|
@@ -22,14 +22,14 @@ class OrderCancel {
|
|
|
22
22
|
canceledBy;
|
|
23
23
|
admin;
|
|
24
24
|
cancelReason;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
endorseLossByShopForItems;
|
|
26
|
+
secondaryEndorseLossByShopForItems;
|
|
27
|
+
endorseLossByShopForDelivery;
|
|
28
|
+
secondaryEndorseLossByShopForDelivery;
|
|
29
|
+
endorseLossByCompanyForItems;
|
|
30
|
+
secondaryEndorseLossByCompanyForItems;
|
|
31
|
+
endorseLossByCompanyForDelivery;
|
|
32
|
+
secondaryEndorseLossByCompanyForDelivery;
|
|
33
33
|
totalAmount;
|
|
34
34
|
secondaryTotalAmount;
|
|
35
35
|
}
|
|
@@ -69,35 +69,35 @@ __decorate([
|
|
|
69
69
|
__decorate([
|
|
70
70
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
71
71
|
__metadata("design:type", Number)
|
|
72
|
-
], OrderCancel.prototype, "
|
|
72
|
+
], OrderCancel.prototype, "endorseLossByShopForItems", void 0);
|
|
73
73
|
__decorate([
|
|
74
74
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
75
75
|
__metadata("design:type", Number)
|
|
76
|
-
], OrderCancel.prototype, "
|
|
76
|
+
], OrderCancel.prototype, "secondaryEndorseLossByShopForItems", void 0);
|
|
77
77
|
__decorate([
|
|
78
78
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
79
79
|
__metadata("design:type", Number)
|
|
80
|
-
], OrderCancel.prototype, "
|
|
80
|
+
], OrderCancel.prototype, "endorseLossByShopForDelivery", void 0);
|
|
81
81
|
__decorate([
|
|
82
82
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
83
83
|
__metadata("design:type", Number)
|
|
84
|
-
], OrderCancel.prototype, "
|
|
84
|
+
], OrderCancel.prototype, "secondaryEndorseLossByShopForDelivery", void 0);
|
|
85
85
|
__decorate([
|
|
86
86
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
87
87
|
__metadata("design:type", Number)
|
|
88
|
-
], OrderCancel.prototype, "
|
|
88
|
+
], OrderCancel.prototype, "endorseLossByCompanyForItems", void 0);
|
|
89
89
|
__decorate([
|
|
90
90
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
91
91
|
__metadata("design:type", Number)
|
|
92
|
-
], OrderCancel.prototype, "
|
|
92
|
+
], OrderCancel.prototype, "secondaryEndorseLossByCompanyForItems", void 0);
|
|
93
93
|
__decorate([
|
|
94
94
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
95
95
|
__metadata("design:type", Number)
|
|
96
|
-
], OrderCancel.prototype, "
|
|
96
|
+
], OrderCancel.prototype, "endorseLossByCompanyForDelivery", void 0);
|
|
97
97
|
__decorate([
|
|
98
98
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
99
99
|
__metadata("design:type", Number)
|
|
100
|
-
], OrderCancel.prototype, "
|
|
100
|
+
], OrderCancel.prototype, "secondaryEndorseLossByCompanyForDelivery", void 0);
|
|
101
101
|
__decorate([
|
|
102
102
|
(0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
|
|
103
103
|
__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-cancel.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-cancel.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAoE;AACpE,gDAAuC;AACvC,wDAA8C;AAE9C,MAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"order-cancel.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-cancel.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAoE;AACpE,gDAAuC;AACvC,wDAA8C;AAE9C,MAAa,WAAW;IAMvB,QAAQ,CAAa;IAGrB,uBAAuB,CAAU;IAGjC,iBAAiB,CAAmB;I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AAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uEACP;AAG5C;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iEACb;AAGtC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0EACJ;AAG/C;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iEACb;AAGtC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0EACJ;AAG/C;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oEACV;AAGzC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6EACD;AAGlD;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gDAC9B;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACrB","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { LogUser, OrderCancelBy } from '../../../../utilities/enum';\nimport { Admin } from '../admin.model';\nimport { LineItem } from '../line-item.model';\n\nexport class OrderCancel {\n\t@prop({\n\t\ttype: [String],\n\t\tenum: LogUser,\n\t\tdefault: [],\n\t})\n\tlogusers!: LogUser[];\n\n\t@prop({ type: Boolean, default: false })\n\tisEndorseLossApplicable: Boolean;\n\n\t@prop({ ref: () => LineItem, default: [] })\n\tselectedLineItems?: Ref<LineItem>[];\n\n\t@prop({ type: Boolean, default: false })\n\tdeliveryFeeIncludedInEndorsement?: Boolean;\n\n\t@prop({ type: String, enum: OrderCancelBy })\n\tcanceledBy: string;\n\n\t@prop({ ref: () => Admin })\n\tadmin?: Ref<Admin>;\n\n\t@prop({ type: String })\n\tcancelReason?: string;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tendorseLossByShopForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryEndorseLossByShopForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tendorseLossByShopForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryEndorseLossByShopForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tendorseLossByCompanyForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryEndorseLossByCompanyForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tendorseLossByCompanyForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryEndorseLossByCompanyForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\ttotalAmount!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryTotalAmount!: number;\n}\n"]}
|
|
@@ -37,6 +37,7 @@ let LineItem = class LineItem extends defaultClasses_1.TimeStamps {
|
|
|
37
37
|
attributes;
|
|
38
38
|
removedIngredients;
|
|
39
39
|
specialInstructions;
|
|
40
|
+
calculationSnap;
|
|
40
41
|
};
|
|
41
42
|
exports.LineItem = LineItem;
|
|
42
43
|
__decorate([
|
|
@@ -95,6 +96,10 @@ __decorate([
|
|
|
95
96
|
(0, typegoose_1.prop)(),
|
|
96
97
|
__metadata("design:type", String)
|
|
97
98
|
], LineItem.prototype, "specialInstructions", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typegoose_1.prop)({ type: typegoose_1.mongoose.Schema.Types.Mixed }),
|
|
101
|
+
__metadata("design:type", Object)
|
|
102
|
+
], LineItem.prototype, "calculationSnap", void 0);
|
|
98
103
|
exports.LineItem = LineItem = __decorate([
|
|
99
104
|
(0, typegoose_1.modelOptions)({
|
|
100
105
|
schemaOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0F;AAC1F,4EAAqE;AACrE,6CAAoC;AACpC,mDAA0C;AAC1C,4EAAkE;AAClE,kDAAgE;AAChE,oFAAyE;AACzE,6CAAoC;AACpC,6CAAoC;AACpC,iDAAwC;AACxC,qDAA4C;AAC5C,uDAA8C;AAmBvC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IAEhC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB,QAAQ,CAAiB;IAGzB,OAAO,CAAgB;IAGvB,UAAU,CAAoB;IAG9B,QAAQ,CAAU;IAGlB,WAAW,CAAe;IAG1B,cAAc,CAAiB;IAG/B,UAAU,CAAuB;IAGjC,kBAAkB,CAAY;IAG9B,mBAAmB,CAAU;IAG7B,eAAe,CAA2B;CACjD,CAAA;AA7CY,4BAAQ;AAEb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;sCAClB;AAGjB;IADN,IAAA,gB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AG,EAAE,CAAC,CAAC,6CAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;4CACf;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;oDACP;AAG9B;IADN,IAAA,gBAAI,GAAE;;qDAC6B;AAG7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,oBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;;iDACK;mBA5CrC,QAAQ;IAdpB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,WAAW;YACvB,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;GACpB,QAAQ,CA6CpB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity, mongoose } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Cart } from './cart.model';\nimport { Product } from './product.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { ItemType, PriceOption } from '../../../utilities/enum';\nimport { LineItemAttribute } from './embedded/line-item-attribute.model';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Parent } from './parent.model';\nimport { Category } from './category.model';\nimport { Marketing } from './marketing.model';\n\n/**\n * LineItem model - Represents individual items in a cart\n */\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'lineItems',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ cart: 1 })\n@index({ cart: 1, user: 1 })\n@index({ product: 1 })\n@index({ shop: 1, deletedAt: 1 })\nexport class LineItem extends TimeStamps {\n\t@prop({ required: true, ref: () => Cart })\n\tpublic cart!: Ref<Cart>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent: Ref<Parent>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, ref: () => Category })\n\tpublic category!: Ref<Category>;\n\n\t@prop({ required: true, ref: () => Product })\n\tpublic product!: Ref<Product>;\n\n\t@prop({ ref: () => Marketing, default: [] })\n\tpublic marketings?: Ref<Marketing>[];\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\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 priceBreakdown: PriceBreakdown;\n\n\t@prop({ type: () => [LineItemAttribute], default: [] })\n\tpublic attributes?: LineItemAttribute[];\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic removedIngredients?: string[];\n\n\t@prop()\n\tpublic specialInstructions?: string;\n\n\t@prop({ type: mongoose.Schema.Types.Mixed })\n\tpublic calculationSnap?: Record<string, unknown>;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
+
import { Order } from './order.model';
|
|
4
|
+
import { PaymentMethod, PaymentStatus } from '../../../utilities/enum';
|
|
5
|
+
import { PaymentInformation } from './embedded/payment-infromation.model';
|
|
6
|
+
import { PaymentAttempt } from './embedded/payment-attempt.model';
|
|
7
|
+
export declare class OrderPayment extends TimeStamps {
|
|
8
|
+
order: Ref<Order>;
|
|
9
|
+
paymentMethod?: PaymentMethod;
|
|
10
|
+
paymentInformation?: PaymentInformation;
|
|
11
|
+
status?: PaymentStatus;
|
|
12
|
+
receiptUrl?: string;
|
|
13
|
+
attempts?: PaymentAttempt[];
|
|
14
|
+
currency: string;
|
|
15
|
+
amount: number;
|
|
16
|
+
secondaryAmount?: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OrderPayment = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
+
const order_model_1 = require("./order.model");
|
|
16
|
+
const enum_1 = require("../../../utilities/enum");
|
|
17
|
+
const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
|
|
18
|
+
const payment_attempt_model_1 = require("./embedded/payment-attempt.model");
|
|
19
|
+
let OrderPayment = class OrderPayment extends defaultClasses_1.TimeStamps {
|
|
20
|
+
order;
|
|
21
|
+
paymentMethod;
|
|
22
|
+
paymentInformation;
|
|
23
|
+
status;
|
|
24
|
+
receiptUrl;
|
|
25
|
+
attempts;
|
|
26
|
+
currency;
|
|
27
|
+
amount;
|
|
28
|
+
secondaryAmount;
|
|
29
|
+
};
|
|
30
|
+
exports.OrderPayment = OrderPayment;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typegoose_1.prop)({ required: true, ref: () => order_model_1.Order, index: true, unique: true }),
|
|
33
|
+
__metadata("design:type", Object)
|
|
34
|
+
], OrderPayment.prototype, "order", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentMethod, default: enum_1.PaymentMethod.CASH }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], OrderPayment.prototype, "paymentMethod", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation }),
|
|
41
|
+
__metadata("design:type", payment_infromation_model_1.PaymentInformation)
|
|
42
|
+
], OrderPayment.prototype, "paymentInformation", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentStatus, default: enum_1.PaymentStatus.PENDING }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], OrderPayment.prototype, "status", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)(),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], OrderPayment.prototype, "receiptUrl", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ type: [payment_attempt_model_1.PaymentAttempt], default: [] }),
|
|
53
|
+
__metadata("design:type", Array)
|
|
54
|
+
], OrderPayment.prototype, "attempts", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], OrderPayment.prototype, "currency", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typegoose_1.prop)({ required: true, type: Number }),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], OrderPayment.prototype, "amount", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typegoose_1.prop)({ type: Number }),
|
|
65
|
+
__metadata("design:type", Number)
|
|
66
|
+
], OrderPayment.prototype, "secondaryAmount", void 0);
|
|
67
|
+
exports.OrderPayment = OrderPayment = __decorate([
|
|
68
|
+
(0, typegoose_1.modelOptions)({
|
|
69
|
+
schemaOptions: {
|
|
70
|
+
timestamps: true,
|
|
71
|
+
collection: 'orderPayments',
|
|
72
|
+
toJSON: { virtuals: true },
|
|
73
|
+
toObject: { virtuals: true },
|
|
74
|
+
},
|
|
75
|
+
options: {
|
|
76
|
+
allowMixed: typegoose_1.Severity.ALLOW,
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
(0, typegoose_1.index)({ order: 1 }),
|
|
80
|
+
(0, typegoose_1.index)({ status: 1 }),
|
|
81
|
+
(0, typegoose_1.index)({ paymentMethod: 1 }),
|
|
82
|
+
(0, typegoose_1.index)({ createdAt: -1 })
|
|
83
|
+
], OrderPayment);
|
|
84
|
+
//# sourceMappingURL=order-payment.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-payment.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order-payment.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,+CAAsC;AACtC,kDAAuE;AACvE,oFAA0E;AAC1E,4EAAkE;AAiB3D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,2BAAU;IAE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AAE,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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OrderFinance } from '../order-finance.model';
|
|
2
|
+
import { OrderType } from '../../../../utilities/enum';
|
|
3
|
+
import { CourierOrderProfit } from '../embedded/profit.model';
|
|
4
|
+
export declare class CourierOrderFinance extends OrderFinance {
|
|
5
|
+
orderType: OrderType.COURIER;
|
|
6
|
+
companyProfit?: CourierOrderProfit;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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.CourierOrderFinance = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const order_finance_model_1 = require("../order-finance.model");
|
|
15
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
16
|
+
const profit_model_1 = require("../embedded/profit.model");
|
|
17
|
+
class CourierOrderFinance extends order_finance_model_1.OrderFinance {
|
|
18
|
+
orderType = enum_1.OrderType.COURIER;
|
|
19
|
+
companyProfit;
|
|
20
|
+
}
|
|
21
|
+
exports.CourierOrderFinance = CourierOrderFinance;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typegoose_1.prop)({ type: () => profit_model_1.CourierOrderProfit }),
|
|
24
|
+
__metadata("design:type", profit_model_1.CourierOrderProfit)
|
|
25
|
+
], CourierOrderFinance.prototype, "companyProfit", void 0);
|
|
26
|
+
//# sourceMappingURL=courier-order-finance.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"courier-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/courier-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,gEAAsD;AACtD,qDAAuD;AACvD,2DAA8D;AAE9D,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,aAAa,CAAsB;CAC1C;AALD,kDAKC;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BAClB,iCAAkB;0DAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { OrderType } from '../../../../utilities/enum';\nimport { CourierOrderProfit } from '../embedded/profit.model';\n\nexport class CourierOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.COURIER as const;\n\n\t@prop({ type: () => CourierOrderProfit })\n\tpublic companyProfit?: CourierOrderProfit;\n}\n"]}
|
|
@@ -63,6 +63,7 @@ class CourierOrder extends order_model_1.Order {
|
|
|
63
63
|
deliveryAddress;
|
|
64
64
|
items;
|
|
65
65
|
finance;
|
|
66
|
+
adjustedFinance;
|
|
66
67
|
}
|
|
67
68
|
exports.CourierOrder = CourierOrder;
|
|
68
69
|
__decorate([
|
|
@@ -97,4 +98,8 @@ __decorate([
|
|
|
97
98
|
(0, typegoose_1.prop)({ required: true, type: courier_order_finance_model_1.CourierOrderFinance }),
|
|
98
99
|
__metadata("design:type", courier_order_finance_model_1.CourierOrderFinance)
|
|
99
100
|
], CourierOrder.prototype, "finance", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, typegoose_1.prop)({ type: courier_order_finance_model_1.CourierOrderFinance }),
|
|
103
|
+
__metadata("design:type", courier_order_finance_model_1.CourierOrderFinance)
|
|
104
|
+
], CourierOrder.prototype, "adjustedFinance", void 0);
|
|
100
105
|
//# sourceMappingURL=courier-order.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courier-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/courier-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,gDAAuC;AACvC,qDAA+F;AAC/F,2DAAyD;AACzD,6EAA+E;AAC/E,yFAA8E;AAE9E,MAAM,WAAW;IAET,WAAW,CAAS;IAGpB,YAAY,CAAU;IAGtB,QAAQ,CAAS;IAGjB,SAAS,CAAU;IAGnB,kBAAkB,CAAU;IAG5B,UAAU,CAAU;IAGpB,mBAAmB,CAAU;CACpC;AAnBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACE;AAGpB;IADN,IAAA,gBAAI,GAAE;;iDACsB;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;6CACT;AAGjB;IADN,IAAA,gBAAI,GAAE;;8CACmB;AAGnB;IADN,IAAA,gBAAI,GAAE;;uDAC4B;AAG5B;IADN,IAAA,gBAAI,GAAE;;+CACoB;AAGpB;IADN,IAAA,gBAAI,GAAE;;wDAC6B;AAGrC,MAAa,YAAa,SAAQ,mBAAK;IAC/B,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,MAAM,CAA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AAI,EAAE,yBAAkB,EAAE,OAAO,EAAE,yBAAkB,CAAC,MAAM,EAAE,CAAC;;4CACnD;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,kDAA0B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;oDACZ;AAG7C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACI;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAkB,EAAE,CAAC;;iDACzB;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8BAAc,EAAE,CAAC;8BAC9B,8BAAc;mDAAC;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,8BAAc,EAAE,CAAC;8BACtB,8BAAc;qDAAC;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;2CACpB;AAGtB;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 } from '@typegoose/typegoose';\nimport { Order } from '../order.model';\nimport { CourierOrderStatus, CourierServiceType, OrderType } from '../../../../utilities/enum';\nimport { CourierAddress } from '../shared/address.model';\nimport { CourierOrderStatusTimeline } from '../embedded/status-timeline.model';\nimport { CourierOrderFinance } from '../embedded/courier-order-finance.model';\n\nclass CourierItem {\n\t@prop({ required: true })\n\tpublic productName: string;\n\n\t@prop()\n\tpublic productImage?: string;\n\n\t@prop({ required: true, min: 1 })\n\tpublic quantity: number;\n\n\t@prop()\n\tpublic unitPrice?: number;\n\n\t@prop()\n\tpublic secondaryUnitPrice?: number;\n\n\t@prop()\n\tpublic totalPrice?: number;\n\n\t@prop()\n\tpublic secondaryTotalPrice?: number;\n}\n\nexport class CourierOrder extends Order {\n\tpublic orderType = OrderType.COURIER as const;\n\n\t@prop({ type: String, enum: CourierOrderStatus, default: CourierOrderStatus.PLACED })\n\tpublic status: CourierOrderStatus;\n\n\t@prop({ type: () => [CourierOrderStatusTimeline], default: [] })\n\tpublic statusTimeline: CourierOrderStatusTimeline[];\n\n\t@prop({ type: String })\n\tpublic description: string;\n\n\t@prop({ required: true, type: String, enum: CourierServiceType })\n\tpublic courierType!: CourierServiceType;\n\n\t@prop({ required: true, type: () => CourierAddress })\n\tpublic pickupAddress!: CourierAddress;\n\n\t@prop({ required: true, type: CourierAddress })\n\tpublic deliveryAddress!: CourierAddress;\n\n\t@prop({ type: () => [CourierItem], default: [] })\n\tpublic items?: CourierItem[];\n\n\t@prop({ required: true, type: CourierOrderFinance })\n\tpublic finance: CourierOrderFinance;\n\n\t@prop({ type: CourierOrderFinance })\n\tpublic adjustedFinance?: CourierOrderFinance;\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { OrderFinance } from '../order-finance.model';
|
|
3
|
+
import { ItemType, OrderType } from '../../../../utilities/enum';
|
|
4
|
+
import { RegularOrderProfit } from '../embedded/profit.model';
|
|
5
|
+
import { Vat } from '../embedded/vat.model';
|
|
6
|
+
import { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';
|
|
7
|
+
import { Parent } from '../parent.model';
|
|
8
|
+
import { Shop } from '../shop.model';
|
|
9
|
+
export declare class RegularOrderFinance extends OrderFinance {
|
|
10
|
+
orderType: OrderType.REGULAR;
|
|
11
|
+
parent: Ref<Parent>;
|
|
12
|
+
shop: Ref<Shop>;
|
|
13
|
+
itemType: ItemType;
|
|
14
|
+
isShopDelivery?: boolean;
|
|
15
|
+
companyProfit?: RegularOrderProfit;
|
|
16
|
+
shopProfit?: RegularOrderProfit;
|
|
17
|
+
vat?: Vat;
|
|
18
|
+
discount?: MarketingCut;
|
|
19
|
+
buy1get1?: MarketingCut;
|
|
20
|
+
loyaltyPoint?: LoyaltyPoint;
|
|
21
|
+
coupon?: CouponDetails;
|
|
22
|
+
freeDelivery?: MarketingCut;
|
|
23
|
+
replacementOrder?: MarketingCut;
|
|
24
|
+
endorseLoss?: MarketingCut;
|
|
25
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.RegularOrderFinance = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const order_finance_model_1 = require("../order-finance.model");
|
|
15
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
16
|
+
const profit_model_1 = require("../embedded/profit.model");
|
|
17
|
+
const vat_model_1 = require("../embedded/vat.model");
|
|
18
|
+
const marketing_cut_model_1 = require("../embedded/marketing-cut.model");
|
|
19
|
+
const parent_model_1 = require("../parent.model");
|
|
20
|
+
const shop_model_1 = require("../shop.model");
|
|
21
|
+
class RegularOrderFinance extends order_finance_model_1.OrderFinance {
|
|
22
|
+
orderType = enum_1.OrderType.REGULAR;
|
|
23
|
+
parent;
|
|
24
|
+
shop;
|
|
25
|
+
itemType;
|
|
26
|
+
isShopDelivery;
|
|
27
|
+
companyProfit;
|
|
28
|
+
shopProfit;
|
|
29
|
+
vat;
|
|
30
|
+
discount;
|
|
31
|
+
buy1get1;
|
|
32
|
+
loyaltyPoint;
|
|
33
|
+
coupon;
|
|
34
|
+
freeDelivery;
|
|
35
|
+
replacementOrder;
|
|
36
|
+
endorseLoss;
|
|
37
|
+
}
|
|
38
|
+
exports.RegularOrderFinance = RegularOrderFinance;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent, index: true }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], RegularOrderFinance.prototype, "parent", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop, index: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], RegularOrderFinance.prototype, "shop", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType, index: true }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], RegularOrderFinance.prototype, "itemType", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
53
|
+
__metadata("design:type", Boolean)
|
|
54
|
+
], RegularOrderFinance.prototype, "isShopDelivery", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typegoose_1.prop)({ type: () => profit_model_1.RegularOrderProfit }),
|
|
57
|
+
__metadata("design:type", profit_model_1.RegularOrderProfit)
|
|
58
|
+
], RegularOrderFinance.prototype, "companyProfit", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typegoose_1.prop)({ type: () => profit_model_1.RegularOrderProfit }),
|
|
61
|
+
__metadata("design:type", profit_model_1.RegularOrderProfit)
|
|
62
|
+
], RegularOrderFinance.prototype, "shopProfit", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, typegoose_1.prop)({ type: () => vat_model_1.Vat }),
|
|
65
|
+
__metadata("design:type", vat_model_1.Vat)
|
|
66
|
+
], RegularOrderFinance.prototype, "vat", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
69
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
70
|
+
], RegularOrderFinance.prototype, "discount", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
73
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
74
|
+
], RegularOrderFinance.prototype, "buy1get1", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.LoyaltyPoint }),
|
|
77
|
+
__metadata("design:type", marketing_cut_model_1.LoyaltyPoint)
|
|
78
|
+
], RegularOrderFinance.prototype, "loyaltyPoint", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.CouponDetails }),
|
|
81
|
+
__metadata("design:type", marketing_cut_model_1.CouponDetails)
|
|
82
|
+
], RegularOrderFinance.prototype, "coupon", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
85
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
86
|
+
], RegularOrderFinance.prototype, "freeDelivery", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
89
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
90
|
+
], RegularOrderFinance.prototype, "replacementOrder", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
(0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
|
|
93
|
+
__metadata("design:type", marketing_cut_model_1.MarketingCut)
|
|
94
|
+
], RegularOrderFinance.prototype, "endorseLoss", void 0);
|
|
95
|
+
//# sourceMappingURL=regular-order-finance.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regular-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/regular-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,gEAAsD;AACtD,qDAAiE;AACjE,2DAA8D;AAC9D,qDAA4C;AAC5C,yEAA4F;AAC5F,kDAAyC;AACzC,8CAAqC;AAErC,MAAa,mBAAoB,SAAQ,kCAAY;IAC7C,SAAS,GAAG,gBAAS,CAAC,OAAgB,CAAC;IAGvC,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,QAAQ,CAAY;IAGpB,cAAc,CAAW;IAGzB,aAAa,CAAsB;IAGnC,UAAU,CAAsB;IAGhC,GAAG,CAAO;IAGV,QAAQ,CAAgB;IAGxB,QAAQ,CAAgB;IAGxB,YAAY,CAAgB;IAG5B,MAAM,CAAiB;IAGvB,YAAY,CAAgB;IAG5B,gBAAgB,CAAgB;IAGhC,WAAW,CAAgB;CAClC;AA5CD,kDA4CC;AAxCO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;mDAC7B;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE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E,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACT,kCAAY;6DAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACd,kCAAY;wDAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { OrderFinance } from '../order-finance.model';\nimport { ItemType, OrderType } from '../../../../utilities/enum';\nimport { RegularOrderProfit } from '../embedded/profit.model';\nimport { Vat } from '../embedded/vat.model';\nimport { CouponDetails, LoyaltyPoint, MarketingCut } from '../embedded/marketing-cut.model';\nimport { Parent } from '../parent.model';\nimport { Shop } from '../shop.model';\n\nexport class RegularOrderFinance extends OrderFinance {\n\tpublic orderType = OrderType.REGULAR as const;\n\n\t@prop({ required: true, ref: () => Parent, index: true })\n\tpublic parent!: Ref<Parent>;\n\n\t@prop({ required: true, ref: () => Shop, index: true })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, enum: ItemType, index: true })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopDelivery?: boolean;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic companyProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic shopProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic discount?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic buy1get1?: MarketingCut;\n\n\t@prop({ type: () => LoyaltyPoint })\n\tpublic loyaltyPoint?: LoyaltyPoint;\n\n\t@prop({ type: () => CouponDetails })\n\tpublic coupon?: CouponDetails;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic freeDelivery?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic replacementOrder?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic endorseLoss?: MarketingCut;\n}\n"]}
|
|
@@ -37,6 +37,7 @@ class RegularOrder extends order_model_1.Order {
|
|
|
37
37
|
isRefunded;
|
|
38
38
|
refundInformation;
|
|
39
39
|
finance;
|
|
40
|
+
adjustedFinance;
|
|
40
41
|
}
|
|
41
42
|
exports.RegularOrder = RegularOrder;
|
|
42
43
|
__decorate([
|
|
@@ -99,4 +100,8 @@ __decorate([
|
|
|
99
100
|
(0, typegoose_1.prop)({ required: true, type: regular_order_finance_model_1.RegularOrderFinance }),
|
|
100
101
|
__metadata("design:type", regular_order_finance_model_1.RegularOrderFinance)
|
|
101
102
|
], RegularOrder.prototype, "finance", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typegoose_1.prop)({ required: true, type: regular_order_finance_model_1.RegularOrderFinance }),
|
|
105
|
+
__metadata("design:type", regular_order_finance_model_1.RegularOrderFinance)
|
|
106
|
+
], RegularOrder.prototype, "adjustedFinance", void 0);
|
|
102
107
|
//# sourceMappingURL=regular-order.model.js.map
|
|
@@ -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;AAE9E,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,UAAU,CAAW;IAGrB,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I,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iDAAmB,EAAE,CAAC;8BAC5B,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';\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: 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: Boolean, default: false })\n\tpublic isRefunded?: boolean;\n\n\t@prop({ type: OrderRefund })\n\tpublic refundInformation?: OrderRefund;\n\n\t@prop({ required: true, type: RegularOrderFinance })\n\tpublic finance: RegularOrderFinance;\n\n\t@prop({ required: true, type: RegularOrderFinance })\n\tpublic adjustedFinance: RegularOrderFinance;\n}\n"]}
|
|
@@ -66,6 +66,7 @@ let Shop = class Shop extends defaultClasses_1.TimeStamps {
|
|
|
66
66
|
favouriteCategoryTitle;
|
|
67
67
|
isBestSellerCategoryVisible;
|
|
68
68
|
bestSellerCategoryTitle;
|
|
69
|
+
orderCapacityEnabled;
|
|
69
70
|
};
|
|
70
71
|
exports.Shop = Shop;
|
|
71
72
|
__decorate([
|
|
@@ -228,6 +229,10 @@ __decorate([
|
|
|
228
229
|
(0, typegoose_1.prop)({ required: false, type: () => String }),
|
|
229
230
|
__metadata("design:type", String)
|
|
230
231
|
], Shop.prototype, "bestSellerCategoryTitle", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
(0, typegoose_1.prop)({ required: true, type: () => Boolean }),
|
|
234
|
+
__metadata("design:type", Boolean)
|
|
235
|
+
], Shop.prototype, "orderCapacityEnabled", void 0);
|
|
231
236
|
exports.Shop = Shop = __decorate([
|
|
232
237
|
(0, typegoose_1.modelOptions)({
|
|
233
238
|
schemaOptions: { collection: 'shops' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shop.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,4EAAqE;AACrE,kDAA6E;AAC7E,+CAAsC;AACtC,wEAA8D;AAC9D,iDAAwC;AACxC,0DAAiD;AACjD,8DAAyE;AACzE,2CAAkC;AAClC,6CAAoC;AACpC,wEAA8D;AAC9D,wBAA8B;AAC9B,sDAA8B;AAmDvB,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,SAAS,CAAU;IAGnB,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB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E,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnE,IAAI,IAAI,GAAG,QAAQ,CAAC;gBACpB,IAAI,KAAK,GAAG,CAAC,CAAC;gBACd,OAAO,MAAM,YAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;oBACzC,KAAK,EAAE,CAAC;oBACR,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;gBAC/B,CAAC;gBACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,IAAI,EAAE,CAAC;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAc,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CA0HhB","sourcesContent":["import { modelOptions, prop, Ref, Severity, Index, pre } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';\nimport { Brand } from './brand.model';\nimport { ShopDocument } from './embedded/shop-document.model';\nimport { Parent } from './parent.model';\nimport { Address } from './shared/address.model';\nimport { StartEndTime, WorkHourSetting } from './shared/work-hour.model';\nimport { Tag } from './tag.model';\nimport { Zone } from './zone.model';\nimport { DeliveryInfo } from './embedded/delivery-info.model';\nimport { ShopModel } from '.';\nimport slugify from 'slugify';\n\n@modelOptions({\n\tschemaOptions: { collection: 'shops' },\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@Index({ name: 1, itemType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ parent: 1, status: 1, isVisibleToUser: 1, deletedAt: 1 })\n@pre<Shop>('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 shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ShopModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\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\ttry {\n\t\tif (this.isNew) {\n\t\t\tconst baseSlug = slugify(this.name, { lower: true, strict: true });\n\t\t\tlet slug = baseSlug;\n\t\t\tlet count = 0;\n\t\t\twhile (await ShopModel.exists({ slug })) {\n\t\t\t\tcount++;\n\t\t\t\tslug = `${baseSlug}-${count}`;\n\t\t\t}\n\t\t\tthis.slug = slug;\n\t\t}\n\t\tnext();\n\t} catch (error) {\n\t\tnext(error as Error);\n\t}\n\tnext();\n})\nexport class Shop extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic ownerName!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ unique: true, type: String })\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent: Ref<Parent>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n\n\t@prop({ required: true, ref: () => Brand })\n\tpublic brand: Ref<Brand>;\n\n\t@prop({ type: Number, default: 1, min: 1, max: 4 })\n\tpublic priceRange?: number;\n\n\t@prop({ required: true, type: String })\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic userPhoneNumber!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic additionalPhoneNumbers?: string[];\n\n\t@prop({ required: true, type: Address })\n\tpublic address!: Address;\n\n\t@prop({ required: true, ref: () => Zone })\n\tpublic zone!: Ref<Zone>;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: String })\n\tpublic banner?: string;\n\n\t@prop({ type: ShopDocument })\n\tpublic document?: ShopDocument;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: ShopOnlineStatus,\n\t\tdefault: ShopOnlineStatus.OFFLINE,\n\t})\n\tpublic onlineStatus?: ShopOnlineStatus;\n\n\t@prop({ type: WorkHourSetting })\n\tpublic workHourSetting?: WorkHourSetting;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic dietaries?: string[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isBeirutAuthentic!: boolean;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUser!: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopDelivery?: boolean;\n\n\t@prop({ type: Number })\n\tpublic deliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic minimumOrderAmount?: number;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic orderCapacity?: number;\n\n\t@prop({ type: () => [StartEndTime], default: [] })\n\tpublic shopActiveTimingsOfCurrentDate?: StartEndTime[];\n\n\t@prop({ type: DeliveryInfo })\n\tpublic deliveryInfo?: DeliveryInfo;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t// Setting\n\t@prop({ type: Boolean, default: false })\n\tpublic allowSpecialInstructions?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRiderNoteVisible?: boolean;\n\n\t@prop({ type: String })\n\tpublic riderNote?: string;\n\n\t@prop({ type: Number, default: 10 })\n\tpublic defaultPreparationTime?: number;\n\n\t@prop({ type: Number, default: null })\n\texchangeRate?: number;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isFavouriteCategoryVisible?: boolean;\n\n\t@prop({ required: false, type: () => String })\n\tpublic favouriteCategoryTitle?: string;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isBestSellerCategoryVisible?: boolean;\n\n\t@prop({ required: false, type: () => String })\n\tpublic bestSellerCategoryTitle?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shop.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,4EAAqE;AACrE,kDAA6E;AAC7E,+CAAsC;AACtC,wEAA8D;AAC9D,iDAAwC;AACxC,0DAAiD;AACjD,8DAAyE;AACzE,2CAAkC;AAClC,6CAAoC;AACpC,wEAA8D;AAC9D,wBAA8B;AAC9B,sDAA8B;AAmDvB,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,SAAS,CAAU;IAGnB,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,MAAM,CAAc;IAGpB,QAAQ,CAAY;IAGpB,MAAM,CAAU;IAGhB,KAAK,CAAa;IAGlB,UAAU,CAAU;IAGpB,WAAW,CAAU;IAGrB,eAAe,CAAU;IAGzB,sBAAsB,CAAY;IAGlC,OAAO,CAAW;IAGlB,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,MAAM,CAAU;IAGhB,QAAQ,CAAgB;IAOxB,YAAY,CAAoB;IAGhC,eAAe,CAAmB;IAGlC,SAAS,CAAY;IAGrB,IAAI,CAAc;IAGlB,iBAAiB,CAAW;IAG5B,eAAe,CAAW;IAG1B,cAAc,CAAW;IAGzB,WAAW,CAAU;IAGrB,kBAAkB,CAAU;IAG5B,aAAa,CAAU;IAGvB,8BAA8B,CAAkB;IAGhD,YAAY,CAAgB;IAG5B,YAAY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AAC;YAClB,CAAC;YACD,IAAI,EAAE,CAAC;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAc,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CA6HhB","sourcesContent":["import { modelOptions, prop, Ref, Severity, Index, pre } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, ShopOnlineStatus, Status } from '../../../utilities/enum';\nimport { Brand } from './brand.model';\nimport { ShopDocument } from './embedded/shop-document.model';\nimport { Parent } from './parent.model';\nimport { Address } from './shared/address.model';\nimport { StartEndTime, WorkHourSetting } from './shared/work-hour.model';\nimport { Tag } from './tag.model';\nimport { Zone } from './zone.model';\nimport { DeliveryInfo } from './embedded/delivery-info.model';\nimport { ShopModel } from '.';\nimport slugify from 'slugify';\n\n@modelOptions({\n\tschemaOptions: { collection: 'shops' },\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@Index({ name: 1, itemType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ parent: 1, status: 1, isVisibleToUser: 1, deletedAt: 1 })\n@pre<Shop>('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 shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ShopModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\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\ttry {\n\t\tif (this.isNew) {\n\t\t\tconst baseSlug = slugify(this.name, { lower: true, strict: true });\n\t\t\tlet slug = baseSlug;\n\t\t\tlet count = 0;\n\t\t\twhile (await ShopModel.exists({ slug })) {\n\t\t\t\tcount++;\n\t\t\t\tslug = `${baseSlug}-${count}`;\n\t\t\t}\n\t\t\tthis.slug = slug;\n\t\t}\n\t\tnext();\n\t} catch (error) {\n\t\tnext(error as Error);\n\t}\n\tnext();\n})\nexport class Shop extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic ownerName!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ unique: true, type: String })\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => Parent })\n\tpublic parent: Ref<Parent>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n\n\t@prop({ required: true, ref: () => Brand })\n\tpublic brand: Ref<Brand>;\n\n\t@prop({ type: Number, default: 1, min: 1, max: 4 })\n\tpublic priceRange?: number;\n\n\t@prop({ required: true, type: String })\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic userPhoneNumber!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic additionalPhoneNumbers?: string[];\n\n\t@prop({ required: true, type: Address })\n\tpublic address!: Address;\n\n\t@prop({ required: true, ref: () => Zone })\n\tpublic zone!: Ref<Zone>;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: String })\n\tpublic banner?: string;\n\n\t@prop({ type: ShopDocument })\n\tpublic document?: ShopDocument;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: ShopOnlineStatus,\n\t\tdefault: ShopOnlineStatus.OFFLINE,\n\t})\n\tpublic onlineStatus?: ShopOnlineStatus;\n\n\t@prop({ type: WorkHourSetting })\n\tpublic workHourSetting?: WorkHourSetting;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic dietaries?: string[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isBeirutAuthentic!: boolean;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUser!: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isShopDelivery?: boolean;\n\n\t@prop({ type: Number })\n\tpublic deliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic minimumOrderAmount?: number;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic orderCapacity?: number;\n\n\t@prop({ type: () => [StartEndTime], default: [] })\n\tpublic shopActiveTimingsOfCurrentDate?: StartEndTime[];\n\n\t@prop({ type: DeliveryInfo })\n\tpublic deliveryInfo?: DeliveryInfo;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t// Setting\n\t@prop({ type: Boolean, default: false })\n\tpublic allowSpecialInstructions?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRiderNoteVisible?: boolean;\n\n\t@prop({ type: String })\n\tpublic riderNote?: string;\n\n\t@prop({ type: Number, default: 10 })\n\tpublic defaultPreparationTime?: number;\n\n\t@prop({ type: Number, default: null })\n\texchangeRate?: number;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isFavouriteCategoryVisible?: boolean;\n\n\t@prop({ required: false, type: () => String })\n\tpublic favouriteCategoryTitle?: string;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isBestSellerCategoryVisible?: boolean;\n\n\t@prop({ required: false, type: () => String })\n\tpublic bestSellerCategoryTitle?: string;\n\n\t@prop({ required: true, type: () => Boolean })\n\tpublic orderCapacityEnabled!: boolean\n}\n"]}
|