@lyxa.ai/core 1.0.106 → 1.0.108
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.d.ts +13 -0
- package/dist/libraries/mongo/models/agent-performance.model.js +68 -0
- package/dist/libraries/mongo/models/agent-performance.model.js.map +1 -0
- package/dist/libraries/mongo/models/attribute.model.d.ts +3 -4
- package/dist/libraries/mongo/models/attribute.model.js +10 -16
- package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
- package/dist/libraries/mongo/models/chat-room.model.d.ts +16 -0
- package/dist/libraries/mongo/models/chat-room.model.js +79 -0
- package/dist/libraries/mongo/models/chat-room.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/chat-participant.model.d.ts +13 -0
- package/dist/libraries/mongo/models/embedded/chat-participant.model.js +47 -0
- package/dist/libraries/mongo/models/embedded/chat-participant.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/order-cancel.model.d.ts +0 -1
- package/dist/libraries/mongo/models/embedded/order-cancel.model.js +0 -5
- package/dist/libraries/mongo/models/embedded/order-cancel.model.js.map +1 -1
- package/dist/libraries/mongo/models/index.d.ts +13 -0
- package/dist/libraries/mongo/models/index.js +14 -1
- package/dist/libraries/mongo/models/index.js.map +1 -1
- package/dist/libraries/mongo/models/message.model.d.ts +18 -0
- package/dist/libraries/mongo/models/message.model.js +70 -0
- package/dist/libraries/mongo/models/message.model.js.map +1 -0
- package/dist/libraries/mongo/models/order.model.js +1 -1
- package/dist/libraries/mongo/models/order.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/referral-code-coupon.model.d.ts +2 -2
- package/dist/libraries/mongo/models/providers/referral-code-coupon.model.js +2 -2
- package/dist/libraries/mongo/models/providers/referral-code-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.d.ts +3 -3
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js +3 -3
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/punch-marketing-history.model.d.ts +8 -4
- package/dist/libraries/mongo/models/punch-marketing-history.model.js +20 -4
- package/dist/libraries/mongo/models/punch-marketing-history.model.js.map +1 -1
- package/dist/libraries/mongo/models/ticket.model.d.ts +29 -0
- package/dist/libraries/mongo/models/ticket.model.js +178 -0
- package/dist/libraries/mongo/models/ticket.model.js.map +1 -0
- package/dist/utilities/enum.d.ts +22 -10
- package/dist/utilities/enum.js +27 -13
- package/dist/utilities/enum.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
+
import { User } from './user.model';
|
|
4
|
+
import { Admin } from './admin.model';
|
|
5
|
+
import { Shop } from './shop.model';
|
|
6
|
+
import { MessageSender } from '../../../utilities/enum';
|
|
7
|
+
import { Rider } from './rider.model';
|
|
8
|
+
import { Chatroom } from './chat-room.model';
|
|
9
|
+
export declare class Message extends TimeStamps {
|
|
10
|
+
chatroom: Ref<Chatroom>;
|
|
11
|
+
content: string;
|
|
12
|
+
senderType: MessageSender;
|
|
13
|
+
sender: Ref<User | Admin | Shop | Rider>;
|
|
14
|
+
isRead?: boolean;
|
|
15
|
+
readAt?: Date;
|
|
16
|
+
attachmentUrl?: string;
|
|
17
|
+
messageType?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.Message = 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 chat_room_model_1 = require("./chat-room.model");
|
|
17
|
+
let Message = class Message extends defaultClasses_1.TimeStamps {
|
|
18
|
+
chatroom;
|
|
19
|
+
content;
|
|
20
|
+
senderType;
|
|
21
|
+
sender;
|
|
22
|
+
isRead;
|
|
23
|
+
readAt;
|
|
24
|
+
attachmentUrl;
|
|
25
|
+
messageType;
|
|
26
|
+
};
|
|
27
|
+
exports.Message = Message;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typegoose_1.prop)({ required: true, ref: () => chat_room_model_1.Chatroom }),
|
|
30
|
+
__metadata("design:type", Object)
|
|
31
|
+
], Message.prototype, "chatroom", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typegoose_1.prop)({ required: true, type: String }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Message.prototype, "content", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.MessageSender }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Message.prototype, "senderType", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typegoose_1.prop)({ refPath: 'senderType' }),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], Message.prototype, "sender", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
46
|
+
__metadata("design:type", Boolean)
|
|
47
|
+
], Message.prototype, "isRead", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
50
|
+
__metadata("design:type", Date)
|
|
51
|
+
], Message.prototype, "readAt", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], Message.prototype, "attachmentUrl", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typegoose_1.prop)({ type: String, enum: ['TEXT', 'IMAGE', 'FILE'] }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], Message.prototype, "messageType", void 0);
|
|
60
|
+
exports.Message = Message = __decorate([
|
|
61
|
+
(0, typegoose_1.modelOptions)({
|
|
62
|
+
schemaOptions: {
|
|
63
|
+
collection: 'messages',
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
(0, typegoose_1.index)({ chatroom: 1, createdAt: -1 }),
|
|
67
|
+
(0, typegoose_1.index)({ sender: 1, senderType: 1 }),
|
|
68
|
+
(0, typegoose_1.index)({ isRead: 1, chatroom: 1 })
|
|
69
|
+
], Message);
|
|
70
|
+
//# sourceMappingURL=message.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.model.js","sourceRoot":"/","sources":["libraries/mongo/models/message.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AAIrE,kDAAwD;AAExD,uDAA6C;AAUtC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,QAAQ,CAAiB;IAGzB,OAAO,CAAU;IAGjB,UAAU,CAAiB;IAG3B,MAAM,CAAoC;IAG1C,MAAM,CAAW;IAGjB,MAAM,CAAQ;IAGd,aAAa,CAAU;IAGvB,WAAW,CAAU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ourcesContent":["import { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Admin } from './admin.model';\nimport { Shop } from './shop.model';\nimport { MessageSender } from '../../../utilities/enum';\nimport { Rider } from './rider.model';\nimport { Chatroom } from './chat-room.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'messages',\n\t},\n})\n@index({ chatroom: 1, createdAt: -1 })\n@index({ sender: 1, senderType: 1 })\n@index({ isRead: 1, chatroom: 1 })\nexport class Message extends TimeStamps {\n\t@prop({ required: true, ref: () => Chatroom })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ required: true, type: String })\n\tpublic content!: string;\n\n\t@prop({ required: true, type: String, enum: MessageSender })\n\tpublic senderType!: MessageSender;\n\n\t@prop({ refPath: 'senderType' })\n\tpublic sender!: Ref<User | Admin | Shop | Rider>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRead?: boolean;\n\n\t@prop({ type: Date })\n\tpublic readAt?: Date;\n\n\t@prop({ type: String })\n\tpublic attachmentUrl?: string;\n\n\t@prop({ type: String, enum: ['TEXT', 'IMAGE', 'FILE'] })\n\tpublic messageType?: string;\n}\n"]}
|
|
@@ -76,7 +76,7 @@ __decorate([
|
|
|
76
76
|
__metadata("design:type", Boolean)
|
|
77
77
|
], Order.prototype, "isUrgentOrder", void 0);
|
|
78
78
|
__decorate([
|
|
79
|
-
(0, typegoose_1.prop)({ type: Date }),
|
|
79
|
+
(0, typegoose_1.prop)({ type: Date, default: new Date() }),
|
|
80
80
|
__metadata("design:type", Date)
|
|
81
81
|
], Order.prototype, "processedAt", void 0);
|
|
82
82
|
exports.Order = Order = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,k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AAS,EAAE,CAAC;QACZ,MAAM,EAAE,CAAC;QACT,uBAAuB,EAAE,CAAC;QAC1B,0BAA0B,EAAE,CAAC;QAC7B,SAAS,EAAE,CAAC;KACZ,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACzE,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,0BAA0B,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACxF,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACzD,IAAA,iBAAK,EAAC;QACN,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,CAAC;QACT,uBAAuB,EAAE,CAAC;QAC1B,0BAA0B,EAAE,CAAC;QAC7B,SAAS,EAAE,CAAC;KACZ,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;GAC/D,KAAK,CAoCjB","sourcesContent":["import { prop, Ref, modelOptions, Severity, Index } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { OrderType } from '../../../utilities/enum';\nimport { OrderCancel } from './embedded/order-cancel.model';\nimport { User } from './user.model';\nimport { Rider } from './rider.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'orders',\n\t\tdiscriminatorKey: 'orderType',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@Index({ 'deliveryAddress.location': '2dsphere' })\n@Index({\n\tshop: 1,\n\torderType: 1,\n\tstatus: 1,\n\t'statusTimeline.status': 1,\n\t'statusTimeline.timestamp': 1,\n\tdeletedAt: 1,\n})\n@Index({ shop: 1, orderType: 1, status: 1, processedAt: 1, deletedAt: 1 })\n@Index({ shop: 1, orderType: 1, status: 1, 'deliveryAddress.location': 1, deletedAt: 1 })\n@Index({ shop: 1, orderType: 1, status: 1, deletedAt: 1 })\n@Index({\n\tparent: 1,\n\torderType: 1,\n\tstatus: 1,\n\t'statusTimeline.status': 1,\n\t'statusTimeline.timestamp': 1,\n\tdeletedAt: 1,\n})\n@Index({ parent: 1, orderType: 1, status: 1, processedAt: 1, deletedAt: 1 })\nexport class Order extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic orderId: string;\n\n\t@prop({ type: String, enum: OrderType, default: OrderType.REGULAR })\n\tpublic orderType?: OrderType;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user: Ref<User>;\n\n\t@prop({ ref: () => Rider, index: true })\n\tpublic rider?: Ref<Rider>;\n\n\t@prop({ type: Number })\n\tpublic deliveredTimeInMinutes: number;\n\n\t@prop({ type: String })\n\tpublic instruction?: string;\n\n\t@prop({ type: String })\n\tpublic note?: string;\n\n\t@prop({ type: Date })\n\tpublic scheduledFor?: Date;\n\n\t@prop({ type: () => OrderCancel })\n\tpublic orderCancel?: OrderCancel;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLateOrder?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isUrgentOrder?: boolean;\n\n\t@prop({ type: Date, default: new Date() })\n\tpublic processedAt?: Date;\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Ref } from '@typegoose/typegoose';
|
|
2
2
|
import { CouponType } from '../../../../utilities/enum';
|
|
3
|
-
import { CoreUser } from '../core-user.model';
|
|
4
3
|
import { Coupon } from '../coupon.model';
|
|
4
|
+
import { User } from '../user.model';
|
|
5
5
|
export declare class ReferralCodeCoupon extends Coupon {
|
|
6
6
|
couponType: CouponType.REFERRAL_CODE;
|
|
7
7
|
orderLimitPerUser: 1;
|
|
8
|
-
referralUser: Ref<
|
|
8
|
+
referralUser: Ref<User>;
|
|
9
9
|
}
|
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ReferralCodeCoupon = void 0;
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
14
|
const enum_1 = require("../../../../utilities/enum");
|
|
15
|
-
const core_user_model_1 = require("../core-user.model");
|
|
16
15
|
const coupon_model_1 = require("../coupon.model");
|
|
16
|
+
const user_model_1 = require("../user.model");
|
|
17
17
|
class ReferralCodeCoupon extends coupon_model_1.Coupon {
|
|
18
18
|
couponType = enum_1.CouponType.REFERRAL_CODE;
|
|
19
19
|
orderLimitPerUser = 1;
|
|
@@ -21,7 +21,7 @@ class ReferralCodeCoupon extends coupon_model_1.Coupon {
|
|
|
21
21
|
}
|
|
22
22
|
exports.ReferralCodeCoupon = ReferralCodeCoupon;
|
|
23
23
|
__decorate([
|
|
24
|
-
(0, typegoose_1.prop)({ required: true, ref: () =>
|
|
24
|
+
(0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
|
|
25
25
|
__metadata("design:type", Object)
|
|
26
26
|
], ReferralCodeCoupon.prototype, "referralUser", void 0);
|
|
27
27
|
//# sourceMappingURL=referral-code-coupon.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referral-code-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-code-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"referral-code-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-code-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAwD;AACxD,kDAAyC;AACzC,8CAAqC;AAErC,MAAa,kBAAmB,SAAQ,qBAAM;IACtC,UAAU,GAAG,iBAAU,CAAC,aAAsB,CAAC;IAE/C,iBAAiB,GAAG,CAAU,CAAC;IAG/B,YAAY,CAAa;CAChC;AAPD,gDAOC;AADO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;wDACV","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { CouponType } from '../../../../utilities/enum';\nimport { Coupon } from '../coupon.model';\nimport { User } from '../user.model';\n\nexport class ReferralCodeCoupon extends Coupon {\n\tpublic couponType = CouponType.REFERRAL_CODE as const;\n\n\tpublic orderLimitPerUser = 1 as const;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic referralUser!: Ref<User>;\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Ref } from '@typegoose/typegoose';
|
|
2
2
|
import { CouponType } from '../../../../utilities/enum';
|
|
3
3
|
import { BaseCoupon } from '../base/base-coupon.model';
|
|
4
|
-
import { CoreUser } from '../core-user.model';
|
|
5
4
|
import { Order } from '../order.model';
|
|
5
|
+
import { User } from '../user.model';
|
|
6
6
|
export declare class ReferralRewardCoupon extends BaseCoupon {
|
|
7
7
|
couponType: CouponType.REFERRAL_REWARD;
|
|
8
|
-
user: Ref<
|
|
9
|
-
referralCodeUsedBy: Ref<
|
|
8
|
+
user: Ref<User>;
|
|
9
|
+
referralCodeUsedBy: Ref<User>;
|
|
10
10
|
referralCodeUsedOnOrder: Ref<Order>;
|
|
11
11
|
}
|
|
@@ -13,8 +13,8 @@ exports.ReferralRewardCoupon = void 0;
|
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
14
|
const enum_1 = require("../../../../utilities/enum");
|
|
15
15
|
const base_coupon_model_1 = require("../base/base-coupon.model");
|
|
16
|
-
const core_user_model_1 = require("../core-user.model");
|
|
17
16
|
const order_model_1 = require("../order.model");
|
|
17
|
+
const user_model_1 = require("../user.model");
|
|
18
18
|
class ReferralRewardCoupon extends base_coupon_model_1.BaseCoupon {
|
|
19
19
|
couponType = enum_1.CouponType.REFERRAL_REWARD;
|
|
20
20
|
user;
|
|
@@ -23,11 +23,11 @@ class ReferralRewardCoupon extends base_coupon_model_1.BaseCoupon {
|
|
|
23
23
|
}
|
|
24
24
|
exports.ReferralRewardCoupon = ReferralRewardCoupon;
|
|
25
25
|
__decorate([
|
|
26
|
-
(0, typegoose_1.prop)({ required: true, ref: () =>
|
|
26
|
+
(0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
|
|
27
27
|
__metadata("design:type", Object)
|
|
28
28
|
], ReferralRewardCoupon.prototype, "user", void 0);
|
|
29
29
|
__decorate([
|
|
30
|
-
(0, typegoose_1.prop)({ required: true, ref: () =>
|
|
30
|
+
(0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
|
|
31
31
|
__metadata("design:type", Object)
|
|
32
32
|
], ReferralRewardCoupon.prototype, "referralCodeUsedBy", void 0);
|
|
33
33
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referral-reward-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-reward-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAwD;AACxD,iEAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"referral-reward-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/referral-reward-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAwD;AACxD,iEAAuD;AACvD,gDAAuC;AACvC,8CAAqC;AAErC,MAAa,oBAAqB,SAAQ,8BAAU;IAC5C,UAAU,GAAG,iBAAU,CAAC,eAAwB,CAAC;IAGjD,IAAI,CAAa;IAGjB,kBAAkB,CAAa;IAG/B,uBAAuB,CAAc;CAC5C;AAXD,oDAWC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;kDAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;gEACJ;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;qEACC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { CouponType } from '../../../../utilities/enum';\nimport { BaseCoupon } from '../base/base-coupon.model';\nimport { Order } from '../order.model';\nimport { User } from '../user.model';\n\nexport class ReferralRewardCoupon extends BaseCoupon {\n\tpublic couponType = CouponType.REFERRAL_REWARD as const;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic referralCodeUsedBy!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Order })\n\tpublic referralCodeUsedOnOrder!: Ref<Order>;\n}\n"]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Ref } from '@typegoose/typegoose';
|
|
2
2
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
-
import { CoreUser } from './core-user.model';
|
|
4
3
|
import { PunchMarketing } from './providers/punch-marketing.model';
|
|
4
|
+
import { Shop } from './shop.model';
|
|
5
|
+
import { User } from './user.model';
|
|
5
6
|
export declare class PunchMarketingHistory extends TimeStamps {
|
|
6
|
-
user: Ref<
|
|
7
|
+
user: Ref<User>;
|
|
7
8
|
marketing: Ref<PunchMarketing>;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
shop: Ref<Shop>;
|
|
10
|
+
completedOrders: number;
|
|
11
|
+
expiryDate: Date;
|
|
12
|
+
completedAt?: Date;
|
|
13
|
+
discountApplied: boolean;
|
|
10
14
|
}
|
|
@@ -12,23 +12,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.PunchMarketingHistory = void 0;
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
14
|
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
|
-
const core_user_model_1 = require("./core-user.model");
|
|
16
15
|
const punch_marketing_model_1 = require("./providers/punch-marketing.model");
|
|
16
|
+
const shop_model_1 = require("./shop.model");
|
|
17
|
+
const user_model_1 = require("./user.model");
|
|
17
18
|
let PunchMarketingHistory = class PunchMarketingHistory extends defaultClasses_1.TimeStamps {
|
|
18
19
|
user;
|
|
19
20
|
marketing;
|
|
21
|
+
shop;
|
|
20
22
|
completedOrders;
|
|
21
|
-
|
|
23
|
+
expiryDate;
|
|
24
|
+
completedAt;
|
|
25
|
+
discountApplied;
|
|
22
26
|
};
|
|
23
27
|
exports.PunchMarketingHistory = PunchMarketingHistory;
|
|
24
28
|
__decorate([
|
|
25
|
-
(0, typegoose_1.prop)({ required: true, ref: () =>
|
|
29
|
+
(0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
|
|
26
30
|
__metadata("design:type", Object)
|
|
27
31
|
], PunchMarketingHistory.prototype, "user", void 0);
|
|
28
32
|
__decorate([
|
|
29
33
|
(0, typegoose_1.prop)({ required: true, ref: () => punch_marketing_model_1.PunchMarketing }),
|
|
30
34
|
__metadata("design:type", Object)
|
|
31
35
|
], PunchMarketingHistory.prototype, "marketing", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typegoose_1.prop)({ required: true, ref: () => shop_model_1.Shop }),
|
|
38
|
+
__metadata("design:type", Object)
|
|
39
|
+
], PunchMarketingHistory.prototype, "shop", void 0);
|
|
32
40
|
__decorate([
|
|
33
41
|
(0, typegoose_1.prop)({ type: Number, default: 1 }),
|
|
34
42
|
__metadata("design:type", Number)
|
|
@@ -36,7 +44,15 @@ __decorate([
|
|
|
36
44
|
__decorate([
|
|
37
45
|
(0, typegoose_1.prop)({ type: Date }),
|
|
38
46
|
__metadata("design:type", Date)
|
|
39
|
-
], PunchMarketingHistory.prototype, "
|
|
47
|
+
], PunchMarketingHistory.prototype, "expiryDate", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typegoose_1.prop)({ type: Date, default: null }),
|
|
50
|
+
__metadata("design:type", Date)
|
|
51
|
+
], PunchMarketingHistory.prototype, "completedAt", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
54
|
+
__metadata("design:type", Boolean)
|
|
55
|
+
], PunchMarketingHistory.prototype, "discountApplied", void 0);
|
|
40
56
|
exports.PunchMarketingHistory = PunchMarketingHistory = __decorate([
|
|
41
57
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'punchMarketingHistories' } })
|
|
42
58
|
], 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,
|
|
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;CACjC,CAAA;AArBY,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,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;8DACP;gCApBrB,qBAAqB;IADjC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,yBAAyB,EAAE,EAAE,CAAC;GAC9D,qBAAqB,CAqBjC","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: Boolean, default: false })\n\tpublic discountApplied!: boolean;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
|
+
import { User } from './user.model';
|
|
4
|
+
import { Shop } from './shop.model';
|
|
5
|
+
import { Order } from './order.model';
|
|
6
|
+
import { Admin } from './admin.model';
|
|
7
|
+
import { TicketType, TicketStatus } from '../../../utilities/enum';
|
|
8
|
+
import { Chatroom } from './chat-room.model';
|
|
9
|
+
export declare class Ticket extends TimeStamps {
|
|
10
|
+
ticketId: string;
|
|
11
|
+
type: TicketType;
|
|
12
|
+
status: TicketStatus;
|
|
13
|
+
client: Ref<User | Shop>;
|
|
14
|
+
clientType: string;
|
|
15
|
+
subject: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
order?: Ref<Order>;
|
|
18
|
+
assignedAgent?: Ref<Admin>;
|
|
19
|
+
assignedAt?: Date;
|
|
20
|
+
assignmentAttempts?: number;
|
|
21
|
+
chatroom: Ref<Chatroom>;
|
|
22
|
+
resolvedAt?: Date;
|
|
23
|
+
closedAt?: Date;
|
|
24
|
+
resolutionTimeMinutes?: number;
|
|
25
|
+
customerRating?: number;
|
|
26
|
+
customerFeedback?: string;
|
|
27
|
+
agentScore?: number;
|
|
28
|
+
tags?: string[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.Ticket = void 0;
|
|
46
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
47
|
+
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
48
|
+
const order_model_1 = require("./order.model");
|
|
49
|
+
const admin_model_1 = require("./admin.model");
|
|
50
|
+
const enum_1 = require("../../../utilities/enum");
|
|
51
|
+
const chat_room_model_1 = require("./chat-room.model");
|
|
52
|
+
let Ticket = class Ticket extends defaultClasses_1.TimeStamps {
|
|
53
|
+
ticketId;
|
|
54
|
+
type;
|
|
55
|
+
status;
|
|
56
|
+
client;
|
|
57
|
+
clientType;
|
|
58
|
+
subject;
|
|
59
|
+
description;
|
|
60
|
+
order;
|
|
61
|
+
assignedAgent;
|
|
62
|
+
assignedAt;
|
|
63
|
+
assignmentAttempts;
|
|
64
|
+
chatroom;
|
|
65
|
+
resolvedAt;
|
|
66
|
+
closedAt;
|
|
67
|
+
resolutionTimeMinutes;
|
|
68
|
+
customerRating;
|
|
69
|
+
customerFeedback;
|
|
70
|
+
agentScore;
|
|
71
|
+
tags;
|
|
72
|
+
};
|
|
73
|
+
exports.Ticket = Ticket;
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typegoose_1.prop)({ required: true, type: String, unique: true }),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], Ticket.prototype, "ticketId", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.TicketType }),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], Ticket.prototype, "type", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.TicketStatus, default: enum_1.TicketStatus.PENDING }),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], Ticket.prototype, "status", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typegoose_1.prop)({ refPath: 'clientType', required: true }),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], Ticket.prototype, "client", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: ['User', 'Shop'] }),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], Ticket.prototype, "clientType", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typegoose_1.prop)({ type: String, required: true }),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], Ticket.prototype, "subject", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], Ticket.prototype, "description", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typegoose_1.prop)({ ref: () => order_model_1.Order }),
|
|
104
|
+
__metadata("design:type", Object)
|
|
105
|
+
], Ticket.prototype, "order", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typegoose_1.prop)({ ref: () => admin_model_1.Admin }),
|
|
108
|
+
__metadata("design:type", Object)
|
|
109
|
+
], Ticket.prototype, "assignedAgent", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
112
|
+
__metadata("design:type", Date)
|
|
113
|
+
], Ticket.prototype, "assignedAt", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
116
|
+
__metadata("design:type", Number)
|
|
117
|
+
], Ticket.prototype, "assignmentAttempts", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typegoose_1.prop)({ ref: () => chat_room_model_1.Chatroom, required: true }),
|
|
120
|
+
__metadata("design:type", Object)
|
|
121
|
+
], Ticket.prototype, "chatroom", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
124
|
+
__metadata("design:type", Date)
|
|
125
|
+
], Ticket.prototype, "resolvedAt", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typegoose_1.prop)({ type: Date }),
|
|
128
|
+
__metadata("design:type", Date)
|
|
129
|
+
], Ticket.prototype, "closedAt", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typegoose_1.prop)({ type: Number }),
|
|
132
|
+
__metadata("design:type", Number)
|
|
133
|
+
], Ticket.prototype, "resolutionTimeMinutes", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typegoose_1.prop)({ type: Number, min: 1, max: 5 }),
|
|
136
|
+
__metadata("design:type", Number)
|
|
137
|
+
], Ticket.prototype, "customerRating", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
140
|
+
__metadata("design:type", String)
|
|
141
|
+
], Ticket.prototype, "customerFeedback", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, typegoose_1.prop)({ type: Number }),
|
|
144
|
+
__metadata("design:type", Number)
|
|
145
|
+
], Ticket.prototype, "agentScore", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, typegoose_1.prop)({ type: [String], default: [] }),
|
|
148
|
+
__metadata("design:type", Array)
|
|
149
|
+
], Ticket.prototype, "tags", void 0);
|
|
150
|
+
exports.Ticket = Ticket = __decorate([
|
|
151
|
+
(0, typegoose_1.pre)('save', async function (next) {
|
|
152
|
+
if (this.isNew && !this.ticketId) {
|
|
153
|
+
const { CounterModel } = await Promise.resolve().then(() => __importStar(require('.')));
|
|
154
|
+
try {
|
|
155
|
+
const counter = await CounterModel.findOneAndUpdate({ counterType: 'ticket' }, { $inc: { value: 1 } }, { new: true, upsert: true });
|
|
156
|
+
const currentDate = new Date().toISOString().slice(0, 10).replace(/-/g, '');
|
|
157
|
+
this.ticketId = `TKT-${currentDate}-${String(counter.value).padStart(4, '0')}`;
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
return next(error);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
next();
|
|
164
|
+
}),
|
|
165
|
+
(0, typegoose_1.modelOptions)({
|
|
166
|
+
schemaOptions: {
|
|
167
|
+
collection: 'tickets',
|
|
168
|
+
timestamps: true,
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
(0, typegoose_1.index)({ assignedAgent: 1, status: 1 }),
|
|
172
|
+
(0, typegoose_1.index)({ type: 1, status: 1, priority: 1 }),
|
|
173
|
+
(0, typegoose_1.index)({ client: 1, clientType: 1, status: 1 }),
|
|
174
|
+
(0, typegoose_1.index)({ createdAt: -1 }),
|
|
175
|
+
(0, typegoose_1.index)({ ticketId: 1 }, { unique: true }),
|
|
176
|
+
(0, typegoose_1.index)({ chatroom: 1 })
|
|
177
|
+
], Ticket);
|
|
178
|
+
//# sourceMappingURL=ticket.model.js.map
|
|
@@ -0,0 +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;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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,EAAE,CAAC,EAAE,CAAC;GACV,MAAM,CAyDlB","sourcesContent":["import { prop, Ref, index, modelOptions, pre, post } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Order } from './order.model';\nimport { Admin } from './admin.model';\nimport { TicketType, TicketStatus } from '../../../utilities/enum';\nimport { Chatroom } from './chat-room.model';\n\n@pre<Ticket>('save', async function (next) {\n\tif (this.isNew && !this.ticketId) {\n\t\tconst { CounterModel } = await import('.');\n\n\t\ttry {\n\t\t\tconst counter = await CounterModel.findOneAndUpdate(\n\t\t\t\t{ counterType: 'ticket' },\n\t\t\t\t{ $inc: { value: 1 } },\n\t\t\t\t{ new: true, upsert: true }\n\t\t\t);\n\n\t\t\tconst currentDate = new Date().toISOString().slice(0, 10).replace(/-/g, '');\n\t\t\tthis.ticketId = `TKT-${currentDate}-${String(counter.value).padStart(4, '0')}`;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'tickets',\n\t\ttimestamps: true,\n\t},\n})\n@index({ assignedAgent: 1, status: 1 })\n@index({ type: 1, status: 1, priority: 1 })\n@index({ client: 1, clientType: 1, status: 1 })\n@index({ createdAt: -1 })\n@index({ 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"]}
|
package/dist/utilities/enum.d.ts
CHANGED
|
@@ -161,10 +161,6 @@ export declare enum PriceOption {
|
|
|
161
161
|
PRICE_PER_UNIT = "price_per_unit",
|
|
162
162
|
PRICE_PER_PORTION = "price_per_portion"
|
|
163
163
|
}
|
|
164
|
-
export declare enum AttributeItemSelectionType {
|
|
165
|
-
SINGLE = "single",
|
|
166
|
-
MULTIPLE = "multiple"
|
|
167
|
-
}
|
|
168
164
|
export declare enum ProductDietaryType {
|
|
169
165
|
GLUTEN_FREE = "gluten_free",
|
|
170
166
|
LOW_CAL = "low_cal",
|
|
@@ -234,7 +230,8 @@ export declare enum CounterType {
|
|
|
234
230
|
ORDER = "order",
|
|
235
231
|
CRM_NUMBER = "crm_number",
|
|
236
232
|
shop = "shop",
|
|
237
|
-
PAYOUT = "payout"
|
|
233
|
+
PAYOUT = "payout",
|
|
234
|
+
TICKET = "ticket"
|
|
238
235
|
}
|
|
239
236
|
export declare enum FaqAccountType {
|
|
240
237
|
USER = "user",
|
|
@@ -394,11 +391,6 @@ export declare enum OrderFinanceStatus {
|
|
|
394
391
|
DELIVERED = "delivered",
|
|
395
392
|
CANCELLED = "cancelled"
|
|
396
393
|
}
|
|
397
|
-
export declare enum OrderCancelBy {
|
|
398
|
-
USER = "user",
|
|
399
|
-
ADMIN = "admin",
|
|
400
|
-
SHOP = "shop"
|
|
401
|
-
}
|
|
402
394
|
export declare enum CourierServiceType {
|
|
403
395
|
DELIVERY_ONLY = "delivery_only",
|
|
404
396
|
PURCHASE_AND_DELIVER = "purchase_and_deliver"
|
|
@@ -483,3 +475,23 @@ export declare enum RewardedToTypeEnum {
|
|
|
483
475
|
BUSINESS_DEVELOPMENT_EXECUTIVE = "business_development_executive",
|
|
484
476
|
RIDER = "rider"
|
|
485
477
|
}
|
|
478
|
+
export declare enum TicketType {
|
|
479
|
+
ORDER = "order",
|
|
480
|
+
ACCOUNT = "account"
|
|
481
|
+
}
|
|
482
|
+
export declare enum TicketStatus {
|
|
483
|
+
PENDING = "pending",
|
|
484
|
+
ONGOING = "ongoing",
|
|
485
|
+
RESOLVED = "resolved"
|
|
486
|
+
}
|
|
487
|
+
export declare enum MessageSender {
|
|
488
|
+
User = "User",
|
|
489
|
+
Admin = "Admin",
|
|
490
|
+
Shop = "Shop",
|
|
491
|
+
Rider = "Rider"
|
|
492
|
+
}
|
|
493
|
+
export declare enum ChatroomType {
|
|
494
|
+
TICKET = "TICKET",
|
|
495
|
+
DIRECT = "DIRECT",
|
|
496
|
+
ORDER_CHAT = "ORDER_CHAT"
|
|
497
|
+
}
|