@lyxa.ai/core 1.0.111-debug.1 → 1.0.112
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/agent-performance.model.js +1 -0
- package/dist/libraries/mongo/models/agent-performance.model.js.map +1 -1
- package/dist/libraries/mongo/models/attribute.model.js +1 -1
- package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js +2 -2
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.d.ts +16 -0
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js +61 -0
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/rest-password.model.d.ts +4 -0
- package/dist/libraries/mongo/models/embedded/rest-password.model.js +27 -0
- package/dist/libraries/mongo/models/embedded/rest-password.model.js.map +1 -0
- package/dist/libraries/mongo/models/product.model.d.ts +3 -0
- package/dist/libraries/mongo/models/product.model.js +20 -5
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.d.ts +2 -0
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js +6 -0
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/punch-marketing.model.d.ts +1 -1
- package/dist/libraries/mongo/models/providers/punch-marketing.model.js.map +1 -1
- package/dist/libraries/mongo/models/punch-marketing-history.model.d.ts +2 -0
- package/dist/libraries/mongo/models/punch-marketing-history.model.js +10 -0
- package/dist/libraries/mongo/models/punch-marketing-history.model.js.map +1 -1
- package/dist/libraries/mongo/models/ticket.model.js +1 -0
- package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
- package/dist/utilities/validation/common-validation.d.ts +7 -7
- package/package.json +1 -1
- package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +0 -9
- package/dist/libraries/mongo/models/app-screen-setting.model.js +0 -72
- package/dist/libraries/mongo/models/app-screen-setting.model.js.map +0 -1
- package/dist/libraries/mongo/models/order-payment.model.d.ts +0 -17
- package/dist/libraries/mongo/models/order-payment.model.js +0 -84
- package/dist/libraries/mongo/models/order-payment.model.js.map +0 -1
|
@@ -62,6 +62,7 @@ exports.AgentPerformance = AgentPerformance = __decorate([
|
|
|
62
62
|
collection: 'agent-performance',
|
|
63
63
|
},
|
|
64
64
|
}),
|
|
65
|
+
(0, typegoose_1.index)({ admin: 1 }, { unique: true }),
|
|
65
66
|
(0, typegoose_1.index)({ totalScore: -1 })
|
|
66
67
|
], AgentPerformance);
|
|
67
68
|
//# sourceMappingURL=agent-performance.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-performance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/agent-performance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAAqE;AACrE,+CAAsC;AACtC,oDAAsE;
|
|
1
|
+
{"version":3,"file":"agent-performance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/agent-performance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAAqE;AACrE,+CAAsC;AACtC,oDAAsE;AAS/D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAU;IAExC,KAAK,CAAc;IAGnB,mBAAmB,GAAW,CAAC,CAAC;IAGhC,oBAAoB,GAAW,CAAC,CAAC;IAGjC,oBAAoB,GAAW,CAAC,CAAC;IAGjC,wBAAwB,GAAW,CAAC,CAAC;IAGrC,wBAAwB,GAAW,CAAC,CAAC;IAGrC,UAAU,GAAW,CAAC,CAAC;IAGvB,gBAAgB,CAAQ;CAC/B,CAAA;AAxBY,4CAAgB;AAErB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,E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\nimport { Admin } from './admin.model';\nimport { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'agent-performance',\n\t},\n})\n@index({ admin: 1 }, { unique: true })\n@index({ totalScore: -1 })\nexport class AgentPerformance extends TimeStamps {\n\t@prop({ ref: () => Admin, required: true, unique: true })\n\tpublic admin!: Ref<Admin>;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsOngoing: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsResolved: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsAccepted: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsResolvedTime: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsAcceptedTime: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0, max: 100 })\n\tpublic totalScore: number = 0;\n\n\t@prop({ type: Date })\n\tpublic lastCalculatedAt?: Date;\n}\n"]}
|
|
@@ -29,7 +29,7 @@ __decorate([
|
|
|
29
29
|
__metadata("design:type", Object)
|
|
30
30
|
], Attribute.prototype, "shop", void 0);
|
|
31
31
|
__decorate([
|
|
32
|
-
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
32
|
+
(0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 20 }),
|
|
33
33
|
__metadata("design:type", String)
|
|
34
34
|
], Attribute.prototype, "name", void 0);
|
|
35
35
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/attribute.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,0EAAgE;AAChE,6CAAoC;AAI7B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAAU;IAEjC,IAAI,CAAa;IAGjB,IAAI,CAAU;IAG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AC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6CACZ;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDACV;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,oCAAa,CAAC,EAAE,CAAC;;wCACjB;oBApBnB,SAAS;IAFrB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,CAAC;IAC7D,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;GAC/E,SAAS,CAqBrB","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { AttributeItem } from './embedded/attribute-item.model';\nimport { Shop } from './shop.model';\n\n@modelOptions({ schemaOptions: { collection: 'attributes' } })\n@Index({ shop: 1, name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\nexport class Attribute extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMultiSelect?: boolean;\n\n\t@prop({ type: Number, min: 0, default: 0 }) // 0 means, it is disable\n\tpublic maxSelectableItems?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRequired?: boolean;\n\n\t@prop({ type: Number, min: 0, default: 0 }) // 0 means, it is disable\n\tpublic minRequiredItems?: number;\n\n\t@prop({ required: true, type: [AttributeItem] })\n\tpublic items!: AttributeItem[];\n}\n"]}
|
|
@@ -18,11 +18,11 @@ class AttributeItem {
|
|
|
18
18
|
}
|
|
19
19
|
exports.AttributeItem = AttributeItem;
|
|
20
20
|
__decorate([
|
|
21
|
-
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
21
|
+
(0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 20 }),
|
|
22
22
|
__metadata("design:type", String)
|
|
23
23
|
], AttributeItem.prototype, "name", void 0);
|
|
24
24
|
__decorate([
|
|
25
|
-
(0, typegoose_1.prop)({ required: true, type: Number }),
|
|
25
|
+
(0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
|
|
26
26
|
__metadata("design:type", Number)
|
|
27
27
|
], AttributeItem.prototype, "price", void 0);
|
|
28
28
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;2CAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACzB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class AttributeItem {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { Shop } from '../shop.model';
|
|
3
|
+
import { Order } from '../order.model';
|
|
4
|
+
declare class UsedPoint {
|
|
5
|
+
amountUsed: number;
|
|
6
|
+
dateUsed: Date;
|
|
7
|
+
}
|
|
8
|
+
export declare class LoyaltyPoint {
|
|
9
|
+
points: number;
|
|
10
|
+
dateGenerated: Date;
|
|
11
|
+
dateExpiry: Date;
|
|
12
|
+
shop?: Ref<Shop>;
|
|
13
|
+
order?: Ref<Order>;
|
|
14
|
+
usedPoints: UsedPoint[];
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
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.LoyaltyPoint = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const shop_model_1 = require("../shop.model");
|
|
15
|
+
const order_model_1 = require("../order.model");
|
|
16
|
+
class UsedPoint {
|
|
17
|
+
amountUsed;
|
|
18
|
+
dateUsed;
|
|
19
|
+
}
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], UsedPoint.prototype, "amountUsed", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
26
|
+
__metadata("design:type", Date)
|
|
27
|
+
], UsedPoint.prototype, "dateUsed", void 0);
|
|
28
|
+
class LoyaltyPoint {
|
|
29
|
+
points;
|
|
30
|
+
dateGenerated;
|
|
31
|
+
dateExpiry;
|
|
32
|
+
shop;
|
|
33
|
+
order;
|
|
34
|
+
usedPoints;
|
|
35
|
+
}
|
|
36
|
+
exports.LoyaltyPoint = LoyaltyPoint;
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], LoyaltyPoint.prototype, "points", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
43
|
+
__metadata("design:type", Date)
|
|
44
|
+
], LoyaltyPoint.prototype, "dateGenerated", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
47
|
+
__metadata("design:type", Date)
|
|
48
|
+
], LoyaltyPoint.prototype, "dateExpiry", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typegoose_1.prop)({ ref: () => shop_model_1.Shop, required: true }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], LoyaltyPoint.prototype, "shop", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typegoose_1.prop)({ ref: () => order_model_1.Order, required: true }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], LoyaltyPoint.prototype, "order", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typegoose_1.prop)({ type: () => [UsedPoint], default: [] }),
|
|
59
|
+
__metadata("design:type", Array)
|
|
60
|
+
], LoyaltyPoint.prototype, "usedPoints", void 0);
|
|
61
|
+
//# sourceMappingURL=loyaltyPoint.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyaltyPoint.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/loyaltyPoint.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,oDAAiD;AACjD,8CAAqC;AACrC,gDAAuC;AAEvC,MAAM,SAAS;IAEP,UAAU,CAAU;IAGpB,QAAQ,CAAQ;CACvB;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACE;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACP,IAAI;2CAAC;AAGxB,MAAa,YAAY;IAEjB,MAAM,CAAU;IAGhB,aAAa,CAAQ;IAGrB,UAAU,CAAQ;IAGlB,IAAI,CAAa;IAGjB,KAAK,CAAc;IAEnB,UAAU,CAAe;CAChC;AAjBD,oCAiBC;AAfO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACF;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACF,IAAI;mDAAC;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACL,IAAI;gDAAC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACjB;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gDACf","sourcesContent":["// loyaltyPoint.model.ts\nimport { prop, Ref } from '@typegoose/typegoose';\nimport { Shop } from '../shop.model';\nimport { Order } from '../order.model';\n\nclass UsedPoint {\n\t@prop({ required: true })\n\tpublic amountUsed!: number;\n\n\t@prop({ required: true })\n\tpublic dateUsed!: Date;\n}\n\nexport class LoyaltyPoint {\n\t@prop({ required: true })\n\tpublic points!: number;\n\n\t@prop({ required: true })\n\tpublic dateGenerated!: Date;\n\n\t@prop({ required: true })\n\tpublic dateExpiry!: Date;\n\n\t@prop({ ref: () => Shop, required: true })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ ref: () => Order, required: true })\n\tpublic order?: Ref<Order>;\n\t@prop({ type: () => [UsedPoint], default: [] })\n\tpublic usedPoints!: UsedPoint[];\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.ResetPasswordFields = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
class ResetPasswordFields {
|
|
15
|
+
tokenHash;
|
|
16
|
+
expiresAt;
|
|
17
|
+
}
|
|
18
|
+
exports.ResetPasswordFields = ResetPasswordFields;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typegoose_1.prop)(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], ResetPasswordFields.prototype, "tokenHash", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typegoose_1.prop)(),
|
|
25
|
+
__metadata("design:type", Date)
|
|
26
|
+
], ResetPasswordFields.prototype, "expiresAt", void 0);
|
|
27
|
+
//# sourceMappingURL=rest-password.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest-password.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/rest-password.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,mBAAmB;IAExB,SAAS,CAAU;IAGnB,SAAS,CAAQ;CACxB;AAND,kDAMC;AAJO;IADN,IAAA,gBAAI,GAAE;;sDACmB;AAGnB;IADN,IAAA,gBAAI,GAAE;8BACY,IAAI;sDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class ResetPasswordFields {\n\t@prop()\n\tpublic tokenHash!: string;\n\n\t@prop()\n\tpublic expiresAt!: Date;\n}\n"]}
|
|
@@ -30,6 +30,9 @@ export declare class Product extends TimeStamps {
|
|
|
30
30
|
isStockEnabled?: boolean;
|
|
31
31
|
stockQuantity?: number;
|
|
32
32
|
isDrinkIncluded?: boolean;
|
|
33
|
+
isLargeItem?: boolean;
|
|
34
|
+
isPreOrderEnabled?: boolean;
|
|
35
|
+
numberOfPreparingHours?: number;
|
|
33
36
|
orderQuantityLimit?: number;
|
|
34
37
|
note?: string;
|
|
35
38
|
status?: Status;
|
|
@@ -43,6 +43,9 @@ let Product = class Product extends defaultClasses_1.TimeStamps {
|
|
|
43
43
|
isStockEnabled;
|
|
44
44
|
stockQuantity;
|
|
45
45
|
isDrinkIncluded;
|
|
46
|
+
isLargeItem;
|
|
47
|
+
isPreOrderEnabled;
|
|
48
|
+
numberOfPreparingHours;
|
|
46
49
|
orderQuantityLimit;
|
|
47
50
|
note;
|
|
48
51
|
status;
|
|
@@ -54,11 +57,11 @@ __decorate([
|
|
|
54
57
|
__metadata("design:type", Object)
|
|
55
58
|
], Product.prototype, "shop", void 0);
|
|
56
59
|
__decorate([
|
|
57
|
-
(0, typegoose_1.prop)({ required: true, type: String, maxlength:
|
|
60
|
+
(0, typegoose_1.prop)({ required: true, type: String, maxlength: 100 }),
|
|
58
61
|
__metadata("design:type", String)
|
|
59
62
|
], Product.prototype, "name", void 0);
|
|
60
63
|
__decorate([
|
|
61
|
-
(0, typegoose_1.prop)({ type: String, default: '0000000' }),
|
|
64
|
+
(0, typegoose_1.prop)({ type: String, default: '0000000', maxlength: 50 }),
|
|
62
65
|
__metadata("design:type", String)
|
|
63
66
|
], Product.prototype, "barcode", void 0);
|
|
64
67
|
__decorate([
|
|
@@ -126,7 +129,7 @@ __decorate([
|
|
|
126
129
|
__metadata("design:type", Array)
|
|
127
130
|
], Product.prototype, "dietaryTypes", void 0);
|
|
128
131
|
__decorate([
|
|
129
|
-
(0, typegoose_1.prop)({ type: Number, max:
|
|
132
|
+
(0, typegoose_1.prop)({ type: Number, min: -9999, max: 9999 }),
|
|
130
133
|
__metadata("design:type", Number)
|
|
131
134
|
], Product.prototype, "storedTemperature", void 0);
|
|
132
135
|
__decorate([
|
|
@@ -142,11 +145,23 @@ __decorate([
|
|
|
142
145
|
__metadata("design:type", Boolean)
|
|
143
146
|
], Product.prototype, "isDrinkIncluded", void 0);
|
|
144
147
|
__decorate([
|
|
145
|
-
(0, typegoose_1.prop)({ type:
|
|
148
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
149
|
+
__metadata("design:type", Boolean)
|
|
150
|
+
], Product.prototype, "isLargeItem", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
153
|
+
__metadata("design:type", Boolean)
|
|
154
|
+
], Product.prototype, "isPreOrderEnabled", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
157
|
+
__metadata("design:type", Number)
|
|
158
|
+
], Product.prototype, "numberOfPreparingHours", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, typegoose_1.prop)({ type: Number, default: 0, min: 0, max: 999999999 }),
|
|
146
161
|
__metadata("design:type", Number)
|
|
147
162
|
], Product.prototype, "orderQuantityLimit", void 0);
|
|
148
163
|
__decorate([
|
|
149
|
-
(0, typegoose_1.prop)({ type: String }),
|
|
164
|
+
(0, typegoose_1.prop)({ type: String, maxlength: 250 }),
|
|
150
165
|
__metadata("design:type", String)
|
|
151
166
|
], Product.prototype, "note", void 0);
|
|
152
167
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAyG;AACzG,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiC;AA0C1B,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,OAAO,CAAU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IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,OAAO,CA0FnB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ProductType, ItemType, ProductDietaryType, Status, PriceOption } from '../../../utilities/enum';\nimport { ProductNutrition } from './embedded/product-nutrition.model';\nimport { Shop } from './shop.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { AttributeMap } from './embedded/attribute-map.model';\nimport { ShopCategory } from './shop-category.model';\nimport { ProductModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'products' } })\n@Index({ name: 1, shop: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n\t{ barcode: 1, shop: 1 },\n\t{\n\t\tunique: true,\n\t\tpartialFilterExpression: { barcode: { $exists: true, $nin: [null, '0000000'] }, deletedAt: null },\n\t}\n)\n@Index({ shop: 1, shopCategory: 1, deletedAt: 1 })\n@Index({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 })\n@pre<Product>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for products with the same shop and shopCategory that aren't deleted\n\t\t\tconst maxSortingOrder = await ProductModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tshop: this.shop,\n\t\t\t\t\t\tshopCategory: this.shopCategory,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class Product extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, maxlength: 100 })\n\tpublic name!: string;\n\n\t@prop({ type: String, default: '0000000', maxlength: 50 })\n\tpublic barcode?: string;\n\n\t@prop({ required: true, ref: () => ShopCategory })\n\tpublic shopCategory!: Ref<ShopCategory>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: String, enum: ProductType, default: ProductType.OTHER })\n\tpublic productType?: ProductType;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: [String], default: [] })\n\tpublic images?: string[];\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: [PriceBreakdown] })\n\tpublic priceBreakdowns?: PriceBreakdown[];\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: [AttributeMap], default: [] })\n\tpublic attributeMaps?: AttributeMap[];\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic addons?: Ref<Product>[];\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionPackSize?: number;\n\n\t@prop({ type: String })\n\tpublic nutritionPackSizeUnit?: string;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionServingSize?: number;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionCalories?: number;\n\n\t@prop({ type: [ProductNutrition], default: [] })\n\tpublic nutritions?: ProductNutrition[];\n\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\n\tpublic dietaryTypes?: ProductDietaryType[];\n\n\t@prop({ type: Number, min: -9999, max: 9999 })\n\tpublic storedTemperature?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isStockEnabled?: boolean;\n\n\t@prop({ type: Number })\n\tpublic stockQuantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isDrinkIncluded?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLargeItem?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPreOrderEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic numberOfPreparingHours?: number;\n\n\t@prop({ type: Number, default: 0, min: 0, max: 999999999 }) // 0 means, it is disable\n\tpublic orderQuantityLimit?: number;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic note?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CoreAuthIdentity } from '../core-auth-identity.model';
|
|
2
2
|
import { OTPFields } from '../embedded/otp-fields.model';
|
|
3
|
+
import { ResetPasswordFields } from '../embedded/rest-password.model';
|
|
3
4
|
export declare class CoreEmailAuthIdentity extends CoreAuthIdentity {
|
|
4
5
|
email: string;
|
|
5
6
|
password: string;
|
|
6
7
|
otps?: OTPFields[];
|
|
8
|
+
resetPassword?: ResetPasswordFields;
|
|
7
9
|
}
|
|
@@ -17,6 +17,7 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
17
17
|
const core_auth_identity_model_1 = require("../core-auth-identity.model");
|
|
18
18
|
const otp_fields_model_1 = require("../embedded/otp-fields.model");
|
|
19
19
|
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
20
|
+
const rest_password_model_1 = require("../embedded/rest-password.model");
|
|
20
21
|
async function hashPassword(password) {
|
|
21
22
|
const salt = await bcryptjs_1.default.genSalt(10);
|
|
22
23
|
return bcryptjs_1.default.hash(password, salt);
|
|
@@ -25,6 +26,7 @@ let CoreEmailAuthIdentity = class CoreEmailAuthIdentity extends core_auth_identi
|
|
|
25
26
|
email;
|
|
26
27
|
password;
|
|
27
28
|
otps;
|
|
29
|
+
resetPassword;
|
|
28
30
|
};
|
|
29
31
|
exports.CoreEmailAuthIdentity = CoreEmailAuthIdentity;
|
|
30
32
|
__decorate([
|
|
@@ -39,6 +41,10 @@ __decorate([
|
|
|
39
41
|
(0, typegoose_1.prop)({ type: otp_fields_model_1.OTPFields }),
|
|
40
42
|
__metadata("design:type", Array)
|
|
41
43
|
], CoreEmailAuthIdentity.prototype, "otps", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typegoose_1.prop)({ _id: false }),
|
|
46
|
+
__metadata("design:type", rest_password_model_1.ResetPasswordFields)
|
|
47
|
+
], CoreEmailAuthIdentity.prototype, "resetPassword", void 0);
|
|
42
48
|
exports.CoreEmailAuthIdentity = CoreEmailAuthIdentity = __decorate([
|
|
43
49
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
44
50
|
if (this.isModified('password')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-email-auth-identity.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/core-email-auth-identity.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoE;AACpE,0EAA+D;AAC/D,mEAAyD;AACzD,wDAA8B;
|
|
1
|
+
{"version":3,"file":"core-email-auth-identity.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/core-email-auth-identity.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoE;AACpE,0EAA+D;AAC/D,mEAAyD;AACzD,wDAA8B;AAE9B,yEAAsE;AAEtE,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,IAAI,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC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-auth-identity.model';\nimport { OTPFields } from '../embedded/otp-fields.model';\nimport bcrypt from 'bcryptjs';\nimport { Query } from 'mongoose';\nimport { ResetPasswordFields } from '../embedded/rest-password.model';\n\nasync function hashPassword(password: string): Promise<string> {\n\tconst salt = await bcrypt.genSalt(10);\n\treturn bcrypt.hash(password, salt);\n}\n@pre<CoreEmailAuthIdentity>('save', async function (next) {\n\tif (this.isModified('password')) {\n\t\tthis.password = await hashPassword(this.password);\n\t}\n\tnext();\n})\n@pre<Query<any, CoreEmailAuthIdentity>>('findOneAndUpdate', async function (next) {\n\tconst update = this.getUpdate() as Record<string, any>;\n\tif (update?.password) {\n\t\tupdate.password = await hashPassword(update.password);\n\t\tthis.setUpdate(update);\n\t}\n\tnext();\n})\nexport class CoreEmailAuthIdentity extends CoreAuthIdentity {\n\t@prop({ required: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic password!: string;\n\n\t@prop({ type: OTPFields })\n\tpublic otps?: OTPFields[];\n\n\t@prop({ _id: false })\n\tpublic resetPassword?: ResetPasswordFields;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"punch-marketing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/punch-marketing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAsE;AACtE,wDAA+C;AAE/C,MAAa,cAAe,SAAQ,2BAAS;IACrC,aAAa,GAAG,oBAAa,CAAC,eAAwB,CAAC;IAGvD,YAAY,CAAU;IAGtB,iBAAiB,CAAU;IAG3B,QAAQ,CAAU;IAGlB,eAAe,CAAa;IAG5B,WAAW,CAAU;IAGrB,oBAAoB,CAAU;CACrC;AApBD,wCAoBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;oDAC1B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDACL;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;uDACrB;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACX;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4DACV","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { MarketingType, ValueType } from '../../../../utilities/enum';\nimport { Marketing } from '../marketing.model';\n\nexport class PunchMarketing extends Marketing {\n\tpublic marketingType = MarketingType.PUNCH_MARKETING as const;\n\n\t@prop({ required: true, type: Number, min: 1, max: 7 })\n\tpublic targetOrders!: number;\n\n\t@prop({ required: true, type: Number })\n\tpublic minimumOrderValue!: number;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic dayLimit!: number;\n\n\t@prop({ required: true, type: String, enum: ValueType })\n\tpublic couponValueType!: ValueType;\n\n\t@prop({ required: true, type: Number })\n\tpublic couponValue!: number;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic couponDurationInDays
|
|
1
|
+
{"version":3,"file":"punch-marketing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/punch-marketing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAsE;AACtE,wDAA+C;AAE/C,MAAa,cAAe,SAAQ,2BAAS;IACrC,aAAa,GAAG,oBAAa,CAAC,eAAwB,CAAC;IAGvD,YAAY,CAAU;IAGtB,iBAAiB,CAAU;IAG3B,QAAQ,CAAU;IAGlB,eAAe,CAAa;IAG5B,WAAW,CAAU;IAGrB,oBAAoB,CAAU;CACrC;AApBD,wCAoBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;oDAC1B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDACL;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;uDACrB;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACX;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4DACV","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { MarketingType, ValueType } from '../../../../utilities/enum';\nimport { Marketing } from '../marketing.model';\n\nexport class PunchMarketing extends Marketing {\n\tpublic marketingType = MarketingType.PUNCH_MARKETING as const;\n\n\t@prop({ required: true, type: Number, min: 1, max: 7 })\n\tpublic targetOrders!: number;\n\n\t@prop({ required: true, type: Number })\n\tpublic minimumOrderValue!: number;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic dayLimit!: number;\n\n\t@prop({ required: true, type: String, enum: ValueType })\n\tpublic couponValueType!: ValueType;\n\n\t@prop({ required: true, type: Number })\n\tpublic couponValue!: number;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic couponDurationInDays!: number;\n}\n"]}
|
|
@@ -22,7 +22,9 @@ let PunchMarketingHistory = class PunchMarketingHistory extends defaultClasses_1
|
|
|
22
22
|
completedOrders;
|
|
23
23
|
expiryDate;
|
|
24
24
|
completedAt;
|
|
25
|
+
couponExpiryDate;
|
|
25
26
|
discountApplied;
|
|
27
|
+
marketingSnapshot;
|
|
26
28
|
};
|
|
27
29
|
exports.PunchMarketingHistory = PunchMarketingHistory;
|
|
28
30
|
__decorate([
|
|
@@ -49,10 +51,18 @@ __decorate([
|
|
|
49
51
|
(0, typegoose_1.prop)({ type: Date, default: null }),
|
|
50
52
|
__metadata("design:type", Date)
|
|
51
53
|
], PunchMarketingHistory.prototype, "completedAt", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typegoose_1.prop)({ type: Date, default: null }),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], PunchMarketingHistory.prototype, "couponExpiryDate", void 0);
|
|
52
58
|
__decorate([
|
|
53
59
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
54
60
|
__metadata("design:type", Boolean)
|
|
55
61
|
], PunchMarketingHistory.prototype, "discountApplied", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typegoose_1.prop)({ required: true, type: punch_marketing_model_1.PunchMarketing }),
|
|
64
|
+
__metadata("design:type", punch_marketing_model_1.PunchMarketing)
|
|
65
|
+
], PunchMarketingHistory.prototype, "marketingSnapshot", void 0);
|
|
56
66
|
exports.PunchMarketingHistory = PunchMarketingHistory = __decorate([
|
|
57
67
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'punchMarketingHistories' } })
|
|
58
68
|
], PunchMarketingHistory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"punch-marketing-history.model.js","sourceRoot":"/","sources":["libraries/mongo/models/punch-marketing-history.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,6EAAmE;AACnE,6CAAoC;AACpC,6CAAoC;AAG7B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2BAAU;IAE7C,IAAI,CAAa;IAGjB,SAAS,CAAuB;IAGhC,IAAI,CAAa;IAGjB,eAAe,CAAU;IAGzB,UAAU,CAAQ;IAGlB,WAAW,CAAQ;IAGnB,eAAe,CAAW;
|
|
1
|
+
{"version":3,"file":"punch-marketing-history.model.js","sourceRoot":"/","sources":["libraries/mongo/models/punch-marketing-history.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,6EAAmE;AACnE,6CAAoC;AACpC,6CAAoC;AAG7B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2BAAU;IAE7C,IAAI,CAAa;IAGjB,SAAS,CAAuB;IAGhC,IAAI,CAAa;IAGjB,eAAe,CAAU;IAGzB,UAAU,CAAQ;IAGlB,WAAW,CAAQ;IAGnB,gBAAgB,CAAO;IAGvB,eAAe,CAAW;IAG1B,iBAAiB,CAAkB;CAC1C,CAAA;AA3BY,sDAAqB;AAE1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mDAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,CAAC;;wDACb;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;mDAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACD,IAAI;yDAAC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACf,IAAI;0DAAC;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACX,IAAI;+DAAC;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;8DACP;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,sCAAc,EAAE,CAAC;8BACpB,sCAAc;gEAAC;gCA1B9B,qBAAqB;IADjC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,yBAAyB,EAAE,EAAE,CAAC;GAC9D,qBAAqB,CA2BjC","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { PunchMarketing } from './providers/punch-marketing.model';\nimport { Shop } from './shop.model';\nimport { User } from './user.model';\n\n@modelOptions({ schemaOptions: { collection: 'punchMarketingHistories' } })\nexport class PunchMarketingHistory extends TimeStamps {\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => PunchMarketing })\n\tpublic marketing!: Ref<PunchMarketing>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic completedOrders!: number;\n\n\t@prop({ type: Date })\n\tpublic expiryDate!: Date;\n\n\t@prop({ type: Date, default: null })\n\tpublic completedAt?: Date;\n\n\t@prop({ type: Date, default: null })\n\tpublic couponExpiryDate: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic discountApplied!: boolean;\n\n\t@prop({ required: true, type: PunchMarketing })\n\tpublic marketingSnapshot!: PunchMarketing;\n}\n"]}
|
|
@@ -172,6 +172,7 @@ exports.Ticket = Ticket = __decorate([
|
|
|
172
172
|
(0, typegoose_1.index)({ type: 1, status: 1, priority: 1 }),
|
|
173
173
|
(0, typegoose_1.index)({ client: 1, clientType: 1, status: 1 }),
|
|
174
174
|
(0, typegoose_1.index)({ createdAt: -1 }),
|
|
175
|
+
(0, typegoose_1.index)({ ticketId: 1 }, { unique: true }),
|
|
175
176
|
(0, typegoose_1.index)({ chatroom: 1 })
|
|
176
177
|
], Ticket);
|
|
177
178
|
//# sourceMappingURL=ticket.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticket.model.js","sourceRoot":"/","sources":["libraries/mongo/models/ticket.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAiF;AACjF,4EAAqE;AAGrE,+CAAsC;AACtC,+CAAsC;AACtC,kDAAmE;AACnE,uDAA6C;
|
|
1
|
+
{"version":3,"file":"ticket.model.js","sourceRoot":"/","sources":["libraries/mongo/models/ticket.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAiF;AACjF,4EAAqE;AAGrE,+CAAsC;AACtC,+CAAsC;AACtC,kDAAmE;AACnE,uDAA6C;AAiCtC,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,QAAQ,CAAU;IAGlB,IAAI,CAAc;IAGlB,MAAM,CAAgB;IAGtB,MAAM,CAAoB;IAG1B,UAAU,CAAU;IAGpB,OAAO,CAAU;IAGjB,WAAW,CAAU;IAGrB,KAAK,CAAc;IAGnB,aAAa,CAAc;IAG3B,UAAU,CAAQ;IAGlB,kBAAkB,CAAU;IAG5B,QAAQ,CAAiB;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prop, Ref, index, modelOptions, pre, post } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Order } from './order.model';\nimport { Admin } from './admin.model';\nimport { TicketType, TicketStatus } from '../../../utilities/enum';\nimport { Chatroom } from './chat-room.model';\n\n@pre<Ticket>('save', async function (next) {\n\tif (this.isNew && !this.ticketId) {\n\t\tconst { CounterModel } = await import('.');\n\n\t\ttry {\n\t\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t\t{ counterType: 'ticket' },\n\t\t\t\t{ $inc: { value: 1 } },\n\t\t\t\t{ new: true, upsert: true }\n\t\t\t);\n\n\t\t\tconst currentDate = new Date().toISOString().slice(0, 10).replace(/-/g, '');\n\t\t\tthis.ticketId = `TKT-${currentDate}-${String(counter.value).padStart(4, '0')}`;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'tickets',\n\t\ttimestamps: true,\n\t},\n})\n@index({ assignedAgent: 1, status: 1 })\n@index({ type: 1, status: 1, priority: 1 })\n@index({ client: 1, clientType: 1, status: 1 })\n@index({ createdAt: -1 })\n@index({ ticketId: 1 }, { unique: true })\n@index({ chatroom: 1 })\nexport class Ticket extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic ticketId!: string;\n\n\t@prop({ required: true, type: String, enum: TicketType })\n\tpublic type!: TicketType;\n\n\t@prop({ required: true, type: String, enum: TicketStatus, default: TicketStatus.PENDING })\n\tpublic status!: TicketStatus;\n\n\t@prop({ refPath: 'clientType', required: true })\n\tpublic client!: Ref<User | Shop>;\n\n\t@prop({ required: true, type: String, enum: ['User', 'Shop'] })\n\tpublic clientType!: string;\n\n\t@prop({ type: String, required: true })\n\tpublic subject!: string;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n\n\t@prop({ ref: () => Order })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Admin })\n\tpublic assignedAgent?: Ref<Admin>;\n\n\t@prop({ type: Date })\n\tpublic assignedAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic assignmentAttempts?: number;\n\n\t@prop({ ref: () => Chatroom, required: true })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ type: Date })\n\tpublic resolvedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic closedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic resolutionTimeMinutes?: number;\n\n\t@prop({ type: Number, min: 1, max: 5 })\n\tpublic customerRating?: number;\n\n\t@prop({ type: String })\n\tpublic customerFeedback?: string;\n\n\t@prop({ type: Number })\n\tpublic agentScore?: number;\n\n\t@prop({ type: [String], default: [] })\n\tpublic tags?: string[];\n}\n"]}
|
|
@@ -196,7 +196,7 @@ export declare const AddressSchema: z.ZodObject<{
|
|
|
196
196
|
zone?: string | import("mongoose").Types.ObjectId | undefined;
|
|
197
197
|
}>;
|
|
198
198
|
export type AddressDTO = DTO<typeof AddressSchema>;
|
|
199
|
-
export declare const UserAddressSchema: z.ZodObject<{
|
|
199
|
+
export declare const UserAddressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
200
200
|
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
201
201
|
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
202
202
|
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
@@ -215,13 +215,13 @@ export declare const UserAddressSchema: z.ZodObject<{
|
|
|
215
215
|
latitude: z.ZodNumber;
|
|
216
216
|
longitude: z.ZodNumber;
|
|
217
217
|
zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
|
|
218
|
-
}
|
|
218
|
+
}, {
|
|
219
219
|
addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
220
220
|
apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
221
221
|
buildingName: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
222
222
|
deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
223
223
|
instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
224
|
-
}
|
|
224
|
+
}>, "strip", z.ZodTypeAny, {
|
|
225
225
|
location: {
|
|
226
226
|
type: GeoLocationType;
|
|
227
227
|
coordinates: [number, number];
|
|
@@ -259,7 +259,7 @@ export declare const UserAddressSchema: z.ZodObject<{
|
|
|
259
259
|
instructions?: string | undefined;
|
|
260
260
|
}>;
|
|
261
261
|
export type UserAddressDTO = DTO<typeof UserAddressSchema>;
|
|
262
|
-
export declare const CourierAddressSchema: z.ZodObject<{
|
|
262
|
+
export declare const CourierAddressSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
263
263
|
address: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
264
264
|
description: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
265
265
|
city: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
@@ -278,16 +278,16 @@ export declare const CourierAddressSchema: z.ZodObject<{
|
|
|
278
278
|
latitude: z.ZodNumber;
|
|
279
279
|
longitude: z.ZodNumber;
|
|
280
280
|
zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
|
|
281
|
-
}
|
|
281
|
+
}, {
|
|
282
282
|
addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
283
283
|
apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
284
284
|
buildingName: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
285
285
|
deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
286
286
|
instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
287
|
-
}
|
|
287
|
+
}>, {
|
|
288
288
|
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
289
289
|
phoneNumber: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
290
|
-
}
|
|
290
|
+
}>, "strip", z.ZodTypeAny, {
|
|
291
291
|
name: string;
|
|
292
292
|
location: {
|
|
293
293
|
type: GeoLocationType;
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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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"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
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
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E,MAAM,EAAE,CAAC;;8CACN;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACxB;AAGf;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACE;uBA1Bb,YAAY;IAfxB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,eAAe;YAC3B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACnB,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACpB,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;GACZ,YAAY,CA2BxB","sourcesContent":["import { index, modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Order } from './order.model';\nimport { PaymentMethod, PaymentStatus } from '../../../utilities/enum';\nimport { PaymentInformation } from './embedded/payment-infromation.model';\nimport { PaymentAttempt } from './embedded/payment-attempt.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\ttimestamps: true,\n\t\tcollection: 'orderPayments',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ order: 1 })\n@index({ status: 1 })\n@index({ paymentMethod: 1 })\n@index({ createdAt: -1 })\nexport class OrderPayment extends TimeStamps {\n\t@prop({ required: true, ref: () => Order, index: true, unique: true })\n\torder: Ref<Order>;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpaymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation })\n\tpaymentInformation?: PaymentInformation;\n\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\n\tstatus?: PaymentStatus;\n\n\t@prop()\n\treceiptUrl?: string;\n\n\t@prop({ type: [PaymentAttempt], default: [] })\n\tattempts?: PaymentAttempt[];\n\n\t@prop({ type: String })\n\tcurrency: string;\n\n\t@prop({ required: true, type: Number })\n\tamount: number;\n\n\t@prop({ type: Number })\n\tsecondaryAmount?: number;\n}\n"]}
|