@eventista/ticketing-common 1.0.0
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/README.md +2 -0
- package/dist/database/index.d.ts +2 -0
- package/dist/database/index.js +19 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/mongodb/index.d.ts +2 -0
- package/dist/database/mongodb/index.js +19 -0
- package/dist/database/mongodb/index.js.map +1 -0
- package/dist/database/mongodb/mongodb.module.d.ts +2 -0
- package/dist/database/mongodb/mongodb.module.js +50 -0
- package/dist/database/mongodb/mongodb.module.js.map +1 -0
- package/dist/database/mongodb/mongodb.service.d.ts +29 -0
- package/dist/database/mongodb/mongodb.service.js +114 -0
- package/dist/database/mongodb/mongodb.service.js.map +1 -0
- package/dist/database/redis/index.d.ts +2 -0
- package/dist/database/redis/index.js +19 -0
- package/dist/database/redis/index.js.map +1 -0
- package/dist/database/redis/redis.module.d.ts +2 -0
- package/dist/database/redis/redis.module.js +52 -0
- package/dist/database/redis/redis.module.js.map +1 -0
- package/dist/database/redis/redis.service.d.ts +26 -0
- package/dist/database/redis/redis.service.js +126 -0
- package/dist/database/redis/redis.service.js.map +1 -0
- package/dist/exception/exception.filter.d.ts +4 -0
- package/dist/exception/exception.filter.js +35 -0
- package/dist/exception/exception.filter.js.map +1 -0
- package/dist/generic-repository/index.d.ts +4 -0
- package/dist/generic-repository/index.js +21 -0
- package/dist/generic-repository/index.js.map +1 -0
- package/dist/generic-repository/repositories/base.repository.d.ts +39 -0
- package/dist/generic-repository/repositories/base.repository.interface.d.ts +36 -0
- package/dist/generic-repository/repositories/base.repository.interface.js +3 -0
- package/dist/generic-repository/repositories/base.repository.interface.js.map +1 -0
- package/dist/generic-repository/repositories/base.repository.js +96 -0
- package/dist/generic-repository/repositories/base.repository.js.map +1 -0
- package/dist/generic-repository/services/base.service.d.ts +42 -0
- package/dist/generic-repository/services/base.service.interface.d.ts +36 -0
- package/dist/generic-repository/services/base.service.interface.js +3 -0
- package/dist/generic-repository/services/base.service.interface.js.map +1 -0
- package/dist/generic-repository/services/base.service.js +57 -0
- package/dist/generic-repository/services/base.service.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/custom.logger.d.ts +14 -0
- package/dist/logger/custom.logger.js +76 -0
- package/dist/logger/custom.logger.js.map +1 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger/index.js +19 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.module.d.ts +2 -0
- package/dist/logger/logger.module.js +27 -0
- package/dist/logger/logger.module.js.map +1 -0
- package/dist/pipes/custom-validation.pipe.d.ts +7 -0
- package/dist/pipes/custom-validation.pipe.js +69 -0
- package/dist/pipes/custom-validation.pipe.js.map +1 -0
- package/dist/response/response.interceptor.d.ts +5 -0
- package/dist/response/response.interceptor.js +29 -0
- package/dist/response/response.interceptor.js.map +1 -0
- package/dist/schemas/base.schema.d.ts +11 -0
- package/dist/schemas/base.schema.js +29 -0
- package/dist/schemas/base.schema.js.map +1 -0
- package/dist/schemas/event/event.interfaces.d.ts +69 -0
- package/dist/schemas/event/event.interfaces.js +9 -0
- package/dist/schemas/event/event.interfaces.js.map +1 -0
- package/dist/schemas/event/event.schema.d.ts +70 -0
- package/dist/schemas/event/event.schema.js +242 -0
- package/dist/schemas/event/event.schema.js.map +1 -0
- package/dist/schemas/index.d.ts +14 -0
- package/dist/schemas/index.js +31 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/order/order.interfaces.d.ts +72 -0
- package/dist/schemas/order/order.interfaces.js +31 -0
- package/dist/schemas/order/order.interfaces.js.map +1 -0
- package/dist/schemas/order/order.schema.d.ts +39 -0
- package/dist/schemas/order/order.schema.js +162 -0
- package/dist/schemas/order/order.schema.js.map +1 -0
- package/dist/schemas/promotions/promotions.interfaces.d.ts +30 -0
- package/dist/schemas/promotions/promotions.interfaces.js +14 -0
- package/dist/schemas/promotions/promotions.interfaces.js.map +1 -0
- package/dist/schemas/promotions/promotions.schema.d.ts +25 -0
- package/dist/schemas/promotions/promotions.schema.js +92 -0
- package/dist/schemas/promotions/promotions.schema.js.map +1 -0
- package/dist/schemas/rows/rows.interfaces.d.ts +14 -0
- package/dist/schemas/rows/rows.interfaces.js +3 -0
- package/dist/schemas/rows/rows.interfaces.js.map +1 -0
- package/dist/schemas/rows/rows.schema.d.ts +22 -0
- package/dist/schemas/rows/rows.schema.js +65 -0
- package/dist/schemas/rows/rows.schema.js.map +1 -0
- package/dist/schemas/schema.helper.d.ts +4 -0
- package/dist/schemas/schema.helper.js +84 -0
- package/dist/schemas/schema.helper.js.map +1 -0
- package/dist/schemas/ticket-classes/ticket-classes.interfaces.d.ts +18 -0
- package/dist/schemas/ticket-classes/ticket-classes.interfaces.js +3 -0
- package/dist/schemas/ticket-classes/ticket-classes.interfaces.js.map +1 -0
- package/dist/schemas/ticket-classes/ticket-classes.schemas.d.ts +26 -0
- package/dist/schemas/ticket-classes/ticket-classes.schemas.js +75 -0
- package/dist/schemas/ticket-classes/ticket-classes.schemas.js.map +1 -0
- package/dist/schemas/ticket-summary/ticket-summary.interfaces.d.ts +19 -0
- package/dist/schemas/ticket-summary/ticket-summary.interfaces.js +9 -0
- package/dist/schemas/ticket-summary/ticket-summary.interfaces.js.map +1 -0
- package/dist/schemas/ticket-summary/ticket-summary.schema.d.ts +23 -0
- package/dist/schemas/ticket-summary/ticket-summary.schema.js +65 -0
- package/dist/schemas/ticket-summary/ticket-summary.schema.js.map +1 -0
- package/dist/schemas/user-fanpass/user-fanpass.interfaces.d.ts +26 -0
- package/dist/schemas/user-fanpass/user-fanpass.interfaces.js +9 -0
- package/dist/schemas/user-fanpass/user-fanpass.interfaces.js.map +1 -0
- package/dist/schemas/user-fanpass/user-fanpass.schemas.d.ts +29 -0
- package/dist/schemas/user-fanpass/user-fanpass.schemas.js +113 -0
- package/dist/schemas/user-fanpass/user-fanpass.schemas.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +40 -0
- package/src/database/index.ts +2 -0
- package/src/database/mongodb/index.ts +2 -0
- package/src/database/mongodb/mongodb.module.ts +42 -0
- package/src/database/mongodb/mongodb.service.ts +111 -0
- package/src/database/redis/index.ts +2 -0
- package/src/database/redis/redis.module.ts +45 -0
- package/src/database/redis/redis.service.ts +142 -0
- package/src/exception/exception.filter.ts +36 -0
- package/src/generic-repository/index.ts +7 -0
- package/src/generic-repository/repositories/base.repository.interface.ts +78 -0
- package/src/generic-repository/repositories/base.repository.ts +199 -0
- package/src/generic-repository/services/base.service.interface.ts +78 -0
- package/src/generic-repository/services/base.service.ts +165 -0
- package/src/index.ts +11 -0
- package/src/logger/custom.logger.ts +83 -0
- package/src/logger/index.ts +2 -0
- package/src/logger/logger.module.ts +14 -0
- package/src/pipes/custom-validation.pipe.ts +61 -0
- package/src/response/response.interceptor.ts +26 -0
- package/src/schemas/base.schema.ts +19 -0
- package/src/schemas/event/event.interfaces.ts +74 -0
- package/src/schemas/event/event.schema.ts +195 -0
- package/src/schemas/index.ts +16 -0
- package/src/schemas/order/order.interfaces.ts +78 -0
- package/src/schemas/order/order.schema.ts +120 -0
- package/src/schemas/promotions/promotions.interfaces.ts +34 -0
- package/src/schemas/promotions/promotions.schema.ts +71 -0
- package/src/schemas/rows/rows.interfaces.ts +14 -0
- package/src/schemas/rows/rows.schema.ts +47 -0
- package/src/schemas/schema.helper.ts +103 -0
- package/src/schemas/ticket-classes/ticket-classes.interfaces.ts +18 -0
- package/src/schemas/ticket-classes/ticket-classes.schemas.ts +51 -0
- package/src/schemas/ticket-summary/ticket-summary.interfaces.ts +20 -0
- package/src/schemas/ticket-summary/ticket-summary.schema.ts +46 -0
- package/src/schemas/user-fanpass/user-fanpass.interfaces.ts +28 -0
- package/src/schemas/user-fanpass/user-fanpass.schemas.ts +86 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,162 @@
|
|
|
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.OrderSchema = exports.Order = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const index_1 = require("../index");
|
|
15
|
+
const order_interfaces_1 = require("./order.interfaces");
|
|
16
|
+
let Order = class Order extends index_1.BaseSchema {
|
|
17
|
+
};
|
|
18
|
+
exports.Order = Order;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, mongoose_1.Prop)({
|
|
21
|
+
required: true,
|
|
22
|
+
index: true,
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], Order.prototype, "eventId", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)({
|
|
28
|
+
required: true,
|
|
29
|
+
enum: Object.values(order_interfaces_1.IOrderStatus),
|
|
30
|
+
default: order_interfaces_1.IOrderStatus.PENDING,
|
|
31
|
+
index: true,
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], Order.prototype, "status", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, mongoose_1.Prop)({ required: true, index: true }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], Order.prototype, "userId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, mongoose_1.Prop)({
|
|
41
|
+
required: true,
|
|
42
|
+
enum: ['event', 'fanpass', 'merchandise'],
|
|
43
|
+
index: true,
|
|
44
|
+
}),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], Order.prototype, "productType", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, mongoose_1.Prop)({
|
|
49
|
+
enum: Object.values(order_interfaces_1.IPaymentGatewayTypes),
|
|
50
|
+
index: true,
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], Order.prototype, "paymentGateway", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, mongoose_1.Prop)({ type: [Object], required: true, default: [] }),
|
|
56
|
+
__metadata("design:type", Array)
|
|
57
|
+
], Order.prototype, "tickets", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, mongoose_1.Prop)(),
|
|
60
|
+
__metadata("design:type", Date)
|
|
61
|
+
], Order.prototype, "paymentTime", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, mongoose_1.Prop)({
|
|
64
|
+
enum: ['pending', 'delivered', 'canceled'],
|
|
65
|
+
default: 'pending',
|
|
66
|
+
}),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], Order.prototype, "deliveryStatus", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, mongoose_1.Prop)([
|
|
71
|
+
{
|
|
72
|
+
id: String,
|
|
73
|
+
name: String,
|
|
74
|
+
price: Number,
|
|
75
|
+
thumbnail: String,
|
|
76
|
+
promotion: Object,
|
|
77
|
+
quantity: Number,
|
|
78
|
+
totalAmount: Number,
|
|
79
|
+
},
|
|
80
|
+
]),
|
|
81
|
+
__metadata("design:type", Array)
|
|
82
|
+
], Order.prototype, "products", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, mongoose_1.Prop)({
|
|
85
|
+
type: {
|
|
86
|
+
code: String,
|
|
87
|
+
discountPercent: Number,
|
|
88
|
+
maxValue: Number,
|
|
89
|
+
},
|
|
90
|
+
default: {}
|
|
91
|
+
}),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], Order.prototype, "promotionUsed", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, mongoose_1.Prop)({ enum: ['VND', 'USD'] }),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], Order.prototype, "currencyCode", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, mongoose_1.Prop)(),
|
|
100
|
+
__metadata("design:type", Number)
|
|
101
|
+
], Order.prototype, "originalAmount", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, mongoose_1.Prop)(),
|
|
104
|
+
__metadata("design:type", Number)
|
|
105
|
+
], Order.prototype, "originalAmountUSD", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, mongoose_1.Prop)(),
|
|
108
|
+
__metadata("design:type", Number)
|
|
109
|
+
], Order.prototype, "amount", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, mongoose_1.Prop)(),
|
|
112
|
+
__metadata("design:type", Number)
|
|
113
|
+
], Order.prototype, "amountInUSD", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, mongoose_1.Prop)(),
|
|
116
|
+
__metadata("design:type", String)
|
|
117
|
+
], Order.prototype, "userRefId", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, mongoose_1.Prop)(),
|
|
120
|
+
__metadata("design:type", Date)
|
|
121
|
+
], Order.prototype, "confirmAt", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, mongoose_1.Prop)({ default: 'web' }),
|
|
124
|
+
__metadata("design:type", String)
|
|
125
|
+
], Order.prototype, "sellFromPlatform", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, mongoose_1.Prop)({ default: '' }),
|
|
128
|
+
__metadata("design:type", String)
|
|
129
|
+
], Order.prototype, "cancelReason", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, mongoose_1.Prop)({ required: true }),
|
|
132
|
+
__metadata("design:type", Number)
|
|
133
|
+
], Order.prototype, "quantity", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, mongoose_1.Prop)({ required: true }),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], Order.prototype, "calendarId", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, mongoose_1.Prop)(),
|
|
140
|
+
__metadata("design:type", String)
|
|
141
|
+
], Order.prototype, "zoneId", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, mongoose_1.Prop)({ required: true, index: true }),
|
|
144
|
+
__metadata("design:type", String)
|
|
145
|
+
], Order.prototype, "ticketClassId", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, mongoose_1.Prop)(),
|
|
148
|
+
__metadata("design:type", Number)
|
|
149
|
+
], Order.prototype, "timeCreatePayment", void 0);
|
|
150
|
+
exports.Order = Order = __decorate([
|
|
151
|
+
(0, mongoose_1.Schema)({
|
|
152
|
+
collection: 'orders',
|
|
153
|
+
...index_1.defaultSchemaOptions,
|
|
154
|
+
})
|
|
155
|
+
], Order);
|
|
156
|
+
exports.OrderSchema = mongoose_1.SchemaFactory.createForClass(Order);
|
|
157
|
+
(0, index_1.addSoftDeleteHooks)(exports.OrderSchema);
|
|
158
|
+
(0, index_1.addUpdateHooks)(exports.OrderSchema);
|
|
159
|
+
exports.OrderSchema.index({ isDeleted: 1 });
|
|
160
|
+
exports.OrderSchema.index({ userId: 1, status: 1 });
|
|
161
|
+
exports.OrderSchema.index({ eventId: 1, status: 1 });
|
|
162
|
+
//# sourceMappingURL=order.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.schema.js","sourceRoot":"","sources":["../../../src/schemas/order/order.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAE/D,oCAA8G;AAC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C,cAAc,CAAC,KAAK,CAAC,CAAC;AAG/D,IAAA,0BAAkB,EAAC,mBAAW,CAAC,CAAC;AAChC,IAAA,sBAAc,EAAC,mBAAW,CAAC,CAAC;AAG5B,mBAAW,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;AACpC,mBAAW,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AAC5C,mBAAW,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum IPromotionAppliesTo {
|
|
2
|
+
EVENT = "event",
|
|
3
|
+
TICKET = "ticket"
|
|
4
|
+
}
|
|
5
|
+
export interface IPromotionDiscount {
|
|
6
|
+
percent: number;
|
|
7
|
+
percentInUSD: number;
|
|
8
|
+
maxValue: number;
|
|
9
|
+
maxValueInUSD: number;
|
|
10
|
+
}
|
|
11
|
+
export declare enum IPromotionType {
|
|
12
|
+
AUTO = "auto",
|
|
13
|
+
MANUALLY = "manually"
|
|
14
|
+
}
|
|
15
|
+
export interface IPromotion {
|
|
16
|
+
_id?: string;
|
|
17
|
+
eventId: string;
|
|
18
|
+
code: string;
|
|
19
|
+
appliesTo: IPromotionAppliesTo;
|
|
20
|
+
active: boolean;
|
|
21
|
+
maxUsage: number;
|
|
22
|
+
discount: IPromotionDiscount;
|
|
23
|
+
tickets: Record<string, any>[];
|
|
24
|
+
type: IPromotionType;
|
|
25
|
+
minOrderAmount: number;
|
|
26
|
+
minOrderAmountInUSD: number;
|
|
27
|
+
createdAt?: Date;
|
|
28
|
+
updatedAt?: Date;
|
|
29
|
+
isDeleted?: boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IPromotionType = exports.IPromotionAppliesTo = void 0;
|
|
4
|
+
var IPromotionAppliesTo;
|
|
5
|
+
(function (IPromotionAppliesTo) {
|
|
6
|
+
IPromotionAppliesTo["EVENT"] = "event";
|
|
7
|
+
IPromotionAppliesTo["TICKET"] = "ticket";
|
|
8
|
+
})(IPromotionAppliesTo || (exports.IPromotionAppliesTo = IPromotionAppliesTo = {}));
|
|
9
|
+
var IPromotionType;
|
|
10
|
+
(function (IPromotionType) {
|
|
11
|
+
IPromotionType["AUTO"] = "auto";
|
|
12
|
+
IPromotionType["MANUALLY"] = "manually";
|
|
13
|
+
})(IPromotionType || (exports.IPromotionType = IPromotionType = {}));
|
|
14
|
+
//# sourceMappingURL=promotions.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotions.interfaces.js","sourceRoot":"","sources":["../../../src/schemas/promotions/promotions.interfaces.ts"],"names":[],"mappings":";;;AACA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,sCAAe,CAAA;IACf,wCAAiB,CAAA;AACrB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AASD,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,uCAAqB,CAAA;AACzB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HydratedDocument } from 'mongoose';
|
|
2
|
+
import { BaseDocument, BaseSchema } from '../index';
|
|
3
|
+
import { IPromotionAppliesTo, IPromotionDiscount, IPromotionType } from './promotions.interfaces';
|
|
4
|
+
export type PromotionDocument = HydratedDocument<Promotion> & BaseDocument;
|
|
5
|
+
export declare class Promotion extends BaseSchema {
|
|
6
|
+
eventId: string;
|
|
7
|
+
code: string;
|
|
8
|
+
appliesTo: IPromotionAppliesTo;
|
|
9
|
+
active: boolean;
|
|
10
|
+
maxUsage: number;
|
|
11
|
+
discount: IPromotionDiscount;
|
|
12
|
+
tickets: Record<string, any>[];
|
|
13
|
+
type: IPromotionType;
|
|
14
|
+
minOrderAmount: number;
|
|
15
|
+
minOrderAmountInUSD: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const PromotionSchema: import("mongoose").Schema<Promotion, import("mongoose").Model<Promotion, any, any, any, import("mongoose").Document<unknown, any, Promotion, any> & Promotion & {
|
|
18
|
+
_id: import("mongoose").Types.ObjectId;
|
|
19
|
+
} & {
|
|
20
|
+
__v: number;
|
|
21
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Promotion, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Promotion>, {}> & import("mongoose").FlatRecord<Promotion> & {
|
|
22
|
+
_id: import("mongoose").Types.ObjectId;
|
|
23
|
+
} & {
|
|
24
|
+
__v: number;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,92 @@
|
|
|
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.PromotionSchema = exports.Promotion = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const index_1 = require("../index");
|
|
15
|
+
const promotions_interfaces_1 = require("./promotions.interfaces");
|
|
16
|
+
let Promotion = class Promotion extends index_1.BaseSchema {
|
|
17
|
+
};
|
|
18
|
+
exports.Promotion = Promotion;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, mongoose_1.Prop)({
|
|
21
|
+
required: true,
|
|
22
|
+
index: true,
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], Promotion.prototype, "eventId", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, mongoose_1.Prop)(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], Promotion.prototype, "code", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, mongoose_1.Prop)({
|
|
32
|
+
enum: Object.values(promotions_interfaces_1.IPromotionAppliesTo),
|
|
33
|
+
index: true,
|
|
34
|
+
default: promotions_interfaces_1.IPromotionAppliesTo.EVENT,
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], Promotion.prototype, "appliesTo", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, mongoose_1.Prop)({
|
|
40
|
+
default: true,
|
|
41
|
+
type: Boolean,
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", Boolean)
|
|
44
|
+
], Promotion.prototype, "active", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, mongoose_1.Prop)({
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 0,
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], Promotion.prototype, "maxUsage", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, mongoose_1.Prop)({
|
|
54
|
+
type: {
|
|
55
|
+
percent: { type: Number },
|
|
56
|
+
percentInUSD: { type: Number },
|
|
57
|
+
maxValue: { type: Number },
|
|
58
|
+
maxValueInUSD: { type: Number },
|
|
59
|
+
},
|
|
60
|
+
default: {},
|
|
61
|
+
}),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], Promotion.prototype, "discount", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, mongoose_1.Prop)({ type: [Object], required: true, default: [] }),
|
|
66
|
+
__metadata("design:type", Array)
|
|
67
|
+
], Promotion.prototype, "tickets", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, mongoose_1.Prop)({
|
|
70
|
+
enum: Object.values(promotions_interfaces_1.IPromotionType),
|
|
71
|
+
}),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], Promotion.prototype, "type", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, mongoose_1.Prop)(),
|
|
76
|
+
__metadata("design:type", Number)
|
|
77
|
+
], Promotion.prototype, "minOrderAmount", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, mongoose_1.Prop)(),
|
|
80
|
+
__metadata("design:type", Number)
|
|
81
|
+
], Promotion.prototype, "minOrderAmountInUSD", void 0);
|
|
82
|
+
exports.Promotion = Promotion = __decorate([
|
|
83
|
+
(0, mongoose_1.Schema)({
|
|
84
|
+
collection: 'orders',
|
|
85
|
+
...index_1.defaultSchemaOptions,
|
|
86
|
+
})
|
|
87
|
+
], Promotion);
|
|
88
|
+
exports.PromotionSchema = mongoose_1.SchemaFactory.createForClass(Promotion);
|
|
89
|
+
(0, index_1.addUpdateHooks)(exports.PromotionSchema);
|
|
90
|
+
(0, index_1.addSoftDeleteHooks)(exports.PromotionSchema);
|
|
91
|
+
exports.PromotionSchema.index({ eventId: 1, code: 1 }, { unique: true });
|
|
92
|
+
//# sourceMappingURL=promotions.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotions.schema.js","sourceRoot":"","sources":["../../../src/schemas/promotions/promotions.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAE/D,oCAA8G;AAC9G,mEAAkG;AAO3F,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,kBAAU;CAuDxC,CAAA;AAvDY,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AEY,QAAA,eAAe,GAAG,wBAAa,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AACvE,IAAA,sBAAc,EAAC,uBAAe,CAAC,CAAC;AAChC,IAAA,0BAAkB,EAAC,uBAAe,CAAC,CAAC;AACpC,uBAAe,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IRow {
|
|
2
|
+
_id?: string;
|
|
3
|
+
calendarId: string;
|
|
4
|
+
eventId: string;
|
|
5
|
+
zoneId: string;
|
|
6
|
+
seatNumberingType: string;
|
|
7
|
+
seatNumberingFrom: string;
|
|
8
|
+
seatNumberingTo: string;
|
|
9
|
+
name: string;
|
|
10
|
+
position: number;
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
updatedAt?: Date;
|
|
13
|
+
isDeleted?: boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.interfaces.js","sourceRoot":"","sources":["../../../src/schemas/rows/rows.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HydratedDocument } from 'mongoose';
|
|
2
|
+
import { BaseDocument, BaseSchema } from '../index';
|
|
3
|
+
export type RowDocument = HydratedDocument<Row> & BaseDocument;
|
|
4
|
+
export declare class Row extends BaseSchema {
|
|
5
|
+
calendarId: string;
|
|
6
|
+
eventId: string;
|
|
7
|
+
zoneId: string;
|
|
8
|
+
seatNumberingType: string;
|
|
9
|
+
seatNumberingFrom: string;
|
|
10
|
+
seatNumberingTo: string;
|
|
11
|
+
name: string;
|
|
12
|
+
position: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const RowSchema: import("mongoose").Schema<Row, import("mongoose").Model<Row, any, any, any, import("mongoose").Document<unknown, any, Row, any> & Row & {
|
|
15
|
+
_id: import("mongoose").Types.ObjectId;
|
|
16
|
+
} & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Row, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Row>, {}> & import("mongoose").FlatRecord<Row> & {
|
|
19
|
+
_id: import("mongoose").Types.ObjectId;
|
|
20
|
+
} & {
|
|
21
|
+
__v: number;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.RowSchema = exports.Row = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const index_1 = require("../index");
|
|
15
|
+
let Row = class Row extends index_1.BaseSchema {
|
|
16
|
+
};
|
|
17
|
+
exports.Row = Row;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, mongoose_1.Prop)({}),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], Row.prototype, "calendarId", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, mongoose_1.Prop)({
|
|
24
|
+
required: true,
|
|
25
|
+
index: true,
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], Row.prototype, "eventId", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, mongoose_1.Prop)({
|
|
31
|
+
required: true,
|
|
32
|
+
index: true,
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Row.prototype, "zoneId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, mongoose_1.Prop)({}),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Row.prototype, "seatNumberingType", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, mongoose_1.Prop)({}),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Row.prototype, "seatNumberingFrom", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, mongoose_1.Prop)({}),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], Row.prototype, "seatNumberingTo", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, mongoose_1.Prop)({}),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], Row.prototype, "name", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, mongoose_1.Prop)({}),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], Row.prototype, "position", void 0);
|
|
56
|
+
exports.Row = Row = __decorate([
|
|
57
|
+
(0, mongoose_1.Schema)({
|
|
58
|
+
collection: 'rows',
|
|
59
|
+
...index_1.defaultSchemaOptions,
|
|
60
|
+
})
|
|
61
|
+
], Row);
|
|
62
|
+
exports.RowSchema = mongoose_1.SchemaFactory.createForClass(Row);
|
|
63
|
+
(0, index_1.addSoftDeleteHooks)(exports.RowSchema);
|
|
64
|
+
(0, index_1.addUpdateHooks)(exports.RowSchema);
|
|
65
|
+
//# sourceMappingURL=rows.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.schema.js","sourceRoot":"","sources":["../../../src/schemas/rows/rows.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAE/D,oCAA8G;AAQvG,IAAM,GAAG,GAAT,MAAM,GAAI,SAAQ,kBAAU;CA8BlC,CAAA;AA9BY,kBAAG;AAEZ;IADC,IAAA,eAAI,EAAC,EAAE,CAAC;;uCACU;AAMnB;IAJC,IAAA,eAAI,EAAC;QACF,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACd,CAAC;;oCACc;AAMhB;IAJC,IAAA,eAAI,EAAC;QACF,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACd,CAAC;;mCACa;AAGf;IADC,IAAA,eAAI,EAAC,EAAE,CAAC;;8CACiB;AAG1B;IADC,IAAA,eAAI,EAAC,EAAE,CAAC;;8CACiB;AAG1B;IADC,IAAA,eAAI,EAAC,EAAE,CAAC;;4CACe;AAGxB;IADC,IAAA,eAAI,EAAC,EAAE,CAAC;;iCACI;AAGb;IADC,IAAA,eAAI,EAAC,EAAE,CAAC;;qCACO;cA7BP,GAAG;IAJf,IAAA,iBAAM,EAAC;QACJ,UAAU,EAAE,MAAM;QAClB,GAAG,4BAAoB;KAC1B,CAAC;GACW,GAAG,CA8Bf;AAEY,QAAA,SAAS,GAAG,wBAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AAG3D,IAAA,0BAAkB,EAAC,iBAAS,CAAC,CAAC;AAC9B,IAAA,sBAAc,EAAC,iBAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addUpdateHooks = exports.addSoftDeleteHooks = exports.defaultSchemaOptions = void 0;
|
|
4
|
+
exports.defaultSchemaOptions = {
|
|
5
|
+
timestamps: { createdAt: 'createdAt', updatedAt: 'updatedAt' },
|
|
6
|
+
toJSON: {
|
|
7
|
+
virtuals: true,
|
|
8
|
+
transform: (_, ret) => {
|
|
9
|
+
delete ret.__v;
|
|
10
|
+
return ret;
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
toObject: {
|
|
14
|
+
virtuals: true,
|
|
15
|
+
transform: (_, ret) => {
|
|
16
|
+
delete ret.__v;
|
|
17
|
+
return ret;
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const addSoftDeleteHooks = (schema) => {
|
|
22
|
+
schema.pre('find', function () {
|
|
23
|
+
if (!this.getQuery().includeDeleted) {
|
|
24
|
+
this.where({ isDeleted: { $ne: true } });
|
|
25
|
+
}
|
|
26
|
+
delete this.getQuery().includeDeleted;
|
|
27
|
+
});
|
|
28
|
+
schema.pre('findOne', function () {
|
|
29
|
+
if (!this.getQuery().includeDeleted) {
|
|
30
|
+
this.where({ isDeleted: { $ne: true } });
|
|
31
|
+
}
|
|
32
|
+
delete this.getQuery().includeDeleted;
|
|
33
|
+
});
|
|
34
|
+
schema.pre('countDocuments', function () {
|
|
35
|
+
if (!this.getQuery().includeDeleted) {
|
|
36
|
+
this.where({ isDeleted: { $ne: true } });
|
|
37
|
+
}
|
|
38
|
+
delete this.getQuery().includeDeleted;
|
|
39
|
+
});
|
|
40
|
+
schema.methods.softDelete = async function () {
|
|
41
|
+
this.isDeleted = true;
|
|
42
|
+
this.updatedAt = new Date();
|
|
43
|
+
return this.save();
|
|
44
|
+
};
|
|
45
|
+
schema.methods.restore = async function () {
|
|
46
|
+
this.isDeleted = false;
|
|
47
|
+
return this.save();
|
|
48
|
+
};
|
|
49
|
+
schema.statics.softDeleteMany = async function (filter = {}) {
|
|
50
|
+
return this.updateMany(filter, {
|
|
51
|
+
$set: {
|
|
52
|
+
isDeleted: true,
|
|
53
|
+
updatedAt: new Date(),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
schema.statics.restoreMany = async function (filter = {}) {
|
|
58
|
+
return this.updateMany(filter, {
|
|
59
|
+
$set: {
|
|
60
|
+
isDeleted: false,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
exports.addSoftDeleteHooks = addSoftDeleteHooks;
|
|
66
|
+
const addUpdateHooks = (schema) => {
|
|
67
|
+
schema.pre('save', function (next) {
|
|
68
|
+
if (this.isModified()) {
|
|
69
|
+
this.updatedAt = new Date();
|
|
70
|
+
}
|
|
71
|
+
next();
|
|
72
|
+
});
|
|
73
|
+
schema.pre('updateOne', function () {
|
|
74
|
+
this.set({ updatedAt: new Date() });
|
|
75
|
+
});
|
|
76
|
+
schema.pre('updateMany', function () {
|
|
77
|
+
this.set({ updatedAt: new Date() });
|
|
78
|
+
});
|
|
79
|
+
schema.pre('findOneAndUpdate', function () {
|
|
80
|
+
this.set({ updatedAt: new Date() });
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
exports.addUpdateHooks = addUpdateHooks;
|
|
84
|
+
//# sourceMappingURL=schema.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.helper.js","sourceRoot":"","sources":["../../src/schemas/schema.helper.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAkB;IACjD,UAAU,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE;IAC9D,MAAM,EAAE;QACN,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YACpB,OAAO,GAAG,CAAC,GAAG,CAAC;YACf,OAAO,GAAG,CAAC;QACb,CAAC;KACF;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YACpB,OAAO,GAAG,CAAC,GAAG,CAAC;YACf,OAAO,GAAG,CAAC;QACb,CAAC;KACF;CACF,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAQ,EAAE;IAEzD,MAAM,CAAC,GAAG,CA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cAAc,kBAoBzB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ITicketClass {
|
|
2
|
+
_id?: string;
|
|
3
|
+
eventId: string;
|
|
4
|
+
calendarId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
color: string;
|
|
7
|
+
originalPriceVn: number;
|
|
8
|
+
originalPriceUsd: number;
|
|
9
|
+
finalPriceVn: number;
|
|
10
|
+
finalPriceUsd: number;
|
|
11
|
+
description: string;
|
|
12
|
+
seatType: string;
|
|
13
|
+
maxTicketPerUser: number;
|
|
14
|
+
prototypeUrl: string;
|
|
15
|
+
createdAt?: Date;
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
isDeleted?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticket-classes.interfaces.js","sourceRoot":"","sources":["../../../src/schemas/ticket-classes/ticket-classes.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HydratedDocument } from 'mongoose';
|
|
2
|
+
import { BaseDocument, BaseSchema } from '../index';
|
|
3
|
+
export type TicketClassDocument = HydratedDocument<TicketClass> & BaseDocument;
|
|
4
|
+
export declare class TicketClass extends BaseSchema {
|
|
5
|
+
eventId: string;
|
|
6
|
+
calendarId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
color: string;
|
|
9
|
+
originalPriceVn: number;
|
|
10
|
+
originalPriceUsd: number;
|
|
11
|
+
finalPriceVn: number;
|
|
12
|
+
finalPriceUsd: number;
|
|
13
|
+
description: string;
|
|
14
|
+
seatType: string;
|
|
15
|
+
maxTicketPerUser: number;
|
|
16
|
+
prototypeUrl: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const TicketClassSchema: import("mongoose").Schema<TicketClass, import("mongoose").Model<TicketClass, any, any, any, import("mongoose").Document<unknown, any, TicketClass, any> & TicketClass & {
|
|
19
|
+
_id: import("mongoose").Types.ObjectId;
|
|
20
|
+
} & {
|
|
21
|
+
__v: number;
|
|
22
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TicketClass, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<TicketClass>, {}> & import("mongoose").FlatRecord<TicketClass> & {
|
|
23
|
+
_id: import("mongoose").Types.ObjectId;
|
|
24
|
+
} & {
|
|
25
|
+
__v: number;
|
|
26
|
+
}>;
|