@lyxa.ai/core 1.0.256 → 1.0.258
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/embedded/package-discount-config.model.d.ts +6 -2
- package/dist/libraries/mongo/models/embedded/package-discount-config.model.js +14 -3
- package/dist/libraries/mongo/models/embedded/package-discount-config.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/slot-discount-config.model.d.ts +5 -2
- package/dist/libraries/mongo/models/embedded/slot-discount-config.model.js +14 -3
- package/dist/libraries/mongo/models/embedded/slot-discount-config.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-promotion.model.d.ts +10 -15
- package/dist/libraries/mongo/models/service-promotion.model.js +18 -39
- package/dist/libraries/mongo/models/service-promotion.model.js.map +1 -1
- package/dist/libraries/mongo/models/shared/service-duration.model.d.ts +4 -0
- package/dist/libraries/mongo/models/shared/service-duration.model.js +27 -0
- package/dist/libraries/mongo/models/shared/service-duration.model.js.map +1 -0
- package/dist/libraries/mongo/models/shared/slot.model.d.ts +4 -0
- package/dist/libraries/mongo/models/shared/slot.model.js +27 -0
- package/dist/libraries/mongo/models/shared/slot.model.js.map +1 -0
- package/dist/libraries/mongo/models/shop.model.d.ts +1 -1
- package/dist/libraries/mongo/models/shop.model.js +12 -23
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/types/utilities/enum.d.ts +1 -1
- package/dist/types/utilities/enum.js +6 -6
- package/dist/types/utilities/enum.js.map +1 -1
- package/dist/utilities/enum.d.ts +1 -1
- package/dist/utilities/enum.js +6 -6
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/pipelines/product-pipeline-stages.d.ts +4 -0
- package/dist/utilities/pipelines/product-pipeline-stages.js +233 -0
- package/dist/utilities/pipelines/product-pipeline-stages.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from "@typegoose/typegoose";
|
|
2
|
+
import { ServicePackage } from "../service-package.model";
|
|
2
3
|
import { ValueType } from "../../../../utilities/enum";
|
|
4
|
+
import { PromotionDuration } from "../shared/service-duration.model";
|
|
3
5
|
export declare class PackageDiscountConfig {
|
|
4
|
-
|
|
6
|
+
servicePackage: Ref<ServicePackage>;
|
|
7
|
+
duration: PromotionDuration;
|
|
5
8
|
type?: ValueType;
|
|
6
9
|
value?: number;
|
|
7
10
|
maxDiscountAmount?: number;
|
|
11
|
+
spendLimit: number;
|
|
8
12
|
}
|
|
@@ -11,18 +11,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PackageDiscountConfig = void 0;
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const
|
|
14
|
+
const service_package_model_1 = require("../service-package.model");
|
|
15
15
|
const enum_1 = require("../../../../utilities/enum");
|
|
16
|
+
const service_duration_model_1 = require("../shared/service-duration.model");
|
|
16
17
|
class PackageDiscountConfig {
|
|
18
|
+
servicePackage;
|
|
17
19
|
duration;
|
|
18
20
|
type;
|
|
19
21
|
value;
|
|
20
22
|
maxDiscountAmount;
|
|
23
|
+
spendLimit;
|
|
21
24
|
}
|
|
22
25
|
exports.PackageDiscountConfig = PackageDiscountConfig;
|
|
23
26
|
__decorate([
|
|
24
|
-
(0, typegoose_1.prop)({
|
|
25
|
-
__metadata("design:type",
|
|
27
|
+
(0, typegoose_1.prop)({ ref: () => service_package_model_1.ServicePackage, required: true }),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], PackageDiscountConfig.prototype, "servicePackage", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typegoose_1.prop)({ required: true, type: service_duration_model_1.PromotionDuration }),
|
|
32
|
+
__metadata("design:type", service_duration_model_1.PromotionDuration)
|
|
26
33
|
], PackageDiscountConfig.prototype, "duration", void 0);
|
|
27
34
|
__decorate([
|
|
28
35
|
(0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType }),
|
|
@@ -36,4 +43,8 @@ __decorate([
|
|
|
36
43
|
(0, typegoose_1.prop)({ min: 0 }),
|
|
37
44
|
__metadata("design:type", Number)
|
|
38
45
|
], PackageDiscountConfig.prototype, "maxDiscountAmount", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typegoose_1.prop)({ type: Number, required: true, min: 0 }),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], PackageDiscountConfig.prototype, "spendLimit", void 0);
|
|
39
50
|
//# sourceMappingURL=package-discount-config.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-discount-config.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/package-discount-config.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;
|
|
1
|
+
{"version":3,"file":"package-discount-config.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/package-discount-config.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,oEAA0D;AAC1D,qDAAuD;AACvD,6EAAqE;AAErE,MAAa,qBAAqB;IAEvB,cAAc,CAAsB;IAGpC,QAAQ,CAAoB;IAG5B,IAAI,CAAY;IAGhB,KAAK,CAAU;IAGf,iBAAiB,CAAU;IAG3B,UAAU,CAAU;CAC9B;AAlBD,sDAkBC;AAhBU;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6DACT;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,0CAAiB,EAAE,CAAC;8BAChC,0CAAiB;uDAAA;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;mDACjB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gEACiB;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;yDACpB","sourcesContent":["import { prop, Ref } from \"@typegoose/typegoose\";\nimport { ServicePackage } from \"../service-package.model\";\nimport { ValueType } from \"../../../../utilities/enum\";\nimport { PromotionDuration } from \"../shared/service-duration.model\";\n\nexport class PackageDiscountConfig {\n @prop({ ref: () => ServicePackage, required: true })\n public servicePackage!: Ref<ServicePackage>\n\n @prop({ required: true, type: PromotionDuration })\n public duration!: PromotionDuration\n\n @prop({ type: String, enum: ValueType })\n public type?: ValueType\n\n @prop({ type: Number })\n public value?: number;\n\n @prop({ min: 0 })\n public maxDiscountAmount?: number;\n\n @prop({ type: Number, required: true, min: 0 })\n public spendLimit!: number;\n}"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { Duration } from "../shared/duration.model";
|
|
2
1
|
import { ValueType } from "../../../../utilities/enum";
|
|
2
|
+
import { Slot } from "../shared/slot.model";
|
|
3
|
+
import { PromotionDuration } from "../shared/service-duration.model";
|
|
3
4
|
export declare class SlotDiscountConfig {
|
|
4
|
-
duration:
|
|
5
|
+
duration: PromotionDuration;
|
|
6
|
+
slot: Slot;
|
|
5
7
|
type?: ValueType;
|
|
6
8
|
value?: number;
|
|
7
9
|
maxDiscountAmount?: number;
|
|
10
|
+
spendLimit: number;
|
|
8
11
|
}
|
|
@@ -11,19 +11,26 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SlotDiscountConfig = void 0;
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
-
const duration_model_1 = require("../shared/duration.model");
|
|
15
14
|
const enum_1 = require("../../../../utilities/enum");
|
|
15
|
+
const slot_model_1 = require("../shared/slot.model");
|
|
16
|
+
const service_duration_model_1 = require("../shared/service-duration.model");
|
|
16
17
|
class SlotDiscountConfig {
|
|
17
18
|
duration;
|
|
19
|
+
slot;
|
|
18
20
|
type;
|
|
19
21
|
value;
|
|
20
22
|
maxDiscountAmount;
|
|
23
|
+
spendLimit;
|
|
21
24
|
}
|
|
22
25
|
exports.SlotDiscountConfig = SlotDiscountConfig;
|
|
23
26
|
__decorate([
|
|
24
|
-
(0, typegoose_1.prop)({ required: true, type:
|
|
25
|
-
__metadata("design:type",
|
|
27
|
+
(0, typegoose_1.prop)({ required: true, type: service_duration_model_1.PromotionDuration }),
|
|
28
|
+
__metadata("design:type", service_duration_model_1.PromotionDuration)
|
|
26
29
|
], SlotDiscountConfig.prototype, "duration", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typegoose_1.prop)({ required: true, type: slot_model_1.Slot }),
|
|
32
|
+
__metadata("design:type", slot_model_1.Slot)
|
|
33
|
+
], SlotDiscountConfig.prototype, "slot", void 0);
|
|
27
34
|
__decorate([
|
|
28
35
|
(0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType }),
|
|
29
36
|
__metadata("design:type", String)
|
|
@@ -36,4 +43,8 @@ __decorate([
|
|
|
36
43
|
(0, typegoose_1.prop)({ min: 0 }),
|
|
37
44
|
__metadata("design:type", Number)
|
|
38
45
|
], SlotDiscountConfig.prototype, "maxDiscountAmount", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typegoose_1.prop)({ type: Number, required: true, min: 0 }),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], SlotDiscountConfig.prototype, "spendLimit", void 0);
|
|
39
50
|
//# sourceMappingURL=slot-discount-config.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-discount-config.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/slot-discount-config.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;
|
|
1
|
+
{"version":3,"file":"slot-discount-config.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/slot-discount-config.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,qDAAuD;AACvD,qDAA4C;AAC5C,6EAAqE;AAErE,MAAa,kBAAkB;IAEpB,QAAQ,CAAoB;IAG5B,IAAI,CAAO;IAGX,IAAI,CAAY;IAGhB,KAAK,CAAU;IAGf,iBAAiB,CAAU;IAG3B,UAAU,CAAU;CAC9B;AAlBD,gDAkBC;AAhBU;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,0CAAiB,EAAE,CAAC;8BAChC,0CAAiB;oDAAA;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAI,EAAE,CAAC;8BACvB,iBAAI;gDAAA;AAGX;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;gDACjB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;6DACiB;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;sDACpB","sourcesContent":["import { prop } from \"@typegoose/typegoose\";\nimport { Duration } from \"../shared/duration.model\";\nimport { ValueType } from \"../../../../utilities/enum\";\nimport { Slot } from \"../shared/slot.model\";\nimport { PromotionDuration } from \"../shared/service-duration.model\";\n\nexport class SlotDiscountConfig {\n @prop({ required: true, type: PromotionDuration })\n public duration!: PromotionDuration\n\n @prop({ required: true, type: Slot })\n public slot!: Slot\n\n @prop({ type: String, enum: ValueType })\n public type?: ValueType\n\n @prop({ type: Number })\n public value?: number;\n\n @prop({ min: 0 })\n public maxDiscountAmount?: number;\n\n @prop({ type: Number, required: true, min: 0 })\n public spendLimit!: number;\n}"]}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import { Ref } from
|
|
2
|
-
import { Vendor } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { SlotDiscountConfig } from "./embedded/slot-discount-config.model";
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { Vendor } from './vendor.model';
|
|
3
|
+
import { MarketingStatus, PromotionType } from '../../../utilities/enum';
|
|
4
|
+
import { PackageDiscountConfig } from './embedded/package-discount-config.model';
|
|
5
|
+
import { SlotDiscountConfig } from './embedded/slot-discount-config.model';
|
|
7
6
|
export declare class ServicePromotion {
|
|
8
7
|
vendor: Ref<Vendor>;
|
|
9
|
-
|
|
10
|
-
type?: ValueType;
|
|
11
|
-
value?: number;
|
|
12
|
-
discountType: DiscountType;
|
|
8
|
+
promotionType: PromotionType;
|
|
13
9
|
status?: MarketingStatus;
|
|
14
|
-
duration: Duration;
|
|
15
|
-
spendLimit: number;
|
|
16
|
-
spentAmount: number;
|
|
17
|
-
marketingType: ServiceMarketingType;
|
|
18
|
-
deactivationReason?: string;
|
|
19
10
|
packageDiscounts?: PackageDiscountConfig[];
|
|
20
11
|
slotDiscounts?: SlotDiscountConfig[];
|
|
12
|
+
spendLimit?: number;
|
|
13
|
+
spentAmount?: number;
|
|
14
|
+
deactivationReason?: string;
|
|
15
|
+
description?: string;
|
|
21
16
|
}
|
|
@@ -13,23 +13,18 @@ exports.ServicePromotion = void 0;
|
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
14
|
const vendor_model_1 = require("./vendor.model");
|
|
15
15
|
const enum_1 = require("../../../utilities/enum");
|
|
16
|
-
const duration_model_1 = require("./shared/duration.model");
|
|
17
16
|
const package_discount_config_model_1 = require("./embedded/package-discount-config.model");
|
|
18
17
|
const slot_discount_config_model_1 = require("./embedded/slot-discount-config.model");
|
|
19
18
|
let ServicePromotion = class ServicePromotion {
|
|
20
19
|
vendor;
|
|
21
|
-
|
|
22
|
-
type;
|
|
23
|
-
value;
|
|
24
|
-
discountType;
|
|
20
|
+
promotionType;
|
|
25
21
|
status;
|
|
26
|
-
|
|
22
|
+
packageDiscounts;
|
|
23
|
+
slotDiscounts;
|
|
27
24
|
spendLimit;
|
|
28
25
|
spentAmount;
|
|
29
|
-
marketingType;
|
|
30
26
|
deactivationReason;
|
|
31
|
-
|
|
32
|
-
slotDiscounts;
|
|
27
|
+
description;
|
|
33
28
|
};
|
|
34
29
|
exports.ServicePromotion = ServicePromotion;
|
|
35
30
|
__decorate([
|
|
@@ -37,21 +32,9 @@ __decorate([
|
|
|
37
32
|
__metadata("design:type", Object)
|
|
38
33
|
], ServicePromotion.prototype, "vendor", void 0);
|
|
39
34
|
__decorate([
|
|
40
|
-
(0, typegoose_1.prop)({
|
|
35
|
+
(0, typegoose_1.prop)({ enum: enum_1.PromotionType, required: true }),
|
|
41
36
|
__metadata("design:type", String)
|
|
42
|
-
], ServicePromotion.prototype, "
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType }),
|
|
45
|
-
__metadata("design:type", String)
|
|
46
|
-
], ServicePromotion.prototype, "type", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, typegoose_1.prop)({ type: Number }),
|
|
49
|
-
__metadata("design:type", Number)
|
|
50
|
-
], ServicePromotion.prototype, "value", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
(0, typegoose_1.prop)({ enum: enum_1.DiscountType, required: true }),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], ServicePromotion.prototype, "discountType", void 0);
|
|
37
|
+
], ServicePromotion.prototype, "promotionType", void 0);
|
|
55
38
|
__decorate([
|
|
56
39
|
(0, typegoose_1.prop)({
|
|
57
40
|
type: String,
|
|
@@ -61,33 +44,29 @@ __decorate([
|
|
|
61
44
|
__metadata("design:type", String)
|
|
62
45
|
], ServicePromotion.prototype, "status", void 0);
|
|
63
46
|
__decorate([
|
|
64
|
-
(0, typegoose_1.prop)({
|
|
65
|
-
__metadata("design:type",
|
|
66
|
-
], ServicePromotion.prototype, "
|
|
47
|
+
(0, typegoose_1.prop)({ type: () => [package_discount_config_model_1.PackageDiscountConfig] }),
|
|
48
|
+
__metadata("design:type", Array)
|
|
49
|
+
], ServicePromotion.prototype, "packageDiscounts", void 0);
|
|
67
50
|
__decorate([
|
|
68
|
-
(0, typegoose_1.prop)({
|
|
51
|
+
(0, typegoose_1.prop)({ type: () => [slot_discount_config_model_1.SlotDiscountConfig] }),
|
|
52
|
+
__metadata("design:type", Array)
|
|
53
|
+
], ServicePromotion.prototype, "slotDiscounts", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
69
56
|
__metadata("design:type", Number)
|
|
70
57
|
], ServicePromotion.prototype, "spendLimit", void 0);
|
|
71
58
|
__decorate([
|
|
72
|
-
(0, typegoose_1.prop)({ default: 0, min: 0 }),
|
|
59
|
+
(0, typegoose_1.prop)({ type: Number, default: 0, min: 0 }),
|
|
73
60
|
__metadata("design:type", Number)
|
|
74
61
|
], ServicePromotion.prototype, "spentAmount", void 0);
|
|
75
|
-
__decorate([
|
|
76
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.ServiceMarketingType, required: true }),
|
|
77
|
-
__metadata("design:type", String)
|
|
78
|
-
], ServicePromotion.prototype, "marketingType", void 0);
|
|
79
62
|
__decorate([
|
|
80
63
|
(0, typegoose_1.prop)({ type: String }),
|
|
81
64
|
__metadata("design:type", String)
|
|
82
65
|
], ServicePromotion.prototype, "deactivationReason", void 0);
|
|
83
66
|
__decorate([
|
|
84
|
-
(0, typegoose_1.prop)({ type:
|
|
85
|
-
__metadata("design:type",
|
|
86
|
-
], ServicePromotion.prototype, "
|
|
87
|
-
__decorate([
|
|
88
|
-
(0, typegoose_1.prop)({ type: () => [slot_discount_config_model_1.SlotDiscountConfig] }),
|
|
89
|
-
__metadata("design:type", Array)
|
|
90
|
-
], ServicePromotion.prototype, "slotDiscounts", void 0);
|
|
67
|
+
(0, typegoose_1.prop)({ type: String, trim: true, maxlength: 500 }),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], ServicePromotion.prototype, "description", void 0);
|
|
91
70
|
exports.ServicePromotion = ServicePromotion = __decorate([
|
|
92
71
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'servicePromotions' } })
|
|
93
72
|
], ServicePromotion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-promotion.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-promotion.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,iDAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"service-promotion.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-promotion.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,iDAAwC;AACxC,kDAA0G;AAE1G,4FAAiF;AACjF,sFAA2E;AAGpE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAElB,MAAM,CAAe;IAGrB,aAAa,CAAiB;IAO9B,MAAM,CAAmB;IAGzB,gBAAgB,CAA2B;IAG3C,aAAa,CAAwB;IAGrC,UAAU,CAAU;IAGpB,WAAW,CAAU;IAIrB,kBAAkB,CAAU;IAG5B,WAAW,CAAU;CAC/B,CAAA;AAhCY,4CAAgB;AAElB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAChB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,oBAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACT;AAO9B;IALN,IAAA,gBAAI,EAAC;QACF,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,sBAAe;QACrB,OAAO,EAAE,sBAAe,CAAC,MAAM;KAClC,CAAC;;gDAC8B;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,qDAAqB,CAAC,EAAE,CAAC;;0DACI;AAG3C;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,+CAAkB,CAAC,EAAE,CAAC;;uDACC;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;oDACJ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qDACf;AAIrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DACY;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;qDACvB;2BA/BnB,gBAAgB;IAD5B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,EAAE,CAAC;GACxD,gBAAgB,CAgC5B","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { Vendor } from './vendor.model';\nimport { MarketingStatus, PromotionType, ServiceMarketingType, ValueType } from '../../../utilities/enum';\nimport { Duration } from './shared/duration.model';\nimport { PackageDiscountConfig } from './embedded/package-discount-config.model';\nimport { SlotDiscountConfig } from './embedded/slot-discount-config.model';\n\n@modelOptions({ schemaOptions: { collection: 'servicePromotions' } })\nexport class ServicePromotion {\n @prop({ ref: () => Vendor, required: true })\n public vendor!: Ref<Vendor>;\n\n @prop({ enum: PromotionType, required: true })\n public promotionType!: PromotionType;\n\n @prop({\n type: String,\n enum: MarketingStatus,\n default: MarketingStatus.ACTIVE,\n })\n public status?: MarketingStatus;\n\n @prop({ type: () => [PackageDiscountConfig] })\n public packageDiscounts?: PackageDiscountConfig[];\n\n @prop({ type: () => [SlotDiscountConfig] })\n public slotDiscounts?: SlotDiscountConfig[];\n\n @prop({ type: Number, min: 0 })\n public spendLimit?: number;\n\n @prop({ type: Number, default: 0, min: 0 })\n public spentAmount?: number;\n\n\n @prop({ type: String })\n public deactivationReason?: string;\n\n @prop({ type: String, trim: true, maxlength: 500 })\n public description?: string;\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.PromotionDuration = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
class PromotionDuration {
|
|
15
|
+
start;
|
|
16
|
+
end;
|
|
17
|
+
}
|
|
18
|
+
exports.PromotionDuration = PromotionDuration;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typegoose_1.prop)({ required: true, type: Date }),
|
|
21
|
+
__metadata("design:type", Date)
|
|
22
|
+
], PromotionDuration.prototype, "start", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
25
|
+
__metadata("design:type", Date)
|
|
26
|
+
], PromotionDuration.prototype, "end", void 0);
|
|
27
|
+
//# sourceMappingURL=service-duration.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-duration.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/service-duration.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,iBAAiB;IAEnB,KAAK,CAAQ;IAGb,GAAG,CAAQ;CACrB;AAND,8CAMC;AAJU;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACtB,IAAI;gDAAC;AAGb;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACR,IAAI;8CAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class PromotionDuration {\n @prop({ required: true, type: Date })\n public start!: Date;\n\n @prop({ type: Date })\n public end?: Date;\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.Slot = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
class Slot {
|
|
15
|
+
startTime;
|
|
16
|
+
endTime;
|
|
17
|
+
}
|
|
18
|
+
exports.Slot = Slot;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], Slot.prototype, "startTime", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], Slot.prototype, "endTime", void 0);
|
|
27
|
+
//# sourceMappingURL=slot.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/slot.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,IAAI;IAEN,SAAS,CAAS;IAGlB,OAAO,CAAQ;CACzB;AAND,oBAMC;AAJU;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;;uCACC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qCACH","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class Slot {\n @prop({ required: true})\n public startTime!: string\n\n @prop({ required: true })\n public endTime: string\n}\n"]}
|
|
@@ -9,10 +9,10 @@ import { StartEndTime, WorkHourSetting } from './shared/work-hour.model';
|
|
|
9
9
|
import { Tag } from './tag.model';
|
|
10
10
|
import { DeliveryInfo } from './embedded/delivery-info.model';
|
|
11
11
|
export declare class Shop extends TimeStamps {
|
|
12
|
+
shopId: string;
|
|
12
13
|
name: string;
|
|
13
14
|
ownerName: string;
|
|
14
15
|
email: string;
|
|
15
|
-
slug?: string;
|
|
16
16
|
parent: Ref<Parent>;
|
|
17
17
|
itemType: ItemType;
|
|
18
18
|
status: Status;
|
|
@@ -8,9 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.Shop = void 0;
|
|
16
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
@@ -24,12 +21,11 @@ const work_hour_model_1 = require("./shared/work-hour.model");
|
|
|
24
21
|
const tag_model_1 = require("./tag.model");
|
|
25
22
|
const delivery_info_model_1 = require("./embedded/delivery-info.model");
|
|
26
23
|
const _1 = require(".");
|
|
27
|
-
const slugify_1 = __importDefault(require("slugify"));
|
|
28
24
|
let Shop = class Shop extends defaultClasses_1.TimeStamps {
|
|
25
|
+
shopId;
|
|
29
26
|
name;
|
|
30
27
|
ownerName;
|
|
31
28
|
email;
|
|
32
|
-
slug;
|
|
33
29
|
parent;
|
|
34
30
|
itemType;
|
|
35
31
|
status;
|
|
@@ -71,6 +67,10 @@ let Shop = class Shop extends defaultClasses_1.TimeStamps {
|
|
|
71
67
|
vat_reg_number;
|
|
72
68
|
};
|
|
73
69
|
exports.Shop = Shop;
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typegoose_1.prop)({ type: String, unique: true }),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], Shop.prototype, "shopId", void 0);
|
|
74
74
|
__decorate([
|
|
75
75
|
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
76
76
|
__metadata("design:type", String)
|
|
@@ -83,10 +83,6 @@ __decorate([
|
|
|
83
83
|
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
84
84
|
__metadata("design:type", String)
|
|
85
85
|
], Shop.prototype, "email", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
(0, typegoose_1.prop)({ unique: true, type: String }),
|
|
88
|
-
__metadata("design:type", String)
|
|
89
|
-
], Shop.prototype, "slug", void 0);
|
|
90
86
|
__decorate([
|
|
91
87
|
(0, typegoose_1.prop)({ required: true, ref: () => parent_model_1.Parent }),
|
|
92
88
|
__metadata("design:type", Object)
|
|
@@ -278,21 +274,14 @@ exports.Shop = Shop = __decorate([
|
|
|
278
274
|
return next(error);
|
|
279
275
|
}
|
|
280
276
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
slug = `${baseSlug}-${count}`;
|
|
289
|
-
}
|
|
290
|
-
this.slug = slug;
|
|
277
|
+
if (typeof this.shopId === 'undefined') {
|
|
278
|
+
try {
|
|
279
|
+
const counter = await _1.CounterModel.findOneAndUpdate({ counterType: enum_1.CounterType.shop }, { $inc: { value: 1 } }, { new: true, upsert: true });
|
|
280
|
+
this.shopId = counter.value.toString().padStart(5, '0');
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
next(error);
|
|
291
284
|
}
|
|
292
|
-
next();
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
next(error);
|
|
296
285
|
}
|
|
297
286
|
next();
|
|
298
287
|
})
|
|
@@ -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;AACt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E,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,CAsIhB","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 { 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 }, { partialFilterExpression: { deletedAt: null } })\n@index({ status: 1, createdAt: -1 }, { partialFilterExpression: { deletedAt: null } })\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({ 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\t@prop({ default: 0, type: () => Number })\n\tpublic avgRating?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic ordersCount?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic customersCount?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic vat_reg_number?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shop.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shop.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAqF;AACrF,4EAAqE;AACrE,kDAA0F;AAC1F,+CAAsC;AACtC,wEAA8D;AAC9D,iDAAwC;AACxC,0DAAiD;AACjD,8DAAyE;AACzE,2CAAkC;AAClC,wEAA8D;AAC9D,wBAA4C;AAoDrC,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,MAAM,CAAS;IAGf,IAAI,CAAU;IAGd,SAAS,CAAU;IAGnB,KAAK,CAAU;IAGf,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,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,CAAU;IAItB,wBAAwB,CAAW;IA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AAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QAED,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC;gBACJ,MAAM,OAAO,GAAG,MAAM,eAAY,CAAC,gBAAgB,CAClD,EAAE,WAAW,EAAE,kBAAW,CAAC,IAAI,EAAE,EACjC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EACtB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAC3B,CAAC;gBAEF,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACzD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,KAAc,CAAC,CAAC;YACtB,CAAC;QACF,CAAC;QAED,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CAsIhB","sourcesContent":["import { modelOptions, prop, Ref, Severity, index, pre } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { CounterType, 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 { DeliveryInfo } from './embedded/delivery-info.model';\nimport { CounterModel, ShopModel } from '.';\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 }, { partialFilterExpression: { deletedAt: null } })\n@index({ status: 1, createdAt: -1 }, { partialFilterExpression: { deletedAt: null } })\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\t// Set shopId\n\tif (typeof this.shopId === 'undefined') {\n\t\ttry {\n\t\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t\t{ counterType: CounterType.shop },\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\tthis.shopId = counter.value.toString().padStart(5, '0');\n\t\t} catch (error) {\n\t\t\tnext(error as Error);\n\t\t}\n\t}\n\n\tnext();\n})\nexport class Shop extends TimeStamps {\n\t@prop({ type: String, unique: true })\n\tpublic shopId: string;\n\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({ 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({ 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\t@prop({ default: 0, type: () => Number })\n\tpublic avgRating?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic ordersCount?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic customersCount?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic vat_reg_number?: number;\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MarketingStatus = exports.ServiceMarketingType = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobChannelType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.VendorRole = exports.ShopRole = exports.OnlineStatus = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.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 = exports.AgentLiveStatus = void 0;
|
|
4
4
|
exports.ServiceOrderPriority = exports.ProfessionalStatus = exports.Service = exports.ServiceCartStatus = exports.SocketEventType = exports.ChatroomType = exports.UserRef = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.UrgentOrderReason = exports.LateOrderReason = exports.OrderCanceledBy = 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.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.ShopCourierOrderStatus = exports.ServiceOrderStatus = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.OrderSize = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.LiveStatus = exports.AreebaCardStatus = exports.CardUserType = exports.CardType = exports.PaymentPreference = exports.CartStatus = exports.AdminRole = void 0;
|
|
5
|
-
exports.
|
|
5
|
+
exports.PromotionType = exports.ServiceOrderCanceledBy = exports.TRPCErrorEnum = exports.ShopFilterSortByEnum = exports.ProfessionalScheduleType = exports.ServiceOrderRecurrencePattern = exports.ProfessionalRecurrencePattern = void 0;
|
|
6
6
|
var AgentLiveStatus;
|
|
7
7
|
(function (AgentLiveStatus) {
|
|
8
8
|
AgentLiveStatus["ONLINE"] = "online";
|
|
@@ -812,9 +812,9 @@ var ServiceOrderCanceledBy;
|
|
|
812
812
|
ServiceOrderCanceledBy["SHOP"] = "vendor";
|
|
813
813
|
ServiceOrderCanceledBy["ADMIN"] = "admin";
|
|
814
814
|
})(ServiceOrderCanceledBy || (exports.ServiceOrderCanceledBy = ServiceOrderCanceledBy = {}));
|
|
815
|
-
var
|
|
816
|
-
(function (
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
})(
|
|
815
|
+
var PromotionType;
|
|
816
|
+
(function (PromotionType) {
|
|
817
|
+
PromotionType["PACKAGE"] = "package";
|
|
818
|
+
PromotionType["SLOT"] = "slot";
|
|
819
|
+
})(PromotionType || (exports.PromotionType = PromotionType = {}));
|
|
820
820
|
//# sourceMappingURL=enum.js.map
|