jp.db.schemas 2.2.11 → 2.2.13
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/index.d.ts +8 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -19
- package/dist/index.js.map +1 -1
- package/dist/models/experiences-level-edge.enum.d.ts +5 -0
- package/dist/models/experiences-level-edge.enum.d.ts.map +1 -0
- package/dist/models/experiences-level-edge.enum.js +9 -0
- package/dist/models/experiences-level-edge.enum.js.map +1 -0
- package/dist/models/experiences-level-rank.enum.d.ts +6 -0
- package/dist/models/experiences-level-rank.enum.d.ts.map +1 -0
- package/dist/models/experiences-level-rank.enum.js +10 -0
- package/dist/models/experiences-level-rank.enum.js.map +1 -0
- package/dist/models/rating-add-bulk-item.interface.d.ts +1 -1
- package/dist/models/rating-add-bulk-item.interface.d.ts.map +1 -1
- package/dist/models/rating-monthly-result.interface.d.ts +2 -1
- package/dist/models/rating-monthly-result.interface.d.ts.map +1 -1
- package/dist/repositories/achievement.repository.d.ts +1 -1
- package/dist/repositories/achievement.repository.d.ts.map +1 -1
- package/dist/repositories/achievement.repository.js +7 -2
- package/dist/repositories/achievement.repository.js.map +1 -1
- package/dist/repositories/activity-log.repository.d.ts +6 -6
- package/dist/repositories/activity-log.repository.d.ts.map +1 -1
- package/dist/repositories/activity-log.repository.js +13 -13
- package/dist/repositories/activity-log.repository.js.map +1 -1
- package/dist/repositories/banners.repository.d.ts +1 -1
- package/dist/repositories/banners.repository.d.ts.map +1 -1
- package/dist/repositories/banners.repository.js +9 -2
- package/dist/repositories/banners.repository.js.map +1 -1
- package/dist/repositories/daily-bonus.repository.d.ts +1 -1
- package/dist/repositories/daily-bonus.repository.d.ts.map +1 -1
- package/dist/repositories/daily-bonus.repository.js +3 -2
- package/dist/repositories/daily-bonus.repository.js.map +1 -1
- package/dist/repositories/friend.repository.d.ts +1 -1
- package/dist/repositories/friend.repository.d.ts.map +1 -1
- package/dist/repositories/friend.repository.js +2 -7
- package/dist/repositories/friend.repository.js.map +1 -1
- package/dist/repositories/game-statistic.repository.d.ts +1 -1
- package/dist/repositories/game-statistic.repository.d.ts.map +1 -1
- package/dist/repositories/game-statistic.repository.js +2 -2
- package/dist/repositories/game-statistic.repository.js.map +1 -1
- package/dist/repositories/index.d.ts +3 -5
- package/dist/repositories/index.d.ts.map +1 -1
- package/dist/repositories/index.js +5 -9
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/many-tables-tournament-rooms.repository.d.ts +21 -0
- package/dist/repositories/many-tables-tournament-rooms.repository.d.ts.map +1 -0
- package/dist/repositories/{tournament-many-tables-rooms.repository.js → many-tables-tournament-rooms.repository.js} +8 -8
- package/dist/repositories/many-tables-tournament-rooms.repository.js.map +1 -0
- package/dist/repositories/menu.repository.d.ts +1 -1
- package/dist/repositories/menu.repository.d.ts.map +1 -1
- package/dist/repositories/menu.repository.js +3 -2
- package/dist/repositories/menu.repository.js.map +1 -1
- package/dist/repositories/one-table-tournament-rooms.repository.d.ts +18 -0
- package/dist/repositories/{tournament-one-table-rooms.repository.d.ts.map → one-table-tournament-rooms.repository.d.ts.map} +1 -1
- package/dist/repositories/{tournament-one-table-rooms.repository.js → one-table-tournament-rooms.repository.js} +8 -8
- package/dist/repositories/{tournament-one-table-rooms.repository.js.map → one-table-tournament-rooms.repository.js.map} +1 -1
- package/dist/repositories/premium.repository.d.ts +1 -1
- package/dist/repositories/premium.repository.d.ts.map +1 -1
- package/dist/repositories/premium.repository.js +8 -2
- package/dist/repositories/premium.repository.js.map +1 -1
- package/dist/repositories/products.repository.d.ts +1 -1
- package/dist/repositories/products.repository.d.ts.map +1 -1
- package/dist/repositories/products.repository.js +3 -2
- package/dist/repositories/products.repository.js.map +1 -1
- package/dist/repositories/rating.repository.d.ts +0 -1
- package/dist/repositories/rating.repository.d.ts.map +1 -1
- package/dist/repositories/rating.repository.js +3 -10
- package/dist/repositories/rating.repository.js.map +1 -1
- package/dist/repositories/rule.repository.d.ts +1 -1
- package/dist/repositories/rule.repository.d.ts.map +1 -1
- package/dist/repositories/rule.repository.js +8 -2
- package/dist/repositories/rule.repository.js.map +1 -1
- package/dist/repositories/setting.repository.d.ts +1 -1
- package/dist/repositories/setting.repository.d.ts.map +1 -1
- package/dist/repositories/setting.repository.js +3 -2
- package/dist/repositories/setting.repository.js.map +1 -1
- package/dist/repositories/welcome.repository.d.ts +1 -1
- package/dist/repositories/welcome.repository.d.ts.map +1 -1
- package/dist/repositories/welcome.repository.js +8 -2
- package/dist/repositories/welcome.repository.js.map +1 -1
- package/dist/schemas/achievement.schema.d.ts +4 -24
- package/dist/schemas/achievement.schema.d.ts.map +1 -1
- package/dist/schemas/achievement.schema.js +4 -12
- package/dist/schemas/achievement.schema.js.map +1 -1
- package/dist/schemas/activity_log.schema.d.ts +2 -2
- package/dist/schemas/activity_log.schema.d.ts.map +1 -1
- package/dist/schemas/activity_log.schema.js +1 -1
- package/dist/schemas/activity_log.schema.js.map +1 -1
- package/dist/schemas/banner.schema.d.ts +4 -14
- package/dist/schemas/banner.schema.d.ts.map +1 -1
- package/dist/schemas/banner.schema.js +4 -8
- package/dist/schemas/banner.schema.js.map +1 -1
- package/dist/schemas/daily_bonus.schema.d.ts +67 -19
- package/dist/schemas/daily_bonus.schema.d.ts.map +1 -1
- package/dist/schemas/daily_bonus.schema.js +0 -4
- package/dist/schemas/daily_bonus.schema.js.map +1 -1
- package/dist/schemas/feature.schema.d.ts +2 -2
- package/dist/schemas/feature.schema.d.ts.map +1 -1
- package/dist/schemas/feature.schema.js +1 -1
- package/dist/schemas/feature.schema.js.map +1 -1
- package/dist/schemas/friend.schema.d.ts +67 -19
- package/dist/schemas/friend.schema.d.ts.map +1 -1
- package/dist/schemas/friend.schema.js +0 -4
- package/dist/schemas/friend.schema.js.map +1 -1
- package/dist/schemas/game_statistic.schema.d.ts +2 -22
- package/dist/schemas/game_statistic.schema.d.ts.map +1 -1
- package/dist/schemas/game_statistic.schema.js +2 -10
- package/dist/schemas/game_statistic.schema.js.map +1 -1
- package/dist/schemas/{tournament_many_tables_rooms.schema.d.ts → many_tables_tournament_rooms.schema.d.ts} +52 -52
- package/dist/schemas/{tournament_many_tables_rooms.schema.d.ts.map → many_tables_tournament_rooms.schema.d.ts.map} +1 -1
- package/dist/schemas/{tournament_many_tables_rooms.schema.js → many_tables_tournament_rooms.schema.js} +29 -29
- package/dist/schemas/{tournament_many_tables_rooms.schema.js.map → many_tables_tournament_rooms.schema.js.map} +1 -1
- package/dist/schemas/notification.schema.d.ts +2 -2
- package/dist/schemas/notification.schema.d.ts.map +1 -1
- package/dist/schemas/notification.schema.js +1 -1
- package/dist/schemas/notification.schema.js.map +1 -1
- package/dist/schemas/{tournament_one_table_rooms.schema.d.ts → one_table_tournament_rooms.schema.d.ts} +50 -50
- package/dist/schemas/{tournament_one_table_rooms.schema.d.ts.map → one_table_tournament_rooms.schema.d.ts.map} +1 -1
- package/dist/schemas/{tournament_one_table_rooms.schema.js → one_table_tournament_rooms.schema.js} +28 -28
- package/dist/schemas/{tournament_one_table_rooms.schema.js.map → one_table_tournament_rooms.schema.js.map} +1 -1
- package/dist/schemas/premium.schema.d.ts +47 -15
- package/dist/schemas/premium.schema.d.ts.map +1 -1
- package/dist/schemas/premium.schema.js +0 -4
- package/dist/schemas/premium.schema.js.map +1 -1
- package/dist/schemas/product.schema.d.ts +2 -2
- package/dist/schemas/product.schema.d.ts.map +1 -1
- package/dist/schemas/product.schema.js +1 -1
- package/dist/schemas/product.schema.js.map +1 -1
- package/dist/schemas/rating.schema.d.ts +2 -2
- package/dist/schemas/rating.schema.d.ts.map +1 -1
- package/dist/schemas/rating.schema.js +1 -1
- package/dist/schemas/rating.schema.js.map +1 -1
- package/dist/schemas/rule.schema.d.ts +47 -15
- package/dist/schemas/rule.schema.d.ts.map +1 -1
- package/dist/schemas/rule.schema.js +0 -4
- package/dist/schemas/rule.schema.js.map +1 -1
- package/dist/schemas/setting.schema.js.map +1 -1
- package/dist/schemas/settings_option.schema.js.map +1 -1
- package/dist/schemas/user.schema.d.ts +20 -0
- package/dist/schemas/user.schema.d.ts.map +1 -1
- package/dist/schemas/user.schema.js +27 -0
- package/dist/schemas/user.schema.js.map +1 -1
- package/dist/schemas/welcome.schema.d.ts +53 -11
- package/dist/schemas/welcome.schema.d.ts.map +1 -1
- package/dist/schemas/welcome.schema.js +3 -3
- package/dist/schemas/welcome.schema.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -0
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +18 -35
- package/src/models/experiences-level-edge.enum.ts +4 -0
- package/src/models/experiences-level-rank.enum.ts +5 -0
- package/src/models/rating-add-bulk-item.interface.ts +1 -1
- package/src/models/rating-monthly-result.interface.ts +2 -1
- package/src/repositories/achievement.repository.ts +7 -2
- package/src/repositories/activity-log.repository.ts +13 -13
- package/src/repositories/banners.repository.ts +9 -2
- package/src/repositories/daily-bonus.repository.ts +4 -3
- package/src/repositories/friend.repository.ts +2 -10
- package/src/repositories/game-statistic.repository.ts +3 -6
- package/src/repositories/index.ts +4 -8
- package/src/repositories/{tournament-many-tables-rooms.repository.ts → many-tables-tournament-rooms.repository.ts} +13 -17
- package/src/repositories/menu.repository.ts +4 -3
- package/src/repositories/{tournament-one-table-rooms.repository.ts → one-table-tournament-rooms.repository.ts} +11 -11
- package/src/repositories/premium.repository.ts +8 -2
- package/src/repositories/products.repository.ts +4 -2
- package/src/repositories/rating.repository.ts +3 -14
- package/src/repositories/rule.repository.ts +8 -2
- package/src/repositories/setting.repository.ts +4 -3
- package/src/repositories/welcome.repository.ts +8 -2
- package/src/schemas/achievement.schema.ts +4 -10
- package/src/schemas/activity_log.schema.ts +1 -1
- package/src/schemas/banner.schema.ts +3 -6
- package/src/schemas/daily_bonus.schema.ts +0 -3
- package/src/schemas/feature.schema.ts +1 -1
- package/src/schemas/friend.schema.ts +0 -3
- package/src/schemas/game_statistic.schema.ts +2 -8
- package/src/schemas/{tournament_many_tables_rooms.schema.ts → many_tables_tournament_rooms.schema.ts} +5 -5
- package/src/schemas/notification.schema.ts +1 -1
- package/src/schemas/{tournament_one_table_rooms.schema.ts → one_table_tournament_rooms.schema.ts} +5 -5
- package/src/schemas/premium.schema.ts +1 -4
- package/src/schemas/product.schema.ts +7 -7
- package/src/schemas/rating.schema.ts +1 -1
- package/src/schemas/rule.schema.ts +2 -5
- package/src/schemas/setting.schema.ts +2 -2
- package/src/schemas/settings_option.schema.ts +1 -1
- package/src/schemas/user.schema.ts +27 -0
- package/src/schemas/welcome.schema.ts +4 -4
- package/src/utils.ts +4 -0
- package/dist/repositories/rooms.repository.d.ts +0 -8
- package/dist/repositories/rooms.repository.d.ts.map +0 -1
- package/dist/repositories/rooms.repository.js +0 -34
- package/dist/repositories/rooms.repository.js.map +0 -1
- package/dist/repositories/scheduled-tournaments.repository.d.ts +0 -11
- package/dist/repositories/scheduled-tournaments.repository.d.ts.map +0 -1
- package/dist/repositories/scheduled-tournaments.repository.js +0 -44
- package/dist/repositories/scheduled-tournaments.repository.js.map +0 -1
- package/dist/repositories/tournament-many-tables-rooms.repository.d.ts +0 -21
- package/dist/repositories/tournament-many-tables-rooms.repository.d.ts.map +0 -1
- package/dist/repositories/tournament-many-tables-rooms.repository.js.map +0 -1
- package/dist/repositories/tournament-one-table-rooms.repository.d.ts +0 -18
- package/dist/schemas/rooms.schema.d.ts +0 -179
- package/dist/schemas/rooms.schema.d.ts.map +0 -1
- package/dist/schemas/rooms.schema.js +0 -85
- package/dist/schemas/rooms.schema.js.map +0 -1
- package/dist/schemas/scheduled_tournament.schema.d.ts +0 -257
- package/dist/schemas/scheduled_tournament.schema.d.ts.map +0 -1
- package/dist/schemas/scheduled_tournament.schema.js +0 -113
- package/dist/schemas/scheduled_tournament.schema.js.map +0 -1
- package/src/repositories/rooms.repository.ts +0 -14
- package/src/repositories/scheduled-tournaments.repository.ts +0 -35
- package/src/schemas/rooms.schema.ts +0 -63
- package/src/schemas/scheduled_tournament.schema.ts +0 -94
|
@@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Achievement, AchievementDocument } from '..';
|
|
6
|
+
import { getGameRegExpFilter } from '../utils';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class AchievementRepository {
|
|
@@ -11,7 +12,11 @@ export class AchievementRepository {
|
|
|
11
12
|
private menuModel: Model<AchievementDocument>,
|
|
12
13
|
) {}
|
|
13
14
|
|
|
14
|
-
async findAchievements(): Promise<Array<Achievement>> {
|
|
15
|
-
return this.menuModel
|
|
15
|
+
async findAchievements(game: string): Promise<Array<Achievement>> {
|
|
16
|
+
return this.menuModel
|
|
17
|
+
.find({
|
|
18
|
+
game: getGameRegExpFilter(game),
|
|
19
|
+
})
|
|
20
|
+
.exec();
|
|
16
21
|
}
|
|
17
22
|
}
|
|
@@ -36,7 +36,7 @@ export class ActivityLogRepository {
|
|
|
36
36
|
userName: { $first: '$userName' },
|
|
37
37
|
event: { $first: '$event' },
|
|
38
38
|
game: { $first: '$game' },
|
|
39
|
-
|
|
39
|
+
channel: { $first: '$channel' },
|
|
40
40
|
count: { $sum: 1 },
|
|
41
41
|
},
|
|
42
42
|
},
|
|
@@ -113,14 +113,14 @@ export class ActivityLogRepository {
|
|
|
113
113
|
userId: string,
|
|
114
114
|
userName: string,
|
|
115
115
|
game: string,
|
|
116
|
-
|
|
116
|
+
channel: string,
|
|
117
117
|
): Promise<ActivityLog> {
|
|
118
118
|
return this.addActivityLog({
|
|
119
119
|
event: ActivityLogEnum.USER_LOGIN,
|
|
120
120
|
userId,
|
|
121
121
|
userName,
|
|
122
122
|
game,
|
|
123
|
-
|
|
123
|
+
channel,
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -128,7 +128,7 @@ export class ActivityLogRepository {
|
|
|
128
128
|
userId: string,
|
|
129
129
|
userName: string,
|
|
130
130
|
game: string,
|
|
131
|
-
|
|
131
|
+
channel: string,
|
|
132
132
|
amount: number,
|
|
133
133
|
): Promise<ActivityLog> {
|
|
134
134
|
return this.addActivityLog({
|
|
@@ -136,7 +136,7 @@ export class ActivityLogRepository {
|
|
|
136
136
|
userId,
|
|
137
137
|
userName,
|
|
138
138
|
game,
|
|
139
|
-
|
|
139
|
+
channel,
|
|
140
140
|
amount,
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -145,14 +145,14 @@ export class ActivityLogRepository {
|
|
|
145
145
|
userId: string,
|
|
146
146
|
userName: string,
|
|
147
147
|
game: string,
|
|
148
|
-
|
|
148
|
+
channel: string,
|
|
149
149
|
): Promise<ActivityLog> {
|
|
150
150
|
return this.addActivityLog({
|
|
151
151
|
event: ActivityLogEnum.USER_PLAYED_GAME,
|
|
152
152
|
userId,
|
|
153
153
|
userName,
|
|
154
154
|
game,
|
|
155
|
-
|
|
155
|
+
channel,
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -160,14 +160,14 @@ export class ActivityLogRepository {
|
|
|
160
160
|
userId: string,
|
|
161
161
|
userName: string,
|
|
162
162
|
game: string,
|
|
163
|
-
|
|
163
|
+
channel: string,
|
|
164
164
|
): Promise<ActivityLog> {
|
|
165
165
|
return this.addActivityLog({
|
|
166
166
|
event: ActivityLogEnum.USER_WON_GAME,
|
|
167
167
|
userId,
|
|
168
168
|
userName,
|
|
169
169
|
game,
|
|
170
|
-
|
|
170
|
+
channel,
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -175,14 +175,14 @@ export class ActivityLogRepository {
|
|
|
175
175
|
userId: string,
|
|
176
176
|
userName: string,
|
|
177
177
|
game: string,
|
|
178
|
-
|
|
178
|
+
channel: string,
|
|
179
179
|
): Promise<ActivityLog> {
|
|
180
180
|
return this.addActivityLog({
|
|
181
181
|
event: ActivityLogEnum.USER_WON_PROFI,
|
|
182
182
|
userId,
|
|
183
183
|
userName,
|
|
184
184
|
game,
|
|
185
|
-
|
|
185
|
+
channel,
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -190,14 +190,14 @@ export class ActivityLogRepository {
|
|
|
190
190
|
userId: string,
|
|
191
191
|
userName: string,
|
|
192
192
|
game: string,
|
|
193
|
-
|
|
193
|
+
channel: string,
|
|
194
194
|
): Promise<ActivityLog> {
|
|
195
195
|
return this.addActivityLog({
|
|
196
196
|
event: ActivityLogEnum.USER_WON_ONE_TABLE_TOURNAMENT,
|
|
197
197
|
userId,
|
|
198
198
|
userName,
|
|
199
199
|
game,
|
|
200
|
-
|
|
200
|
+
channel,
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Banner, BannerDocument } from '../';
|
|
6
|
+
import { getChannelRegExpFilter, getGameRegExpFilter } from '../utils';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class BannersRepository {
|
|
@@ -12,9 +13,15 @@ export class BannersRepository {
|
|
|
12
13
|
|
|
13
14
|
async findEnabledBanner(
|
|
14
15
|
game: string,
|
|
15
|
-
|
|
16
|
+
channel: string,
|
|
16
17
|
): Promise<Banner | null> {
|
|
17
|
-
return this.bannerModel
|
|
18
|
+
return this.bannerModel
|
|
19
|
+
.findOne({
|
|
20
|
+
game: getGameRegExpFilter(game),
|
|
21
|
+
channel: getChannelRegExpFilter(channel),
|
|
22
|
+
enabled: true,
|
|
23
|
+
})
|
|
24
|
+
.exec();
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
async findById(id: string): Promise<Banner | null> {
|
|
@@ -3,7 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { DailyBonus, DailyBonusDocument } from '../';
|
|
6
|
-
import { getChannelRegExpFilter } from '../utils';
|
|
6
|
+
import { getChannelRegExpFilter, getGameRegExpFilter } from '../utils';
|
|
7
7
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
export class DailyBonusRepository {
|
|
@@ -13,12 +13,13 @@ export class DailyBonusRepository {
|
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
15
|
async findDailyBonuses(
|
|
16
|
-
channel: string,
|
|
17
16
|
game: string,
|
|
17
|
+
channel: string,
|
|
18
18
|
): Promise<Array<DailyBonus> | null> {
|
|
19
19
|
return this.dailyBonusModel
|
|
20
20
|
.find({
|
|
21
|
-
|
|
21
|
+
game: getGameRegExpFilter(game),
|
|
22
|
+
channel: getChannelRegExpFilter(channel),
|
|
22
23
|
})
|
|
23
24
|
.exec();
|
|
24
25
|
}
|
|
@@ -3,7 +3,6 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Friend, FriendDocument } from '..';
|
|
6
|
-
import { getChannelRegExpFilter } from '../utils';
|
|
7
6
|
|
|
8
7
|
@Injectable()
|
|
9
8
|
export class FriendRepository {
|
|
@@ -11,14 +10,7 @@ export class FriendRepository {
|
|
|
11
10
|
@InjectModel(Friend.name) private friendModel: Model<FriendDocument>,
|
|
12
11
|
) {}
|
|
13
12
|
|
|
14
|
-
async
|
|
15
|
-
|
|
16
|
-
game: string,
|
|
17
|
-
): Promise<Array<Friend> | null> {
|
|
18
|
-
return this.friendModel
|
|
19
|
-
.find({
|
|
20
|
-
channels: getChannelRegExpFilter(channel),
|
|
21
|
-
})
|
|
22
|
-
.exec();
|
|
13
|
+
async findFriends(game: string): Promise<Array<Friend> | null> {
|
|
14
|
+
return this.friendModel.find().exec();
|
|
23
15
|
}
|
|
24
16
|
}
|
|
@@ -3,7 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { GameStatistic, GameStatisticDocument } from '..';
|
|
6
|
-
import {
|
|
6
|
+
import { getGameRegExpFilter } from '../utils';
|
|
7
7
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
export class GameStatisticRepository {
|
|
@@ -12,13 +12,10 @@ export class GameStatisticRepository {
|
|
|
12
12
|
private gameStatisticModel: Model<GameStatisticDocument>,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
|
-
async findGameStatistic(
|
|
16
|
-
channel: string,
|
|
17
|
-
game: string,
|
|
18
|
-
): Promise<Array<GameStatistic> | null> {
|
|
15
|
+
async findGameStatistic(game: string): Promise<Array<GameStatistic> | null> {
|
|
19
16
|
return this.gameStatisticModel
|
|
20
17
|
.find({
|
|
21
|
-
|
|
18
|
+
game: getGameRegExpFilter(game),
|
|
22
19
|
})
|
|
23
20
|
.exec();
|
|
24
21
|
}
|
|
@@ -4,7 +4,6 @@ import { BannersRepository } from './banners.repository';
|
|
|
4
4
|
import { ComplainsRepository } from './complains.repository';
|
|
5
5
|
import { NotificationRepository } from './notification.repository';
|
|
6
6
|
import { ProductsRepository } from './products.repository';
|
|
7
|
-
import { ScheduledTournamentsRepository } from './scheduled-tournaments.repository';
|
|
8
7
|
import { ServersRepository } from './servers.repository';
|
|
9
8
|
import { UsersRepository } from './users.repository';
|
|
10
9
|
import { MenuRepository } from './menu.repository';
|
|
@@ -16,11 +15,10 @@ import { SettingRepository } from './setting.repository';
|
|
|
16
15
|
import { PremiumRepository } from './premium.repository';
|
|
17
16
|
import { WelcomeRepository } from './welcome.repository';
|
|
18
17
|
import { DailyBonusRepository } from './daily-bonus.repository';
|
|
19
|
-
import { RoomsRepository } from './rooms.repository';
|
|
20
18
|
import { GameResultRepository } from './game-result.repository';
|
|
21
19
|
import { SimpleRoomsRepository } from './simple-rooms.repository';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
20
|
+
import { OneTableTournamentRoomsRepository } from './one-table-tournament-rooms.repository';
|
|
21
|
+
import { ManyTablesTournamentRoomsRepository } from './many-tables-tournament-rooms.repository';
|
|
24
22
|
import { ActivityLogRepository } from './activity-log.repository';
|
|
25
23
|
import { AchievementRepository } from './achievement.repository';
|
|
26
24
|
import { PurchaseRepository } from './purchase.repository';
|
|
@@ -35,7 +33,6 @@ export {
|
|
|
35
33
|
ComplainsRepository,
|
|
36
34
|
NotificationRepository,
|
|
37
35
|
ProductsRepository,
|
|
38
|
-
ScheduledTournamentsRepository,
|
|
39
36
|
ServersRepository,
|
|
40
37
|
UsersRepository,
|
|
41
38
|
MenuRepository,
|
|
@@ -47,11 +44,10 @@ export {
|
|
|
47
44
|
PremiumRepository,
|
|
48
45
|
WelcomeRepository,
|
|
49
46
|
DailyBonusRepository,
|
|
50
|
-
RoomsRepository,
|
|
51
47
|
GameResultRepository,
|
|
52
48
|
SimpleRoomsRepository,
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
OneTableTournamentRoomsRepository,
|
|
50
|
+
ManyTablesTournamentRoomsRepository,
|
|
55
51
|
ActivityLogRepository,
|
|
56
52
|
AchievementRepository,
|
|
57
53
|
PurchaseRepository,
|
|
@@ -3,39 +3,35 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
TournamentManyTablesRoom,
|
|
8
|
-
TournamentManyTablesRoomDocument,
|
|
9
|
-
TournamentOneTableRoomDocument,
|
|
10
|
-
} from '../';
|
|
6
|
+
import { ManyTablesTournamentRoom, ManyTablesTournamentRoomDocument } from '..';
|
|
11
7
|
import { TournamentStatusEnum } from '../models/tournament-status.enum';
|
|
12
8
|
import { ITournamentWinner } from '../models/tournament-winner.interface';
|
|
13
9
|
import { TournamentTemplateEnum } from '../models/tournament-template.enum';
|
|
14
10
|
import { ITournamentParticipant } from '../models/tournament-participant.interface';
|
|
15
11
|
|
|
16
12
|
@Injectable()
|
|
17
|
-
export class
|
|
13
|
+
export class ManyTablesTournamentRoomsRepository {
|
|
18
14
|
constructor(
|
|
19
|
-
@InjectModel(
|
|
20
|
-
private tournamentModel: Model<
|
|
15
|
+
@InjectModel(ManyTablesTournamentRoom.name)
|
|
16
|
+
private tournamentModel: Model<ManyTablesTournamentRoomDocument>,
|
|
21
17
|
) {}
|
|
22
18
|
|
|
23
19
|
async findTournamentById(
|
|
24
20
|
tournamentId: string,
|
|
25
|
-
): Promise<
|
|
21
|
+
): Promise<ManyTablesTournamentRoomDocument | null> {
|
|
26
22
|
return this.tournamentModel.findById(tournamentId).exec();
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
async findTemplateById(
|
|
30
26
|
templateId: string,
|
|
31
27
|
gameType: string,
|
|
32
|
-
): Promise<
|
|
28
|
+
): Promise<ManyTablesTournamentRoomDocument | null> {
|
|
33
29
|
return this.tournamentModel.findOne({ templateId, gameType }).exec();
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
async findActualTournaments(
|
|
37
33
|
gameType: string,
|
|
38
|
-
): Promise<Array<
|
|
34
|
+
): Promise<Array<ManyTablesTournamentRoomDocument>> {
|
|
39
35
|
return this.tournamentModel
|
|
40
36
|
.find({
|
|
41
37
|
$and: [
|
|
@@ -58,7 +54,7 @@ export class TournamentManyTablesRoomsRepository {
|
|
|
58
54
|
gameType: string,
|
|
59
55
|
startDate: Date,
|
|
60
56
|
endDate: Date,
|
|
61
|
-
): Promise<
|
|
57
|
+
): Promise<ManyTablesTournamentRoomDocument | null> {
|
|
62
58
|
return this.tournamentModel
|
|
63
59
|
.findOne({
|
|
64
60
|
gameType,
|
|
@@ -70,15 +66,15 @@ export class TournamentManyTablesRoomsRepository {
|
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
async createTournament(
|
|
73
|
-
tournament: Partial<
|
|
74
|
-
): Promise<
|
|
69
|
+
tournament: Partial<ManyTablesTournamentRoom>,
|
|
70
|
+
): Promise<ManyTablesTournamentRoomDocument> {
|
|
75
71
|
return this.tournamentModel.create(tournament);
|
|
76
72
|
}
|
|
77
73
|
|
|
78
74
|
async scheduleTournamentFromMasterTemplate(
|
|
79
75
|
gameType: string,
|
|
80
76
|
scheduleDate: Date,
|
|
81
|
-
): Promise<
|
|
77
|
+
): Promise<ManyTablesTournamentRoomDocument> {
|
|
82
78
|
const masterTemplate = await this.findTemplateById(
|
|
83
79
|
TournamentTemplateEnum.MASTER,
|
|
84
80
|
gameType,
|
|
@@ -108,8 +104,8 @@ export class TournamentManyTablesRoomsRepository {
|
|
|
108
104
|
|
|
109
105
|
async updateTournament(
|
|
110
106
|
tournamentId: string,
|
|
111
|
-
tournament: Partial<
|
|
112
|
-
): Promise<
|
|
107
|
+
tournament: Partial<ManyTablesTournamentRoom>,
|
|
108
|
+
): Promise<ManyTablesTournamentRoomDocument> {
|
|
113
109
|
return this.tournamentModel
|
|
114
110
|
.findByIdAndUpdate(tournamentId, {
|
|
115
111
|
$set: {
|
|
@@ -3,16 +3,17 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Menu, MenuDocument } from '../';
|
|
6
|
-
import { getChannelRegExpFilter } from '../utils';
|
|
6
|
+
import { getGameRegExpFilter, getChannelRegExpFilter } from '../utils';
|
|
7
7
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
export class MenuRepository {
|
|
10
10
|
constructor(@InjectModel(Menu.name) private menuModel: Model<MenuDocument>) {}
|
|
11
11
|
|
|
12
|
-
async findMenus(
|
|
12
|
+
async findMenus(game: string, channel: string): Promise<Array<Menu> | null> {
|
|
13
13
|
return this.menuModel
|
|
14
14
|
.find({
|
|
15
|
-
|
|
15
|
+
game: getGameRegExpFilter(game),
|
|
16
|
+
channel: getChannelRegExpFilter(channel),
|
|
16
17
|
})
|
|
17
18
|
.exec();
|
|
18
19
|
}
|
|
@@ -3,29 +3,29 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { OneTableTournamentRoom, OneTableTournamentRoomDocument } from '..';
|
|
7
7
|
import { ITournamentParticipant } from '../models/tournament-participant.interface';
|
|
8
8
|
import { TournamentStatusEnum } from '../models/tournament-status.enum';
|
|
9
9
|
import { ITournamentWinner } from '../models/tournament-winner.interface';
|
|
10
10
|
import { TournamentTemplateEnum } from '../models/tournament-template.enum';
|
|
11
11
|
|
|
12
12
|
@Injectable()
|
|
13
|
-
export class
|
|
13
|
+
export class OneTableTournamentRoomsRepository {
|
|
14
14
|
constructor(
|
|
15
|
-
@InjectModel(
|
|
16
|
-
private tournamentModel: Model<
|
|
15
|
+
@InjectModel(OneTableTournamentRoom.name)
|
|
16
|
+
private tournamentModel: Model<OneTableTournamentRoomDocument>,
|
|
17
17
|
) {}
|
|
18
18
|
|
|
19
19
|
async findTournamentById(
|
|
20
20
|
tournamentId: string,
|
|
21
|
-
): Promise<
|
|
21
|
+
): Promise<OneTableTournamentRoomDocument | null> {
|
|
22
22
|
return this.tournamentModel.findById(tournamentId).exec();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async findTemplateById(
|
|
26
26
|
templateId: string,
|
|
27
27
|
gameType: string,
|
|
28
|
-
): Promise<
|
|
28
|
+
): Promise<OneTableTournamentRoomDocument | null> {
|
|
29
29
|
return this.tournamentModel
|
|
30
30
|
.findOne({ isTemplate: true, templateId, gameType })
|
|
31
31
|
.exec();
|
|
@@ -33,7 +33,7 @@ export class TournamentOneTableRoomsRepository {
|
|
|
33
33
|
|
|
34
34
|
async findActualTournaments(
|
|
35
35
|
gameType: string,
|
|
36
|
-
): Promise<Array<
|
|
36
|
+
): Promise<Array<OneTableTournamentRoomDocument>> {
|
|
37
37
|
return this.tournamentModel
|
|
38
38
|
.find({
|
|
39
39
|
$and: [
|
|
@@ -54,7 +54,7 @@ export class TournamentOneTableRoomsRepository {
|
|
|
54
54
|
|
|
55
55
|
async findWaitingTournament(
|
|
56
56
|
gameType: string,
|
|
57
|
-
): Promise<
|
|
57
|
+
): Promise<OneTableTournamentRoomDocument | null> {
|
|
58
58
|
return this.tournamentModel
|
|
59
59
|
.findOne({
|
|
60
60
|
gameType,
|
|
@@ -65,14 +65,14 @@ export class TournamentOneTableRoomsRepository {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
async createTournament(
|
|
68
|
-
tournament: Partial<
|
|
69
|
-
): Promise<
|
|
68
|
+
tournament: Partial<OneTableTournamentRoom>,
|
|
69
|
+
): Promise<OneTableTournamentRoomDocument> {
|
|
70
70
|
return this.tournamentModel.create(tournament);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async createTournamentFromMasterTemplate(
|
|
74
74
|
gameType: string,
|
|
75
|
-
): Promise<
|
|
75
|
+
): Promise<OneTableTournamentRoomDocument> {
|
|
76
76
|
const masterTemplate = await this.findTemplateById(
|
|
77
77
|
TournamentTemplateEnum.MASTER,
|
|
78
78
|
gameType,
|
|
@@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Premium, PremiumDocument } from '..';
|
|
6
|
+
import { getGameRegExpFilter, getChannelRegExpFilter } from '../utils';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class PremiumRepository {
|
|
@@ -10,7 +11,12 @@ export class PremiumRepository {
|
|
|
10
11
|
@InjectModel(Premium.name) private premiumModel: Model<PremiumDocument>,
|
|
11
12
|
) {}
|
|
12
13
|
|
|
13
|
-
async findPremium(
|
|
14
|
-
return this.premiumModel
|
|
14
|
+
async findPremium(game: string, channel: string): Promise<Premium | null> {
|
|
15
|
+
return this.premiumModel
|
|
16
|
+
.findOne({
|
|
17
|
+
game: getGameRegExpFilter(game),
|
|
18
|
+
channel: getChannelRegExpFilter(channel),
|
|
19
|
+
})
|
|
20
|
+
.exec();
|
|
15
21
|
}
|
|
16
22
|
}
|
|
@@ -3,7 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Product, ProductDocument } from '../';
|
|
6
|
-
import { getChannelRegExpFilter } from '../utils';
|
|
6
|
+
import { getChannelRegExpFilter, getGameRegExpFilter } from '../utils';
|
|
7
7
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
export class ProductsRepository {
|
|
@@ -17,13 +17,15 @@ export class ProductsRepository {
|
|
|
17
17
|
|
|
18
18
|
async findProducts(
|
|
19
19
|
parentId: string | null,
|
|
20
|
+
game: string,
|
|
20
21
|
channel: string,
|
|
21
22
|
): Promise<Array<Product> | null> {
|
|
22
23
|
return this.productModel
|
|
23
24
|
.find({
|
|
24
25
|
parentId,
|
|
25
26
|
active: true,
|
|
26
|
-
|
|
27
|
+
game: getGameRegExpFilter(game),
|
|
28
|
+
channel: getChannelRegExpFilter(channel),
|
|
27
29
|
})
|
|
28
30
|
.exec();
|
|
29
31
|
}
|
|
@@ -3,7 +3,6 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Rating, RatingDocument } from '..';
|
|
6
|
-
import { getChannelRegExpFilter } from '../utils';
|
|
7
6
|
import { IRatingMonthlyResult } from '../models/rating-monthly-result.interface';
|
|
8
7
|
|
|
9
8
|
@Injectable()
|
|
@@ -12,17 +11,6 @@ export class RatingRepository {
|
|
|
12
11
|
@InjectModel(Rating.name) private ratingModel: Model<RatingDocument>,
|
|
13
12
|
) {}
|
|
14
13
|
|
|
15
|
-
async findRating(
|
|
16
|
-
channel: string,
|
|
17
|
-
game: string,
|
|
18
|
-
): Promise<Array<Rating> | null> {
|
|
19
|
-
return this.ratingModel
|
|
20
|
-
.find({
|
|
21
|
-
channels: getChannelRegExpFilter(channel),
|
|
22
|
-
})
|
|
23
|
-
.exec();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
14
|
async addBulkPlayerRating(items: Array<Rating>): Promise<void> {
|
|
27
15
|
await this.ratingModel.insertMany(items);
|
|
28
16
|
}
|
|
@@ -57,7 +45,7 @@ export class RatingRepository {
|
|
|
57
45
|
userName: { $first: '$userName' },
|
|
58
46
|
userAvatarUrl: { $first: '$userAvatarUrl' },
|
|
59
47
|
game: { $first: '$game' },
|
|
60
|
-
|
|
48
|
+
channel: { $first: '$channel' },
|
|
61
49
|
count: { $sum: 1 },
|
|
62
50
|
profit: { $sum: '$profit' },
|
|
63
51
|
},
|
|
@@ -79,10 +67,11 @@ export class RatingRepository {
|
|
|
79
67
|
userName: 1,
|
|
80
68
|
userAvatarUrl: 1,
|
|
81
69
|
game: 1,
|
|
82
|
-
|
|
70
|
+
channel: 1,
|
|
83
71
|
count: 1,
|
|
84
72
|
date: '$_id.date',
|
|
85
73
|
rank: 1,
|
|
74
|
+
profit: 1,
|
|
86
75
|
},
|
|
87
76
|
},
|
|
88
77
|
]);
|
|
@@ -3,12 +3,18 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Rule, RuleDocument } from '..';
|
|
6
|
+
import { getGameRegExpFilter, getChannelRegExpFilter } from '../utils';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class RuleRepository {
|
|
9
10
|
constructor(@InjectModel(Rule.name) private ruleModel: Model<RuleDocument>) {}
|
|
10
11
|
|
|
11
|
-
async findRule(
|
|
12
|
-
return this.ruleModel
|
|
12
|
+
async findRule(game: string, channel: string): Promise<Rule | null> {
|
|
13
|
+
return this.ruleModel
|
|
14
|
+
.findOne({
|
|
15
|
+
game: getGameRegExpFilter(game),
|
|
16
|
+
channel: getChannelRegExpFilter(channel),
|
|
17
|
+
})
|
|
18
|
+
.exec();
|
|
13
19
|
}
|
|
14
20
|
}
|
|
@@ -3,7 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Setting, SettingDocument } from '..';
|
|
6
|
-
import { getChannelRegExpFilter } from '../utils';
|
|
6
|
+
import { getChannelRegExpFilter, getGameRegExpFilter } from '../utils';
|
|
7
7
|
|
|
8
8
|
@Injectable()
|
|
9
9
|
export class SettingRepository {
|
|
@@ -12,12 +12,13 @@ export class SettingRepository {
|
|
|
12
12
|
) {}
|
|
13
13
|
|
|
14
14
|
async findSettings(
|
|
15
|
-
channel: string,
|
|
16
15
|
game: string,
|
|
16
|
+
channel: string,
|
|
17
17
|
): Promise<Array<Setting> | null> {
|
|
18
18
|
return this.settingModel
|
|
19
19
|
.find({
|
|
20
|
-
|
|
20
|
+
game: getGameRegExpFilter(game),
|
|
21
|
+
channel: getChannelRegExpFilter(channel),
|
|
21
22
|
})
|
|
22
23
|
.exec();
|
|
23
24
|
}
|
|
@@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
|
|
|
3
3
|
import { Model } from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { Welcome, WelcomeDocument } from '..';
|
|
6
|
+
import { getGameRegExpFilter, getChannelRegExpFilter } from '../utils';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class WelcomeRepository {
|
|
@@ -10,7 +11,12 @@ export class WelcomeRepository {
|
|
|
10
11
|
@InjectModel(Welcome.name) private welcomeModel: Model<WelcomeDocument>,
|
|
11
12
|
) {}
|
|
12
13
|
|
|
13
|
-
async findWelcome(game: string): Promise<Welcome | null> {
|
|
14
|
-
return this.welcomeModel
|
|
14
|
+
async findWelcome(game: string, channel: string): Promise<Welcome | null> {
|
|
15
|
+
return this.welcomeModel
|
|
16
|
+
.findOne({
|
|
17
|
+
game: getGameRegExpFilter(game),
|
|
18
|
+
channel: getChannelRegExpFilter(channel),
|
|
19
|
+
})
|
|
20
|
+
.exec();
|
|
15
21
|
}
|
|
16
22
|
}
|
|
@@ -12,17 +12,11 @@ export class Achievement {
|
|
|
12
12
|
})
|
|
13
13
|
readonly achievementId: string;
|
|
14
14
|
|
|
15
|
-
@Prop()
|
|
16
|
-
title: string
|
|
17
|
-
|
|
18
|
-
@Prop()
|
|
19
|
-
titleEn: string;
|
|
15
|
+
@Prop({ type: Object })
|
|
16
|
+
title: Record<string, string>;
|
|
20
17
|
|
|
21
|
-
@Prop()
|
|
22
|
-
description: string
|
|
23
|
-
|
|
24
|
-
@Prop()
|
|
25
|
-
descriptionEn: string;
|
|
18
|
+
@Prop({ type: Object })
|
|
19
|
+
description: Record<string, string>;
|
|
26
20
|
|
|
27
21
|
@Prop()
|
|
28
22
|
code: string;
|