@eventista/ticketing-common 1.0.2 → 1.0.4
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/package.json +6 -3
- package/dist/cluster/config/cluster.config.d.ts +0 -8
- package/dist/cluster/config/cluster.config.js +0 -8
- package/dist/cluster/config/cluster.config.js.map +0 -1
- package/dist/cluster/index.d.ts +0 -2
- package/dist/cluster/index.js +0 -19
- package/dist/cluster/index.js.map +0 -1
- package/dist/cluster/modules/cluster.module.d.ts +0 -2
- package/dist/cluster/modules/cluster.module.js +0 -22
- package/dist/cluster/modules/cluster.module.js.map +0 -1
- package/dist/cluster/services/cluster.service.d.ts +0 -7
- package/dist/cluster/services/cluster.service.js +0 -63
- package/dist/cluster/services/cluster.service.js.map +0 -1
- package/dist/database/index.d.ts +0 -2
- package/dist/database/index.js +0 -19
- package/dist/database/index.js.map +0 -1
- package/dist/database/mongodb/index.d.ts +0 -2
- package/dist/database/mongodb/index.js +0 -19
- package/dist/database/mongodb/index.js.map +0 -1
- package/dist/database/mongodb/mongodb.module.d.ts +0 -2
- package/dist/database/mongodb/mongodb.module.js +0 -50
- package/dist/database/mongodb/mongodb.module.js.map +0 -1
- package/dist/database/mongodb/mongodb.service.d.ts +0 -29
- package/dist/database/mongodb/mongodb.service.js +0 -114
- package/dist/database/mongodb/mongodb.service.js.map +0 -1
- package/dist/database/redis/index.d.ts +0 -2
- package/dist/database/redis/index.js +0 -19
- package/dist/database/redis/index.js.map +0 -1
- package/dist/database/redis/redis.module.d.ts +0 -2
- package/dist/database/redis/redis.module.js +0 -52
- package/dist/database/redis/redis.module.js.map +0 -1
- package/dist/database/redis/redis.service.d.ts +0 -26
- package/dist/database/redis/redis.service.js +0 -126
- package/dist/database/redis/redis.service.js.map +0 -1
- package/dist/exception/exception.filter.d.ts +0 -4
- package/dist/exception/exception.filter.js +0 -35
- package/dist/exception/exception.filter.js.map +0 -1
- package/dist/generic-repository/index.d.ts +0 -4
- package/dist/generic-repository/index.js +0 -21
- package/dist/generic-repository/index.js.map +0 -1
- package/dist/generic-repository/repositories/base.repository.d.ts +0 -39
- package/dist/generic-repository/repositories/base.repository.interface.d.ts +0 -36
- package/dist/generic-repository/repositories/base.repository.interface.js +0 -3
- package/dist/generic-repository/repositories/base.repository.interface.js.map +0 -1
- package/dist/generic-repository/repositories/base.repository.js +0 -96
- package/dist/generic-repository/repositories/base.repository.js.map +0 -1
- package/dist/generic-repository/services/base.service.d.ts +0 -42
- package/dist/generic-repository/services/base.service.interface.d.ts +0 -36
- package/dist/generic-repository/services/base.service.interface.js +0 -3
- package/dist/generic-repository/services/base.service.interface.js.map +0 -1
- package/dist/generic-repository/services/base.service.js +0 -57
- package/dist/generic-repository/services/base.service.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -24
- package/dist/index.js.map +0 -1
- package/dist/logger/custom.logger.d.ts +0 -14
- package/dist/logger/custom.logger.js +0 -76
- package/dist/logger/custom.logger.js.map +0 -1
- package/dist/logger/index.d.ts +0 -2
- package/dist/logger/index.js +0 -19
- package/dist/logger/index.js.map +0 -1
- package/dist/logger/logger.module.d.ts +0 -2
- package/dist/logger/logger.module.js +0 -27
- package/dist/logger/logger.module.js.map +0 -1
- package/dist/pipes/custom-validation.pipe.d.ts +0 -7
- package/dist/pipes/custom-validation.pipe.js +0 -69
- package/dist/pipes/custom-validation.pipe.js.map +0 -1
- package/dist/response/response.interceptor.d.ts +0 -5
- package/dist/response/response.interceptor.js +0 -29
- package/dist/response/response.interceptor.js.map +0 -1
- package/dist/schemas/base.schema.d.ts +0 -11
- package/dist/schemas/base.schema.js +0 -29
- package/dist/schemas/base.schema.js.map +0 -1
- package/dist/schemas/event/event.interfaces.d.ts +0 -69
- package/dist/schemas/event/event.interfaces.js +0 -9
- package/dist/schemas/event/event.interfaces.js.map +0 -1
- package/dist/schemas/event/event.schema.d.ts +0 -70
- package/dist/schemas/event/event.schema.js +0 -242
- package/dist/schemas/event/event.schema.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -14
- package/dist/schemas/index.js +0 -31
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/order/order.interfaces.d.ts +0 -72
- package/dist/schemas/order/order.interfaces.js +0 -31
- package/dist/schemas/order/order.interfaces.js.map +0 -1
- package/dist/schemas/order/order.schema.d.ts +0 -39
- package/dist/schemas/order/order.schema.js +0 -162
- package/dist/schemas/order/order.schema.js.map +0 -1
- package/dist/schemas/promotions/promotions.interfaces.d.ts +0 -30
- package/dist/schemas/promotions/promotions.interfaces.js +0 -14
- package/dist/schemas/promotions/promotions.interfaces.js.map +0 -1
- package/dist/schemas/promotions/promotions.schema.d.ts +0 -25
- package/dist/schemas/promotions/promotions.schema.js +0 -92
- package/dist/schemas/promotions/promotions.schema.js.map +0 -1
- package/dist/schemas/rows/rows.interfaces.d.ts +0 -14
- package/dist/schemas/rows/rows.interfaces.js +0 -3
- package/dist/schemas/rows/rows.interfaces.js.map +0 -1
- package/dist/schemas/rows/rows.schema.d.ts +0 -22
- package/dist/schemas/rows/rows.schema.js +0 -65
- package/dist/schemas/rows/rows.schema.js.map +0 -1
- package/dist/schemas/schema.helper.d.ts +0 -4
- package/dist/schemas/schema.helper.js +0 -84
- package/dist/schemas/schema.helper.js.map +0 -1
- package/dist/schemas/ticket-classes/ticket-classes.interfaces.d.ts +0 -18
- package/dist/schemas/ticket-classes/ticket-classes.interfaces.js +0 -3
- package/dist/schemas/ticket-classes/ticket-classes.interfaces.js.map +0 -1
- package/dist/schemas/ticket-classes/ticket-classes.schemas.d.ts +0 -26
- package/dist/schemas/ticket-classes/ticket-classes.schemas.js +0 -75
- package/dist/schemas/ticket-classes/ticket-classes.schemas.js.map +0 -1
- package/dist/schemas/ticket-summary/ticket-summary.interfaces.d.ts +0 -19
- package/dist/schemas/ticket-summary/ticket-summary.interfaces.js +0 -9
- package/dist/schemas/ticket-summary/ticket-summary.interfaces.js.map +0 -1
- package/dist/schemas/ticket-summary/ticket-summary.schema.d.ts +0 -23
- package/dist/schemas/ticket-summary/ticket-summary.schema.js +0 -65
- package/dist/schemas/ticket-summary/ticket-summary.schema.js.map +0 -1
- package/dist/schemas/user-fanpass/user-fanpass.interfaces.d.ts +0 -26
- package/dist/schemas/user-fanpass/user-fanpass.interfaces.js +0 -9
- package/dist/schemas/user-fanpass/user-fanpass.interfaces.js.map +0 -1
- package/dist/schemas/user-fanpass/user-fanpass.schemas.d.ts +0 -29
- package/dist/schemas/user-fanpass/user-fanpass.schemas.js +0 -113
- package/dist/schemas/user-fanpass/user-fanpass.schemas.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/cluster/config/cluster.config.ts +0 -6
- package/src/cluster/index.ts +0 -2
- package/src/cluster/modules/cluster.module.ts +0 -9
- package/src/cluster/services/cluster.service.ts +0 -76
- package/src/database/index.ts +0 -2
- package/src/database/mongodb/index.ts +0 -2
- package/src/database/mongodb/mongodb.module.ts +0 -42
- package/src/database/mongodb/mongodb.service.ts +0 -111
- package/src/database/redis/index.ts +0 -2
- package/src/database/redis/redis.module.ts +0 -45
- package/src/database/redis/redis.service.ts +0 -142
- package/src/exception/exception.filter.ts +0 -36
- package/src/generic-repository/index.ts +0 -7
- package/src/generic-repository/repositories/base.repository.interface.ts +0 -78
- package/src/generic-repository/repositories/base.repository.ts +0 -199
- package/src/generic-repository/services/base.service.interface.ts +0 -78
- package/src/generic-repository/services/base.service.ts +0 -165
- package/src/index.ts +0 -11
- package/src/logger/custom.logger.ts +0 -83
- package/src/logger/index.ts +0 -2
- package/src/logger/logger.module.ts +0 -14
- package/src/pipes/custom-validation.pipe.ts +0 -61
- package/src/response/response.interceptor.ts +0 -26
- package/src/schemas/base.schema.ts +0 -19
- package/src/schemas/event/event.interfaces.ts +0 -74
- package/src/schemas/event/event.schema.ts +0 -195
- package/src/schemas/index.ts +0 -16
- package/src/schemas/order/order.interfaces.ts +0 -78
- package/src/schemas/order/order.schema.ts +0 -120
- package/src/schemas/promotions/promotions.interfaces.ts +0 -34
- package/src/schemas/promotions/promotions.schema.ts +0 -71
- package/src/schemas/rows/rows.interfaces.ts +0 -14
- package/src/schemas/rows/rows.schema.ts +0 -47
- package/src/schemas/schema.helper.ts +0 -103
- package/src/schemas/ticket-classes/ticket-classes.interfaces.ts +0 -18
- package/src/schemas/ticket-classes/ticket-classes.schemas.ts +0 -51
- package/src/schemas/ticket-summary/ticket-summary.interfaces.ts +0 -20
- package/src/schemas/ticket-summary/ticket-summary.schema.ts +0 -46
- package/src/schemas/user-fanpass/user-fanpass.interfaces.ts +0 -28
- package/src/schemas/user-fanpass/user-fanpass.schemas.ts +0 -86
- package/tsconfig.json +0 -17
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export enum IStatusEvent {
|
|
3
|
-
OPEN = 'OPEN',
|
|
4
|
-
CLOSE = 'CLOSE',
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface IPaymentInfoField {
|
|
8
|
-
key: string;
|
|
9
|
-
text: string;
|
|
10
|
-
type?: string;
|
|
11
|
-
isDefault?: boolean;
|
|
12
|
-
isRequired?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IGeneral {
|
|
16
|
-
collaboration?: 'eventista' | 'agency' | 'seatmap' | 'seatmap_zone';
|
|
17
|
-
ticketType?: 'e_ticket' | 'hard_ticket';
|
|
18
|
-
paymentInfoFields?: IPaymentInfoField[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface IVisitor {
|
|
22
|
-
name?: string;
|
|
23
|
-
picture?: string;
|
|
24
|
-
id?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type Category = 'concert' | 'live_show' | 'workshop' | 'fan_meeting';
|
|
28
|
-
|
|
29
|
-
export interface IEventCalendar {
|
|
30
|
-
calendarId: string;
|
|
31
|
-
startDate: Date;
|
|
32
|
-
endDate: Date;
|
|
33
|
-
maxTicketPerUser?: number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ITicketCalendar {
|
|
37
|
-
thumbnail?: string;
|
|
38
|
-
description?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface IEvent {
|
|
42
|
-
_id?: string;
|
|
43
|
-
eventName: string;
|
|
44
|
-
location: string;
|
|
45
|
-
address: string;
|
|
46
|
-
pathName: string;
|
|
47
|
-
thumbnail?: string;
|
|
48
|
-
logo?: string;
|
|
49
|
-
venueMap?: string;
|
|
50
|
-
status?: IStatusEvent;
|
|
51
|
-
eventCalendar: IEventCalendar[];
|
|
52
|
-
ticketCalendar?: ITicketCalendar;
|
|
53
|
-
hostedBy?: string;
|
|
54
|
-
tickets: Record<string, any>[];
|
|
55
|
-
eventDescriptions?: { title: string; description: string }[];
|
|
56
|
-
maxTicketPerUser: number;
|
|
57
|
-
note: string;
|
|
58
|
-
general?: IGeneral;
|
|
59
|
-
domain: string;
|
|
60
|
-
categories?: Category[];
|
|
61
|
-
featuredFlg?: boolean;
|
|
62
|
-
hideInMarketPlace?: boolean;
|
|
63
|
-
tenantId?: string;
|
|
64
|
-
visitors?: IVisitor[];
|
|
65
|
-
background?: string;
|
|
66
|
-
headingBackground?: string;
|
|
67
|
-
fanpassId?: string;
|
|
68
|
-
discountForFanpassUser?: boolean;
|
|
69
|
-
type?: string;
|
|
70
|
-
authRequired?: boolean;
|
|
71
|
-
createdAt?: Date;
|
|
72
|
-
updatedAt?: Date;
|
|
73
|
-
isDeleted?: boolean;
|
|
74
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { HydratedDocument } from 'mongoose';
|
|
3
|
-
import { BaseDocument, BaseSchema, addSoftDeleteHooks, addUpdateHooks, defaultSchemaOptions } from '../index';
|
|
4
|
-
import { IStatusEvent } from './event.interfaces';
|
|
5
|
-
|
|
6
|
-
export type EventDocument = HydratedDocument<Event> & BaseDocument;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@Schema({ _id: false })
|
|
10
|
-
export class SchemaPaymentInfoField {
|
|
11
|
-
@Prop({ required: true })
|
|
12
|
-
key: string;
|
|
13
|
-
|
|
14
|
-
@Prop({ required: true })
|
|
15
|
-
text: string;
|
|
16
|
-
|
|
17
|
-
@Prop({ default: 'text' })
|
|
18
|
-
type: string;
|
|
19
|
-
|
|
20
|
-
@Prop({ default: false })
|
|
21
|
-
isDefault: boolean;
|
|
22
|
-
|
|
23
|
-
@Prop({ default: false })
|
|
24
|
-
isRequired: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@Schema({ _id: false })
|
|
28
|
-
export class SchemaGeneral {
|
|
29
|
-
@Prop({ enum: ['eventista', 'agency', 'seatmap', 'seatmap_zone'], default: 'eventista' })
|
|
30
|
-
collaboration: string;
|
|
31
|
-
|
|
32
|
-
@Prop({ enum: ['e_ticket', 'hard_ticket'], default: 'hard_ticket' })
|
|
33
|
-
ticketType: string;
|
|
34
|
-
|
|
35
|
-
@Prop({ type: [SchemaPaymentInfoField], default: [] })
|
|
36
|
-
paymentInfoFields: SchemaPaymentInfoField[];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Schema({ _id: false }) // Nếu bạn không cần _id riêng cho mỗi visitor
|
|
40
|
-
export class SchemaVisitor {
|
|
41
|
-
@Prop() name: string;
|
|
42
|
-
@Prop() picture: string;
|
|
43
|
-
@Prop() id: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@Schema({
|
|
48
|
-
collection: 'events',
|
|
49
|
-
...defaultSchemaOptions,
|
|
50
|
-
})
|
|
51
|
-
export class Event extends BaseSchema {
|
|
52
|
-
@Prop({ required: true })
|
|
53
|
-
eventName: string;
|
|
54
|
-
|
|
55
|
-
@Prop({ required: true })
|
|
56
|
-
location: String;
|
|
57
|
-
|
|
58
|
-
@Prop({ required: true })
|
|
59
|
-
address: string;
|
|
60
|
-
|
|
61
|
-
@Prop({ required: true })
|
|
62
|
-
pathName: string;
|
|
63
|
-
|
|
64
|
-
@Prop({ required: false })
|
|
65
|
-
thumbnail: string;
|
|
66
|
-
|
|
67
|
-
@Prop({ required: false })
|
|
68
|
-
logo: string;
|
|
69
|
-
|
|
70
|
-
@Prop({ required: false })
|
|
71
|
-
venueMap: string;
|
|
72
|
-
|
|
73
|
-
@Prop({ enum: Object.values(IStatusEvent), default: "OPEN" })
|
|
74
|
-
status: string;
|
|
75
|
-
|
|
76
|
-
@Prop({
|
|
77
|
-
type: [
|
|
78
|
-
{
|
|
79
|
-
calendarId: { type: String, required: true },
|
|
80
|
-
startDate: { type: Date, required: true },
|
|
81
|
-
endDate: { type: Date, required: true },
|
|
82
|
-
maxTicketPerUser: { type: Number, default: -1 },
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
required: true,
|
|
86
|
-
default: [],
|
|
87
|
-
})
|
|
88
|
-
eventCalendar: {
|
|
89
|
-
calendarId: String;
|
|
90
|
-
startDate: Date;
|
|
91
|
-
endDate: Date;
|
|
92
|
-
maxTicketPerUser: number;
|
|
93
|
-
}[];
|
|
94
|
-
|
|
95
|
-
@Prop({
|
|
96
|
-
type: {
|
|
97
|
-
thumbnail: { type: String, required: false },
|
|
98
|
-
description: { type: String, required: false },
|
|
99
|
-
},
|
|
100
|
-
required: false,
|
|
101
|
-
default: {},
|
|
102
|
-
})
|
|
103
|
-
ticketCalendar: {
|
|
104
|
-
thumbnail: String;
|
|
105
|
-
description: String;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
@Prop({})
|
|
109
|
-
hostedBy: String
|
|
110
|
-
|
|
111
|
-
// check lại nếu bị lỗi khi tạo event
|
|
112
|
-
@Prop({ type: [Object], required: true, default: [] }) // Mảng các object không xác định cấu trúc
|
|
113
|
-
tickets: Record<string, any>[];
|
|
114
|
-
|
|
115
|
-
@Prop({
|
|
116
|
-
type: [
|
|
117
|
-
{
|
|
118
|
-
title: { type: String },
|
|
119
|
-
description: { type: String },
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
required: false,
|
|
123
|
-
default: []
|
|
124
|
-
})
|
|
125
|
-
eventDescriptions: { title: string; description: string }[];
|
|
126
|
-
|
|
127
|
-
@Prop({
|
|
128
|
-
type: Number,
|
|
129
|
-
required: true,
|
|
130
|
-
default: 0,
|
|
131
|
-
})
|
|
132
|
-
maxTicketPerUser: number;
|
|
133
|
-
|
|
134
|
-
@Prop({ type: String, required: true })
|
|
135
|
-
note: string;
|
|
136
|
-
|
|
137
|
-
@Prop({ type: SchemaGeneral, default: {} })
|
|
138
|
-
general: SchemaGeneral;
|
|
139
|
-
|
|
140
|
-
@Prop({ type: String, required: true })
|
|
141
|
-
domain: string;
|
|
142
|
-
|
|
143
|
-
@Prop({
|
|
144
|
-
type: [String],
|
|
145
|
-
enum: ['concert', 'live_show', 'workshop', 'fan_meeting'],
|
|
146
|
-
default: [],
|
|
147
|
-
})
|
|
148
|
-
categories: ('concert' | 'live_show' | 'workshop' | 'fan_meeting')[];
|
|
149
|
-
|
|
150
|
-
@Prop({ type: Boolean, default: false })
|
|
151
|
-
featuredFlg: boolean;
|
|
152
|
-
|
|
153
|
-
@Prop({ type: Boolean, default: false })
|
|
154
|
-
hideInMarketPlace: boolean;
|
|
155
|
-
|
|
156
|
-
@Prop({ type: String, required: false })
|
|
157
|
-
tenantId: string;
|
|
158
|
-
|
|
159
|
-
@Prop({ type: [SchemaVisitor], default: [] })
|
|
160
|
-
visitors: SchemaVisitor[];
|
|
161
|
-
|
|
162
|
-
@Prop({ type: String, required: false })
|
|
163
|
-
background: string;
|
|
164
|
-
|
|
165
|
-
@Prop({ type: String, required: false })
|
|
166
|
-
headingBackground: string;
|
|
167
|
-
|
|
168
|
-
@Prop({ type: String, required: false })
|
|
169
|
-
fanpassId: string;
|
|
170
|
-
|
|
171
|
-
@Prop({ type: Boolean, default: false })
|
|
172
|
-
discountForFanpassUser: boolean;
|
|
173
|
-
|
|
174
|
-
@Prop({ type: String, required: false })
|
|
175
|
-
type: string;
|
|
176
|
-
|
|
177
|
-
@Prop({ type: Boolean, default: false })
|
|
178
|
-
authRequired: boolean;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
export const EventSchema = SchemaFactory.createForClass(Event);
|
|
184
|
-
|
|
185
|
-
// Thêm các hooks và middleware
|
|
186
|
-
addSoftDeleteHooks(EventSchema);
|
|
187
|
-
addUpdateHooks(EventSchema);
|
|
188
|
-
|
|
189
|
-
//Thêm các index
|
|
190
|
-
EventSchema.index({ isDeleted: 1 });
|
|
191
|
-
EventSchema.index({ eventName: 1 });
|
|
192
|
-
EventSchema.index({ pathName: 1 });
|
|
193
|
-
EventSchema.index({ status: 1 });
|
|
194
|
-
EventSchema.index({ tenantId: 1 });
|
|
195
|
-
|
package/src/schemas/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from './base.schema';
|
|
2
|
-
export * from './schema.helper';
|
|
3
|
-
export * from './ticket-summary/ticket-summary.interfaces';
|
|
4
|
-
export * from './ticket-summary/ticket-summary.schema';
|
|
5
|
-
export * from './ticket-classes/ticket-classes.interfaces';
|
|
6
|
-
export * from './ticket-classes/ticket-classes.schemas';
|
|
7
|
-
export * from './rows/rows.interfaces';
|
|
8
|
-
export * from './rows/rows.schema';
|
|
9
|
-
export * from './order/order.interfaces';
|
|
10
|
-
export * from './order/order.schema';
|
|
11
|
-
export * from './event/event.interfaces';
|
|
12
|
-
export * from './event/event.schema';
|
|
13
|
-
export * from './user-fanpass/user-fanpass.interfaces';
|
|
14
|
-
export * from './user-fanpass/user-fanpass.schemas';
|
|
15
|
-
|
|
16
|
-
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export enum IPaymentGatewayTypes {
|
|
3
|
-
FREE = 'free',
|
|
4
|
-
MOMO = 'momo',
|
|
5
|
-
ZALOPAY = 'zalopay',
|
|
6
|
-
ZALOPAY_VIETQR = 'zalopay_vietqr',
|
|
7
|
-
ZALOPAY_CC = 'zalopay_cc',
|
|
8
|
-
VNPAY = 'vnpay',
|
|
9
|
-
INTCARD = 'intcard',
|
|
10
|
-
PAYPAL = 'paypal',
|
|
11
|
-
PAYMENTWALL = 'paymentwall',
|
|
12
|
-
COD = 'cod',
|
|
13
|
-
MANUALLY = 'manually',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export enum IOrderStatus {
|
|
17
|
-
PENDING = 'PENDING',
|
|
18
|
-
REVIEW = 'REVIEW',
|
|
19
|
-
OPEN = 'OPEN',
|
|
20
|
-
SUCCESS = 'SUCCESS',
|
|
21
|
-
FAILED = 'FAILED',
|
|
22
|
-
CANCELED = 'CANCELED',
|
|
23
|
-
EXPIRED = 'EXPIRED',
|
|
24
|
-
CONFIRM = 'CONFIRM',
|
|
25
|
-
USERCANCEL = 'USERCANCEL',
|
|
26
|
-
PAYMENT = 'PAYMENT',
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type ProductType = 'event' | 'fanpass' | 'merchandise';
|
|
30
|
-
export type DeliveryStatus = 'pending' | 'delivered' | 'canceled';
|
|
31
|
-
export type CurrencyCode = 'VND' | 'USD';
|
|
32
|
-
|
|
33
|
-
export interface IOrderProduct {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
price: number;
|
|
37
|
-
thumbnail: string;
|
|
38
|
-
promotion: Record<string, any>;
|
|
39
|
-
quantity: number;
|
|
40
|
-
totalAmount: number;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface IPromotionUsed {
|
|
44
|
-
code: string;
|
|
45
|
-
discountPercent: number;
|
|
46
|
-
maxValue: number;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface IOrder {
|
|
50
|
-
_id?: string;
|
|
51
|
-
eventId: string;
|
|
52
|
-
status: IOrderStatus;
|
|
53
|
-
userId: string;
|
|
54
|
-
productType: ProductType;
|
|
55
|
-
paymentGateway?: IPaymentGatewayTypes;
|
|
56
|
-
tickets: Record<string, any>[];
|
|
57
|
-
paymentTime?: Date;
|
|
58
|
-
deliveryStatus?: DeliveryStatus;
|
|
59
|
-
products: IOrderProduct[];
|
|
60
|
-
promotionUsed?: IPromotionUsed;
|
|
61
|
-
currencyCode?: CurrencyCode;
|
|
62
|
-
originalAmount?: number;
|
|
63
|
-
originalAmountUSD?: number;
|
|
64
|
-
amount?: number;
|
|
65
|
-
amountInUSD?: number;
|
|
66
|
-
userRefId?: string;
|
|
67
|
-
confirmAt?: Date;
|
|
68
|
-
sellFromPlatform?: string;
|
|
69
|
-
cancelReason?: string;
|
|
70
|
-
quantity: number;
|
|
71
|
-
calendarId: string;
|
|
72
|
-
zoneId?: string;
|
|
73
|
-
ticketClassId: string;
|
|
74
|
-
timeCreatePayment?: number;
|
|
75
|
-
createdAt?: Date;
|
|
76
|
-
updatedAt?: Date;
|
|
77
|
-
isDeleted?: boolean;
|
|
78
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { HydratedDocument } from 'mongoose';
|
|
3
|
-
import { BaseDocument, BaseSchema, addSoftDeleteHooks, addUpdateHooks, defaultSchemaOptions } from '../index';
|
|
4
|
-
import { IOrderStatus, IPaymentGatewayTypes, ProductType, DeliveryStatus, CurrencyCode, IPromotionUsed, IOrderProduct } from './order.interfaces';
|
|
5
|
-
|
|
6
|
-
export type OrderDocument = HydratedDocument<Order> & BaseDocument;
|
|
7
|
-
|
|
8
|
-
@Schema({
|
|
9
|
-
collection: 'orders',
|
|
10
|
-
...defaultSchemaOptions,
|
|
11
|
-
})
|
|
12
|
-
export class Order extends BaseSchema {
|
|
13
|
-
@Prop({
|
|
14
|
-
required: true,
|
|
15
|
-
index: true,
|
|
16
|
-
})
|
|
17
|
-
eventId: string;
|
|
18
|
-
|
|
19
|
-
@Prop({
|
|
20
|
-
required: true,
|
|
21
|
-
enum: Object.values(IOrderStatus),
|
|
22
|
-
default: IOrderStatus.PENDING,
|
|
23
|
-
index: true,
|
|
24
|
-
})
|
|
25
|
-
status: IOrderStatus;
|
|
26
|
-
|
|
27
|
-
@Prop({ required: true, index: true })
|
|
28
|
-
userId: string;
|
|
29
|
-
|
|
30
|
-
@Prop({
|
|
31
|
-
required: true,
|
|
32
|
-
enum: ['event', 'fanpass', 'merchandise'],
|
|
33
|
-
index: true,
|
|
34
|
-
})
|
|
35
|
-
productType: ProductType;
|
|
36
|
-
|
|
37
|
-
@Prop({
|
|
38
|
-
enum: Object.values(IPaymentGatewayTypes),
|
|
39
|
-
index: true,
|
|
40
|
-
})
|
|
41
|
-
paymentGateway: IPaymentGatewayTypes;
|
|
42
|
-
|
|
43
|
-
@Prop({ type: [Object], required: true, default: [] })
|
|
44
|
-
tickets: Record<string, any>[];
|
|
45
|
-
|
|
46
|
-
@Prop()
|
|
47
|
-
paymentTime: Date;
|
|
48
|
-
|
|
49
|
-
@Prop({
|
|
50
|
-
enum: ['pending', 'delivered', 'canceled'],
|
|
51
|
-
default: 'pending',
|
|
52
|
-
})
|
|
53
|
-
deliveryStatus: DeliveryStatus;
|
|
54
|
-
|
|
55
|
-
@Prop([
|
|
56
|
-
{
|
|
57
|
-
id: String,
|
|
58
|
-
name: String,
|
|
59
|
-
price: Number,
|
|
60
|
-
thumbnail: String,
|
|
61
|
-
promotion: Object,
|
|
62
|
-
quantity: Number,
|
|
63
|
-
totalAmount: Number,
|
|
64
|
-
},
|
|
65
|
-
])
|
|
66
|
-
products: IOrderProduct[];
|
|
67
|
-
|
|
68
|
-
@Prop({
|
|
69
|
-
type: {
|
|
70
|
-
code: String,
|
|
71
|
-
discountPercent: Number,
|
|
72
|
-
maxValue: Number,
|
|
73
|
-
},
|
|
74
|
-
default: {}
|
|
75
|
-
})
|
|
76
|
-
promotionUsed: IPromotionUsed;
|
|
77
|
-
|
|
78
|
-
@Prop({ enum: ['VND', 'USD'] })
|
|
79
|
-
currencyCode: CurrencyCode;
|
|
80
|
-
|
|
81
|
-
@Prop() originalAmount: number;
|
|
82
|
-
@Prop() originalAmountUSD: number;
|
|
83
|
-
@Prop() amount: number;
|
|
84
|
-
@Prop() amountInUSD: number;
|
|
85
|
-
|
|
86
|
-
@Prop() userRefId: string;
|
|
87
|
-
|
|
88
|
-
@Prop() confirmAt: Date;
|
|
89
|
-
|
|
90
|
-
@Prop({ default: 'web' })
|
|
91
|
-
sellFromPlatform: string;
|
|
92
|
-
|
|
93
|
-
@Prop({ default: '' })
|
|
94
|
-
cancelReason: string;
|
|
95
|
-
|
|
96
|
-
@Prop({ required: true })
|
|
97
|
-
quantity: number;
|
|
98
|
-
|
|
99
|
-
@Prop({ required: true })
|
|
100
|
-
calendarId: string;
|
|
101
|
-
|
|
102
|
-
@Prop() zoneId: string;
|
|
103
|
-
|
|
104
|
-
@Prop({ required: true, index: true })
|
|
105
|
-
ticketClassId: string;
|
|
106
|
-
|
|
107
|
-
@Prop()
|
|
108
|
-
timeCreatePayment: number;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export const OrderSchema = SchemaFactory.createForClass(Order);
|
|
112
|
-
|
|
113
|
-
// Thêm các hooks và middleware
|
|
114
|
-
addSoftDeleteHooks(OrderSchema);
|
|
115
|
-
addUpdateHooks(OrderSchema);
|
|
116
|
-
|
|
117
|
-
// Thêm các index nếu cần
|
|
118
|
-
OrderSchema.index({ isDeleted: 1 });
|
|
119
|
-
OrderSchema.index({ userId: 1, status: 1 });
|
|
120
|
-
OrderSchema.index({ eventId: 1, status: 1 });
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export enum IPromotionAppliesTo {
|
|
3
|
-
EVENT = 'event',
|
|
4
|
-
TICKET = 'ticket'
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface IPromotionDiscount {
|
|
8
|
-
percent: number;
|
|
9
|
-
percentInUSD: number;
|
|
10
|
-
maxValue: number;
|
|
11
|
-
maxValueInUSD: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export enum IPromotionType {
|
|
15
|
-
AUTO = 'auto',
|
|
16
|
-
MANUALLY = 'manually'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IPromotion {
|
|
20
|
-
_id?: string;
|
|
21
|
-
eventId: string;
|
|
22
|
-
code: string;
|
|
23
|
-
appliesTo: IPromotionAppliesTo;
|
|
24
|
-
active: boolean;
|
|
25
|
-
maxUsage: number;
|
|
26
|
-
discount: IPromotionDiscount;
|
|
27
|
-
tickets: Record<string, any>[];
|
|
28
|
-
type: IPromotionType;
|
|
29
|
-
minOrderAmount: number;
|
|
30
|
-
minOrderAmountInUSD: number;
|
|
31
|
-
createdAt?: Date;
|
|
32
|
-
updatedAt?: Date;
|
|
33
|
-
isDeleted?: boolean;
|
|
34
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { HydratedDocument } from 'mongoose';
|
|
3
|
-
import { BaseDocument, BaseSchema, addSoftDeleteHooks, addUpdateHooks, defaultSchemaOptions } from '../index';
|
|
4
|
-
import { IPromotionAppliesTo, IPromotionDiscount, IPromotionType } from './promotions.interfaces';
|
|
5
|
-
|
|
6
|
-
export type PromotionDocument = HydratedDocument<Promotion> & BaseDocument;
|
|
7
|
-
@Schema({
|
|
8
|
-
collection: 'orders',
|
|
9
|
-
...defaultSchemaOptions,
|
|
10
|
-
})
|
|
11
|
-
export class Promotion extends BaseSchema {
|
|
12
|
-
|
|
13
|
-
@Prop({
|
|
14
|
-
required: true,
|
|
15
|
-
index: true,
|
|
16
|
-
})
|
|
17
|
-
eventId: string;
|
|
18
|
-
|
|
19
|
-
@Prop()
|
|
20
|
-
code: string;
|
|
21
|
-
|
|
22
|
-
@Prop({
|
|
23
|
-
enum: Object.values(IPromotionAppliesTo),
|
|
24
|
-
index: true,
|
|
25
|
-
default: IPromotionAppliesTo.EVENT,
|
|
26
|
-
})
|
|
27
|
-
appliesTo: IPromotionAppliesTo;
|
|
28
|
-
|
|
29
|
-
@Prop({
|
|
30
|
-
default: true,
|
|
31
|
-
type: Boolean,
|
|
32
|
-
})
|
|
33
|
-
active: boolean;
|
|
34
|
-
|
|
35
|
-
@Prop({
|
|
36
|
-
type: Number,
|
|
37
|
-
default: 0,
|
|
38
|
-
})
|
|
39
|
-
maxUsage: number;
|
|
40
|
-
|
|
41
|
-
@Prop({
|
|
42
|
-
type: {
|
|
43
|
-
percent: { type: Number },
|
|
44
|
-
percentInUSD: { type: Number },
|
|
45
|
-
maxValue: { type: Number },
|
|
46
|
-
maxValueInUSD: { type: Number },
|
|
47
|
-
},
|
|
48
|
-
default: {},
|
|
49
|
-
})
|
|
50
|
-
discount: IPromotionDiscount;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@Prop({ type: [Object], required: true, default: [] })
|
|
54
|
-
tickets: Record<string, any>[];
|
|
55
|
-
|
|
56
|
-
@Prop({
|
|
57
|
-
enum: Object.values(IPromotionType),
|
|
58
|
-
})
|
|
59
|
-
type: IPromotionType;
|
|
60
|
-
|
|
61
|
-
@Prop()
|
|
62
|
-
minOrderAmount: number;
|
|
63
|
-
|
|
64
|
-
@Prop()
|
|
65
|
-
minOrderAmountInUSD: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const PromotionSchema = SchemaFactory.createForClass(Promotion);
|
|
69
|
-
addUpdateHooks(PromotionSchema);
|
|
70
|
-
addSoftDeleteHooks(PromotionSchema);
|
|
71
|
-
PromotionSchema.index({ eventId: 1, code: 1 }, { unique: true });
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
-
import { HydratedDocument } from 'mongoose';
|
|
3
|
-
import { BaseDocument, BaseSchema, addSoftDeleteHooks, addUpdateHooks, defaultSchemaOptions } from '../index';
|
|
4
|
-
|
|
5
|
-
export type RowDocument = HydratedDocument<Row> & BaseDocument;
|
|
6
|
-
|
|
7
|
-
@Schema({
|
|
8
|
-
collection: 'rows',
|
|
9
|
-
...defaultSchemaOptions,
|
|
10
|
-
})
|
|
11
|
-
export class Row extends BaseSchema {
|
|
12
|
-
@Prop({})
|
|
13
|
-
calendarId: string;
|
|
14
|
-
|
|
15
|
-
@Prop({
|
|
16
|
-
required: true,
|
|
17
|
-
index: true,
|
|
18
|
-
})
|
|
19
|
-
eventId: string;
|
|
20
|
-
|
|
21
|
-
@Prop({
|
|
22
|
-
required: true,
|
|
23
|
-
index: true,
|
|
24
|
-
})
|
|
25
|
-
zoneId: string;
|
|
26
|
-
|
|
27
|
-
@Prop({})
|
|
28
|
-
seatNumberingType: string;
|
|
29
|
-
|
|
30
|
-
@Prop({})
|
|
31
|
-
seatNumberingFrom: string;
|
|
32
|
-
|
|
33
|
-
@Prop({})
|
|
34
|
-
seatNumberingTo: string;
|
|
35
|
-
|
|
36
|
-
@Prop({})
|
|
37
|
-
name: string;
|
|
38
|
-
|
|
39
|
-
@Prop({})
|
|
40
|
-
position: number
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const RowSchema = SchemaFactory.createForClass(Row);
|
|
44
|
-
|
|
45
|
-
// Thêm các hooks và middleware
|
|
46
|
-
addSoftDeleteHooks(RowSchema);
|
|
47
|
-
addUpdateHooks(RowSchema);
|