jp.ms.common.modules 1.0.41 → 1.0.42
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/modules/anti-freeze-system/anti-freeze-system.module.d.ts +3 -1
- package/dist/modules/anti-freeze-system/anti-freeze-system.module.js +8 -4
- package/dist/modules/anti-freeze-system/anti-freeze-system.module.js.map +1 -1
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.d.ts +6 -2
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.js +37 -10
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.js.map +1 -1
- package/dist/modules/base-achievements/base-achievements.module.js +2 -2
- package/dist/modules/base-achievements/base-achievements.module.js.map +1 -1
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.constants.d.ts +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.constants.js +5 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.constants.js.map +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.interfaces.d.ts +13 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.interfaces.js +3 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.interfaces.js.map +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.module.d.ts +15 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.module.js +77 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.module.js.map +1 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.service.d.ts +19 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.service.js +83 -0
- package/dist/modules/confirmation-message-manager/confirmation-message-manager.service.js.map +1 -0
- package/dist/modules/event-bus/events-bus.module.js +3 -0
- package/dist/modules/event-bus/events-bus.module.js.map +1 -1
- package/dist/modules/event-bus/events-bus.player-ws-message.subscribe.service.d.ts +10 -0
- package/dist/modules/event-bus/events-bus.player-ws-message.subscribe.service.js +26 -0
- package/dist/modules/event-bus/events-bus.player-ws-message.subscribe.service.js.map +1 -0
- package/dist/modules/event-bus/index.d.ts +1 -0
- package/dist/modules/event-bus/index.js +3 -1
- package/dist/modules/event-bus/index.js.map +1 -1
- package/dist/modules/events/events.gateway.d.ts +6 -1
- package/dist/modules/events/events.gateway.js +15 -3
- package/dist/modules/events/events.gateway.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +3 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/main/main.module.js +1 -1
- package/dist/modules/main/main.module.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.js +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +57 -57
- package/src/dto/app-screen/app-screen-app-bar.dto.ts +36 -36
- package/src/dto/app-screen/app-screen-dialog.dto.ts +64 -64
- package/src/dto/app-screen/app-screen-field-list-item.dto.ts +42 -42
- package/src/dto/app-screen/app-screen-field.dto.ts +59 -59
- package/src/dto/app-screen/app-screen-section-button.dto.ts +60 -60
- package/src/dto/app-screen/app-screen-section-buttons.dto.ts +14 -14
- package/src/dto/app-screen/app-screen-section-image.dto.ts +33 -33
- package/src/dto/app-screen/app-screen-section-list-item.dto.ts +105 -105
- package/src/dto/app-screen/app-screen-section-req.dto.ts +33 -33
- package/src/dto/app-screen/app-screen-section.dto.ts +76 -76
- package/src/dto/app-screen/app-screen.dto.ts +50 -50
- package/src/dto/app-screen/base-app-screen.dto.ts +16 -16
- package/src/dto/app-screen/index.ts +10 -10
- package/src/dto/app-table/bids-panel-item.dto.ts +33 -33
- package/src/dto/app-table/bids-panel.dto.ts +32 -32
- package/src/dto/app-table/card.dto.ts +54 -54
- package/src/dto/app-table/cards-deck.dto.ts +22 -22
- package/src/dto/app-table/cards-pair-slots-item.dto.ts +45 -45
- package/src/dto/app-table/cards-pair-slots.dto.ts +13 -13
- package/src/dto/app-table/cards-panel.dto.ts +48 -48
- package/src/dto/app-table/cards-player.dto.ts +14 -14
- package/src/dto/app-table/cards-slots-item.dto.ts +40 -40
- package/src/dto/app-table/cards-slots.dto.ts +13 -13
- package/src/dto/app-table/index.ts +15 -15
- package/src/dto/app-table/moves-panel-button.dto.ts +24 -24
- package/src/dto/app-table/moves-panel.dto.ts +23 -23
- package/src/dto/app-table/player.dto.ts +69 -69
- package/src/dto/app-table/summary-item.dto.ts +51 -51
- package/src/dto/app-table/summary.dto.ts +13 -13
- package/src/dto/common/find-free-table.dto.ts +3 -3
- package/src/dto/common/index.ts +2 -2
- package/src/dto/common/join-tournament.dto.ts +33 -33
- package/src/dto/common/log.dto.ts +9 -9
- package/src/dto/common/many-tables-tournament-create.dto.ts +125 -125
- package/src/dto/common/many-tables-tournament-update.dto.ts +3 -3
- package/src/dto/common/player-check-state.dto.ts +33 -33
- package/src/dto/common/player-connected.dto.ts +58 -58
- package/src/dto/games/fool/fool-player.dto.ts +3 -3
- package/src/dto/games/fool/fool-table.dto.ts +81 -81
- package/src/dto/games/index.ts +2 -2
- package/src/dto/games/poker/poker-player.dto.ts +3 -3
- package/src/dto/games/poker/poker-table.dto.ts +81 -81
- package/src/dto/index.ts +4 -4
- package/src/exception/error-code.enum.ts +4 -4
- package/src/exception/global-exception-filter.ts +53 -53
- package/src/exception/http-exception-wth-snackbar.ts +27 -27
- package/src/exception/index.ts +4 -4
- package/src/exception/not-enough-money-for-purchase.exception.ts +14 -14
- package/src/exception/not-found-free-room-for-fast-game.exception.ts +14 -14
- package/src/index.ts +4 -4
- package/src/modules/anti-freeze-system/anti-freeze-system.constants.ts +1 -1
- package/src/modules/anti-freeze-system/anti-freeze-system.interfaces.ts +20 -20
- package/src/modules/anti-freeze-system/anti-freeze-system.module.ts +59 -55
- package/src/modules/anti-freeze-system/anti-freeze-system.service.ts +136 -105
- package/src/modules/anti-freeze-system/index.ts +1 -1
- package/src/modules/base-achievements/base-achievements.module.ts +324 -322
- package/src/modules/base-achievements/index.ts +1 -1
- package/src/modules/confirmation-message-manager/confirmation-message-manager.constants.ts +3 -0
- package/src/modules/confirmation-message-manager/confirmation-message-manager.interfaces.ts +20 -0
- package/src/modules/confirmation-message-manager/confirmation-message-manager.module.ts +77 -0
- package/src/modules/confirmation-message-manager/confirmation-message-manager.service.ts +91 -0
- package/src/modules/event-bus/events-bus.app.subscribe.service.ts +20 -20
- package/src/modules/event-bus/events-bus.main-tables.subscribe.service.ts +34 -34
- package/src/modules/event-bus/events-bus.many-tables-tournament.subscribe.service.ts +6 -6
- package/src/modules/event-bus/events-bus.module.ts +26 -23
- package/src/modules/event-bus/events-bus.one-table-tournament.subscribe.service.ts +6 -6
- package/src/modules/event-bus/events-bus.player-ws-message.subscribe.service.ts +30 -0
- package/src/modules/event-bus/events-bus.tournament.subscribe.service.ts +18 -18
- package/src/modules/event-bus/index.ts +6 -5
- package/src/modules/events/events.constants.ts +1 -1
- package/src/modules/events/events.gateway.ts +82 -70
- package/src/modules/events/events.interfaces.ts +17 -17
- package/src/modules/events/events.module.ts +32 -32
- package/src/modules/events/index.ts +1 -1
- package/src/modules/index.ts +28 -27
- package/src/modules/logger/index.ts +2 -2
- package/src/modules/logger/jp-logger.module.ts +10 -10
- package/src/modules/logger/jp-logger.service.ts +38 -38
- package/src/modules/main/index.ts +1 -1
- package/src/modules/main/main-tables-list-screen.view.ts +275 -275
- package/src/modules/main/main.constants.ts +1 -1
- package/src/modules/main/main.controller.ts +72 -72
- package/src/modules/main/main.interfaces.ts +17 -17
- package/src/modules/main/main.module.ts +73 -73
- package/src/modules/main/main.service.ts +183 -183
- package/src/modules/many-tables-tournament/index.ts +1 -1
- package/src/modules/many-tables-tournament/many-tables-tournament-status-screen.view.ts +143 -143
- package/src/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.ts +63 -63
- package/src/modules/many-tables-tournament/many-tables-tournament.constants.ts +3 -3
- package/src/modules/many-tables-tournament/many-tables-tournament.controller.ts +151 -151
- package/src/modules/many-tables-tournament/many-tables-tournament.interfaces.ts +20 -20
- package/src/modules/many-tables-tournament/many-tables-tournament.module.ts +81 -80
- package/src/modules/many-tables-tournament/many-tables-tournament.service.ts +208 -208
- package/src/modules/many-tables-tournament-rooms-manager/index.ts +2 -2
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.constants.ts +3 -3
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.interfaces.ts +37 -37
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.module.ts +84 -84
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.service.ts +331 -331
- package/src/modules/menu/index.ts +1 -1
- package/src/modules/menu/menu-screen.view.ts +71 -71
- package/src/modules/menu/menu.constants.ts +1 -1
- package/src/modules/menu/menu.controller.ts +16 -16
- package/src/modules/menu/menu.interfaces.ts +17 -17
- package/src/modules/menu/menu.module.ts +39 -39
- package/src/modules/menu/menu.service.ts +39 -39
- package/src/modules/one-table-tournament/index.ts +1 -1
- package/src/modules/one-table-tournament/one-table-tournament-status-screen.view.ts +166 -166
- package/src/modules/one-table-tournament/one-table-tournament.constants.ts +3 -3
- package/src/modules/one-table-tournament/one-table-tournament.controller.ts +104 -104
- package/src/modules/one-table-tournament/one-table-tournament.interfaces.ts +20 -20
- package/src/modules/one-table-tournament/one-table-tournament.module.ts +80 -76
- package/src/modules/one-table-tournament/one-table-tournament.service.ts +146 -146
- package/src/modules/one-table-tournament-rooms-manager/index.ts +2 -2
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.constants.ts +3 -3
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.interfaces.ts +31 -31
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.module.ts +66 -66
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.service.ts +220 -220
- package/src/modules/players-manager/index.ts +2 -2
- package/src/modules/players-manager/players-manager.module.ts +9 -9
- package/src/modules/players-manager/players-manager.service.ts +27 -27
- package/src/modules/simple-rooms/index.ts +1 -1
- package/src/modules/simple-rooms/simple-rooms.constants.ts +1 -1
- package/src/modules/simple-rooms/simple-rooms.controller.ts +63 -63
- package/src/modules/simple-rooms/simple-rooms.interfaces.ts +20 -20
- package/src/modules/simple-rooms/simple-rooms.module.ts +39 -39
- package/src/modules/simple-rooms/simple-rooms.service.ts +95 -95
- package/src/modules/simple-rooms-manager/index.ts +2 -2
- package/src/modules/simple-rooms-manager/simple-rooms-manager.constants.ts +3 -3
- package/src/modules/simple-rooms-manager/simple-rooms-manager.interfaces.ts +26 -26
- package/src/modules/simple-rooms-manager/simple-rooms-manager.module.ts +60 -60
- package/src/modules/simple-rooms-manager/simple-rooms-manager.service.ts +190 -190
- package/src/modules/support/dump.service.ts +11 -11
- package/src/modules/support/index.ts +1 -1
- package/src/modules/support/metric.service.ts +41 -41
- package/src/modules/support/support.constants.ts +1 -1
- package/src/modules/support/support.controller.ts +79 -79
- package/src/modules/support/support.interfaces.ts +16 -16
- package/src/modules/support/support.module.ts +35 -35
- package/src/modules/support/support.service.ts +27 -27
- package/src/utils/date.ts +7 -7
- package/src/utils/game-table-result.ts +129 -129
- package/src/views/index.ts +5 -5
- package/src/views/many-tables-tournament-conifrm-exit-dialog.view.ts +37 -37
- package/src/views/one-table-tournament-conifrm-exit-dialog.view.ts +37 -37
- package/src/views/simple-room-conifrm-exit-dialog.view.ts +37 -37
- package/src/views/table-summary.view.ts +104 -104
- package/src/views/tournament-buy-ticket-dialog.view.ts +34 -34
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Inject,
|
|
3
|
-
Injectable,
|
|
4
|
-
InternalServerErrorException,
|
|
5
|
-
} from '@nestjs/common';
|
|
6
|
-
import dayjs from 'dayjs';
|
|
7
|
-
import isToday from 'dayjs/plugin/isToday';
|
|
8
|
-
import { ActivityLogRepository, UsersRepository } from 'jp.db.schemas';
|
|
9
|
-
import {
|
|
10
|
-
SimpleRoom,
|
|
11
|
-
OneTableTournamentRoom,
|
|
12
|
-
ManyTablesTournamentRoom,
|
|
13
|
-
} from 'jp.ms.common.engine';
|
|
14
|
-
import {
|
|
15
|
-
AppScreenRoutesEnum,
|
|
16
|
-
ErrorSnackbarComponent,
|
|
17
|
-
AppScreenRouter,
|
|
18
|
-
} from 'jp.common.models';
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
BaseAppScreenDto,
|
|
22
|
-
PlayerCheckStateDto,
|
|
23
|
-
FindFreeTableDto,
|
|
24
|
-
} from '../../dto';
|
|
25
|
-
import { SimpleRoomsManagerService } from '../simple-rooms-manager';
|
|
26
|
-
import { PlayersManagerService } from '../players-manager';
|
|
27
|
-
import { OneTableTournamentRoomsManagerService } from '../one-table-tournament-rooms-manager';
|
|
28
|
-
import { ManyTablesTournamentRoomsManagerService } from '../many-tables-tournament-rooms-manager';
|
|
29
|
-
import { EventsBusMainTablesSubscribeService } from '../event-bus/events-bus.main-tables.subscribe.service';
|
|
30
|
-
import {
|
|
31
|
-
ErrorCodeEnum,
|
|
32
|
-
NotEnoughMoneyForPurchaseException,
|
|
33
|
-
NotFoundFreeRoomForFastGameException,
|
|
34
|
-
} from '../../exception';
|
|
35
|
-
|
|
36
|
-
import { MainFactoryOptions } from './main.interfaces';
|
|
37
|
-
import { MAIN_OPTIONS } from './main.constants';
|
|
38
|
-
import { MainTablesListScreenView } from './main-tables-list-screen.view';
|
|
39
|
-
|
|
40
|
-
@Injectable()
|
|
41
|
-
export class MainService {
|
|
42
|
-
constructor(
|
|
43
|
-
private readonly simpleRoomsManager: SimpleRoomsManagerService,
|
|
44
|
-
private readonly oneTableRoomsManagerService: OneTableTournamentRoomsManagerService,
|
|
45
|
-
private readonly manyTablesRoomsManagerService: ManyTablesTournamentRoomsManagerService,
|
|
46
|
-
private readonly playersManager: PlayersManagerService,
|
|
47
|
-
private readonly eventsBusMainTablesSubscribeService: EventsBusMainTablesSubscribeService,
|
|
48
|
-
private readonly usersRepository: UsersRepository,
|
|
49
|
-
private readonly activityLogRepository: ActivityLogRepository,
|
|
50
|
-
@Inject(MAIN_OPTIONS) private readonly options: MainFactoryOptions,
|
|
51
|
-
) {
|
|
52
|
-
dayjs.extend(isToday);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getScreen(lang: string, clientAuthToken: string): BaseAppScreenDto {
|
|
56
|
-
return new BaseAppScreenDto(
|
|
57
|
-
new MainTablesListScreenView(
|
|
58
|
-
this.options.i18n,
|
|
59
|
-
lang,
|
|
60
|
-
this.simpleRoomsManager.getRooms(),
|
|
61
|
-
this.oneTableRoomsManagerService.getRooms(),
|
|
62
|
-
this.manyTablesRoomsManagerService.getRooms(),
|
|
63
|
-
clientAuthToken,
|
|
64
|
-
).buildBS(),
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
subscribeOnTablesScreen(clientAuthToken: string): Promise<void> {
|
|
69
|
-
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
70
|
-
|
|
71
|
-
if (player) {
|
|
72
|
-
this.eventsBusMainTablesSubscribeService.addTablesSubscriber(player);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
throw new InternalServerErrorException();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
unsubscribeFromTablesScreen(clientAuthToken: string): Promise<void> {
|
|
79
|
-
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
80
|
-
|
|
81
|
-
if (player) {
|
|
82
|
-
this.eventsBusMainTablesSubscribeService.removeTablesSubbcriber(player);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
throw new InternalServerErrorException();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async playerCheckState(
|
|
89
|
-
clientAuthToken: string,
|
|
90
|
-
game: string,
|
|
91
|
-
): Promise<PlayerCheckStateDto> {
|
|
92
|
-
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
93
|
-
let redirectUrl: string = AppScreenRoutesEnum.MENU;
|
|
94
|
-
|
|
95
|
-
const foundUser = await this.usersRepository.findById(clientAuthToken);
|
|
96
|
-
const isNewbie =
|
|
97
|
-
await this.activityLogRepository.userIsNewbie(clientAuthToken);
|
|
98
|
-
const last7logins = await this.activityLogRepository.findLast7DaysLogins(
|
|
99
|
-
game,
|
|
100
|
-
clientAuthToken,
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
if (!foundUser) {
|
|
104
|
-
throw new InternalServerErrorException();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
player &&
|
|
109
|
-
(player.isPlayer() || player.isTableQueuer()) &&
|
|
110
|
-
player.tableId
|
|
111
|
-
) {
|
|
112
|
-
if (player.room instanceof SimpleRoom) {
|
|
113
|
-
redirectUrl = AppScreenRouter.getSimpleRoomTablePath(player.tableId);
|
|
114
|
-
} else if (player.room instanceof OneTableTournamentRoom) {
|
|
115
|
-
redirectUrl = AppScreenRouter.getOneTableTournamentTablePath(
|
|
116
|
-
player.tableId,
|
|
117
|
-
);
|
|
118
|
-
} else if (player.room instanceof ManyTablesTournamentRoom) {
|
|
119
|
-
redirectUrl = AppScreenRouter.getManyTablesTournamentTablePath(
|
|
120
|
-
player.tableId,
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
} else if (isNewbie) {
|
|
124
|
-
redirectUrl = AppScreenRoutesEnum.WELCOME;
|
|
125
|
-
} else if (
|
|
126
|
-
dayjs(last7logins[0].date).isToday() &&
|
|
127
|
-
last7logins[0].count === 1
|
|
128
|
-
) {
|
|
129
|
-
redirectUrl = AppScreenRoutesEnum.DAILY_BONUS;
|
|
130
|
-
} else if (dayjs(foundUser.premiumExpired).isToday()) {
|
|
131
|
-
redirectUrl = AppScreenRoutesEnum.PREMIUM;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return PlayerCheckStateDto.fromEntities(redirectUrl, player?.id ?? '');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
findFreeTable(clientAuthToken: string, lang: string): FindFreeTableDto {
|
|
138
|
-
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
139
|
-
const tableId = this.simpleRoomsManager.getFreeFastGameRoom()?.getId();
|
|
140
|
-
|
|
141
|
-
if (!player || !tableId) {
|
|
142
|
-
throw new NotFoundFreeRoomForFastGameException(
|
|
143
|
-
new ErrorSnackbarComponent(
|
|
144
|
-
ErrorCodeEnum.NOT_FOUND_FREE_ROOM_FOR_FAST_GAME,
|
|
145
|
-
this.options.i18n.t('common.server.message.code.4003', { lang }),
|
|
146
|
-
),
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return FindFreeTableDto.fromEntities(
|
|
151
|
-
AppScreenRouter.getSimpleRoomTablePath(tableId),
|
|
152
|
-
player.id,
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
async manyTablesTournamentbBuyTicket(
|
|
157
|
-
clientAuthToken: string,
|
|
158
|
-
lang: string,
|
|
159
|
-
tournamentId: string,
|
|
160
|
-
): Promise<BaseAppScreenDto> {
|
|
161
|
-
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
162
|
-
const tournament =
|
|
163
|
-
this.manyTablesRoomsManagerService.getRoomByTableId(tournamentId);
|
|
164
|
-
const user = await this.usersRepository.findById(player?.id ?? '');
|
|
165
|
-
|
|
166
|
-
if (!player || !tournament || !user) {
|
|
167
|
-
throw new InternalServerErrorException();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (user.balance < tournament.getTicketPrice()) {
|
|
171
|
-
throw new NotEnoughMoneyForPurchaseException(
|
|
172
|
-
new ErrorSnackbarComponent(
|
|
173
|
-
ErrorCodeEnum.NOT_ENOUGH_MONEY_FOR_PURCHASE,
|
|
174
|
-
this.options.i18n.t('common.server.message.code.4004', { lang }),
|
|
175
|
-
),
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
await this.manyTablesRoomsManagerService.buyTicket(tournamentId, player);
|
|
180
|
-
|
|
181
|
-
return this.getScreen(lang, clientAuthToken);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Inject,
|
|
3
|
+
Injectable,
|
|
4
|
+
InternalServerErrorException,
|
|
5
|
+
} from '@nestjs/common';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import isToday from 'dayjs/plugin/isToday';
|
|
8
|
+
import { ActivityLogRepository, UsersRepository } from 'jp.db.schemas';
|
|
9
|
+
import {
|
|
10
|
+
SimpleRoom,
|
|
11
|
+
OneTableTournamentRoom,
|
|
12
|
+
ManyTablesTournamentRoom,
|
|
13
|
+
} from 'jp.ms.common.engine';
|
|
14
|
+
import {
|
|
15
|
+
AppScreenRoutesEnum,
|
|
16
|
+
ErrorSnackbarComponent,
|
|
17
|
+
AppScreenRouter,
|
|
18
|
+
} from 'jp.common.models';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
BaseAppScreenDto,
|
|
22
|
+
PlayerCheckStateDto,
|
|
23
|
+
FindFreeTableDto,
|
|
24
|
+
} from '../../dto';
|
|
25
|
+
import { SimpleRoomsManagerService } from '../simple-rooms-manager';
|
|
26
|
+
import { PlayersManagerService } from '../players-manager';
|
|
27
|
+
import { OneTableTournamentRoomsManagerService } from '../one-table-tournament-rooms-manager';
|
|
28
|
+
import { ManyTablesTournamentRoomsManagerService } from '../many-tables-tournament-rooms-manager';
|
|
29
|
+
import { EventsBusMainTablesSubscribeService } from '../event-bus/events-bus.main-tables.subscribe.service';
|
|
30
|
+
import {
|
|
31
|
+
ErrorCodeEnum,
|
|
32
|
+
NotEnoughMoneyForPurchaseException,
|
|
33
|
+
NotFoundFreeRoomForFastGameException,
|
|
34
|
+
} from '../../exception';
|
|
35
|
+
|
|
36
|
+
import { MainFactoryOptions } from './main.interfaces';
|
|
37
|
+
import { MAIN_OPTIONS } from './main.constants';
|
|
38
|
+
import { MainTablesListScreenView } from './main-tables-list-screen.view';
|
|
39
|
+
|
|
40
|
+
@Injectable()
|
|
41
|
+
export class MainService {
|
|
42
|
+
constructor(
|
|
43
|
+
private readonly simpleRoomsManager: SimpleRoomsManagerService,
|
|
44
|
+
private readonly oneTableRoomsManagerService: OneTableTournamentRoomsManagerService,
|
|
45
|
+
private readonly manyTablesRoomsManagerService: ManyTablesTournamentRoomsManagerService,
|
|
46
|
+
private readonly playersManager: PlayersManagerService,
|
|
47
|
+
private readonly eventsBusMainTablesSubscribeService: EventsBusMainTablesSubscribeService,
|
|
48
|
+
private readonly usersRepository: UsersRepository,
|
|
49
|
+
private readonly activityLogRepository: ActivityLogRepository,
|
|
50
|
+
@Inject(MAIN_OPTIONS) private readonly options: MainFactoryOptions,
|
|
51
|
+
) {
|
|
52
|
+
dayjs.extend(isToday);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getScreen(lang: string, clientAuthToken: string): BaseAppScreenDto {
|
|
56
|
+
return new BaseAppScreenDto(
|
|
57
|
+
new MainTablesListScreenView(
|
|
58
|
+
this.options.i18n,
|
|
59
|
+
lang,
|
|
60
|
+
this.simpleRoomsManager.getRooms(),
|
|
61
|
+
this.oneTableRoomsManagerService.getRooms(),
|
|
62
|
+
this.manyTablesRoomsManagerService.getRooms(),
|
|
63
|
+
clientAuthToken,
|
|
64
|
+
).buildBS(),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
subscribeOnTablesScreen(clientAuthToken: string): Promise<void> {
|
|
69
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
70
|
+
|
|
71
|
+
if (player) {
|
|
72
|
+
this.eventsBusMainTablesSubscribeService.addTablesSubscriber(player);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
throw new InternalServerErrorException();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
unsubscribeFromTablesScreen(clientAuthToken: string): Promise<void> {
|
|
79
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
80
|
+
|
|
81
|
+
if (player) {
|
|
82
|
+
this.eventsBusMainTablesSubscribeService.removeTablesSubbcriber(player);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
throw new InternalServerErrorException();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async playerCheckState(
|
|
89
|
+
clientAuthToken: string,
|
|
90
|
+
game: string,
|
|
91
|
+
): Promise<PlayerCheckStateDto> {
|
|
92
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
93
|
+
let redirectUrl: string = AppScreenRoutesEnum.MENU;
|
|
94
|
+
|
|
95
|
+
const foundUser = await this.usersRepository.findById(clientAuthToken);
|
|
96
|
+
const isNewbie =
|
|
97
|
+
await this.activityLogRepository.userIsNewbie(clientAuthToken);
|
|
98
|
+
const last7logins = await this.activityLogRepository.findLast7DaysLogins(
|
|
99
|
+
game,
|
|
100
|
+
clientAuthToken,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (!foundUser) {
|
|
104
|
+
throw new InternalServerErrorException();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (
|
|
108
|
+
player &&
|
|
109
|
+
(player.isPlayer() || player.isTableQueuer()) &&
|
|
110
|
+
player.tableId
|
|
111
|
+
) {
|
|
112
|
+
if (player.room instanceof SimpleRoom) {
|
|
113
|
+
redirectUrl = AppScreenRouter.getSimpleRoomTablePath(player.tableId);
|
|
114
|
+
} else if (player.room instanceof OneTableTournamentRoom) {
|
|
115
|
+
redirectUrl = AppScreenRouter.getOneTableTournamentTablePath(
|
|
116
|
+
player.tableId,
|
|
117
|
+
);
|
|
118
|
+
} else if (player.room instanceof ManyTablesTournamentRoom) {
|
|
119
|
+
redirectUrl = AppScreenRouter.getManyTablesTournamentTablePath(
|
|
120
|
+
player.tableId,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
} else if (isNewbie) {
|
|
124
|
+
redirectUrl = AppScreenRoutesEnum.WELCOME;
|
|
125
|
+
} else if (
|
|
126
|
+
dayjs(last7logins[0].date).isToday() &&
|
|
127
|
+
last7logins[0].count === 1
|
|
128
|
+
) {
|
|
129
|
+
redirectUrl = AppScreenRoutesEnum.DAILY_BONUS;
|
|
130
|
+
} else if (dayjs(foundUser.premiumExpired).isToday()) {
|
|
131
|
+
redirectUrl = AppScreenRoutesEnum.PREMIUM;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return PlayerCheckStateDto.fromEntities(redirectUrl, player?.id ?? '');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
findFreeTable(clientAuthToken: string, lang: string): FindFreeTableDto {
|
|
138
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
139
|
+
const tableId = this.simpleRoomsManager.getFreeFastGameRoom()?.getId();
|
|
140
|
+
|
|
141
|
+
if (!player || !tableId) {
|
|
142
|
+
throw new NotFoundFreeRoomForFastGameException(
|
|
143
|
+
new ErrorSnackbarComponent(
|
|
144
|
+
ErrorCodeEnum.NOT_FOUND_FREE_ROOM_FOR_FAST_GAME,
|
|
145
|
+
this.options.i18n.t('common.server.message.code.4003', { lang }),
|
|
146
|
+
),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return FindFreeTableDto.fromEntities(
|
|
151
|
+
AppScreenRouter.getSimpleRoomTablePath(tableId),
|
|
152
|
+
player.id,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async manyTablesTournamentbBuyTicket(
|
|
157
|
+
clientAuthToken: string,
|
|
158
|
+
lang: string,
|
|
159
|
+
tournamentId: string,
|
|
160
|
+
): Promise<BaseAppScreenDto> {
|
|
161
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
162
|
+
const tournament =
|
|
163
|
+
this.manyTablesRoomsManagerService.getRoomByTableId(tournamentId);
|
|
164
|
+
const user = await this.usersRepository.findById(player?.id ?? '');
|
|
165
|
+
|
|
166
|
+
if (!player || !tournament || !user) {
|
|
167
|
+
throw new InternalServerErrorException();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (user.balance < tournament.getTicketPrice()) {
|
|
171
|
+
throw new NotEnoughMoneyForPurchaseException(
|
|
172
|
+
new ErrorSnackbarComponent(
|
|
173
|
+
ErrorCodeEnum.NOT_ENOUGH_MONEY_FOR_PURCHASE,
|
|
174
|
+
this.options.i18n.t('common.server.message.code.4004', { lang }),
|
|
175
|
+
),
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
await this.manyTablesRoomsManagerService.buyTicket(tournamentId, player);
|
|
180
|
+
|
|
181
|
+
return this.getScreen(lang, clientAuthToken);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ManyTablesTournamentModule } from './many-tables-tournament.module';
|
|
1
|
+
export { ManyTablesTournamentModule } from './many-tables-tournament.module';
|
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import {
|
|
3
|
-
AppScreenIconEnum,
|
|
4
|
-
AppScreenIdEnum,
|
|
5
|
-
IAppScreen,
|
|
6
|
-
UniversalScreenView,
|
|
7
|
-
ILocaleService,
|
|
8
|
-
StandardScreenComponent,
|
|
9
|
-
StatusAppBarComponent,
|
|
10
|
-
StatusHeaderSectionComponent,
|
|
11
|
-
CardListSectionComponent,
|
|
12
|
-
ArrowBackButtonComponent,
|
|
13
|
-
IconImageComponent,
|
|
14
|
-
MiniCardSectionListItemComponent,
|
|
15
|
-
UrlImageComponent,
|
|
16
|
-
} from 'jp.common.models';
|
|
17
|
-
import {
|
|
18
|
-
formatChips,
|
|
19
|
-
formatDate,
|
|
20
|
-
formatTime,
|
|
21
|
-
replacePattern,
|
|
22
|
-
} from 'jp.common.utils';
|
|
23
|
-
import {
|
|
24
|
-
ManyTablesTournamentRoom,
|
|
25
|
-
TournamentMaster,
|
|
26
|
-
} from 'jp.ms.common.engine';
|
|
27
|
-
|
|
28
|
-
export class ManyTablesTournamentStatusScreenView extends UniversalScreenView {
|
|
29
|
-
private readonly tournament: ManyTablesTournamentRoom;
|
|
30
|
-
|
|
31
|
-
constructor(
|
|
32
|
-
localeService: ILocaleService,
|
|
33
|
-
lang: string,
|
|
34
|
-
tournament: ManyTablesTournamentRoom,
|
|
35
|
-
) {
|
|
36
|
-
super(localeService, lang);
|
|
37
|
-
this.tournament = tournament;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
build(): IAppScreen {
|
|
41
|
-
return new StandardScreenComponent(AppScreenIdEnum.ROOMS)
|
|
42
|
-
.addAppBar(
|
|
43
|
-
new StatusAppBarComponent(
|
|
44
|
-
this.tournament.getTitle(this.lang),
|
|
45
|
-
new ArrowBackButtonComponent(
|
|
46
|
-
this.localeService.t('common.button.back', { lang: this.lang }),
|
|
47
|
-
),
|
|
48
|
-
),
|
|
49
|
-
)
|
|
50
|
-
.addSection(this.getStatusHeader())
|
|
51
|
-
.addSection(new CardListSectionComponent('id1', this.getPlayersList()));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private getPlayersList(): Array<MiniCardSectionListItemComponent> {
|
|
55
|
-
if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
56
|
-
return this.tournament.getWinners().map(
|
|
57
|
-
(item) =>
|
|
58
|
-
new MiniCardSectionListItemComponent(
|
|
59
|
-
item.playerId,
|
|
60
|
-
item.playerName,
|
|
61
|
-
this.localeService.t(
|
|
62
|
-
'common.tournaments.status.screen.finish.description',
|
|
63
|
-
{
|
|
64
|
-
lang: this.lang,
|
|
65
|
-
args: {
|
|
66
|
-
RANK: item.rank.toString(),
|
|
67
|
-
PRIZE: formatChips(item.profit, this.lang, true),
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
),
|
|
71
|
-
new UrlImageComponent(item.playerAvatarUrl),
|
|
72
|
-
true,
|
|
73
|
-
true,
|
|
74
|
-
'',
|
|
75
|
-
),
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return this.tournament
|
|
80
|
-
.getParticipants()
|
|
81
|
-
.map(
|
|
82
|
-
(item) =>
|
|
83
|
-
new MiniCardSectionListItemComponent(
|
|
84
|
-
item.playerId,
|
|
85
|
-
item.playerName,
|
|
86
|
-
'',
|
|
87
|
-
new UrlImageComponent(item.playerAvatarUrl),
|
|
88
|
-
true,
|
|
89
|
-
true,
|
|
90
|
-
'',
|
|
91
|
-
),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private getStatusHeader(): StatusHeaderSectionComponent {
|
|
96
|
-
return new StatusHeaderSectionComponent(
|
|
97
|
-
'status',
|
|
98
|
-
this.getStatusDescription(),
|
|
99
|
-
new IconImageComponent(this.getStatusIcon()),
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
private getStatusIcon(): string {
|
|
104
|
-
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
105
|
-
return AppScreenIconEnum.INFO;
|
|
106
|
-
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
107
|
-
return AppScreenIconEnum.EMOJI_EVENTS;
|
|
108
|
-
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
109
|
-
return AppScreenIconEnum.HOURGLASS_EMPTY;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return '';
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private getStatusDescription(): string {
|
|
116
|
-
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
117
|
-
return this.localeService.t('common.tournaments.status.4', {
|
|
118
|
-
lang: this.lang,
|
|
119
|
-
});
|
|
120
|
-
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
121
|
-
return this.localeService.t('common.tournaments.status.3', {
|
|
122
|
-
lang: this.lang,
|
|
123
|
-
});
|
|
124
|
-
} else if (
|
|
125
|
-
this.tournament.getRoomMaster<TournamentMaster>().isInProgress()
|
|
126
|
-
) {
|
|
127
|
-
return this.localeService.t('common.tournaments.status.2', {
|
|
128
|
-
lang: this.lang,
|
|
129
|
-
});
|
|
130
|
-
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
131
|
-
return replacePattern(this.tournament.getSubtitle(this.lang), {
|
|
132
|
-
DATE: dayjs(this.tournament.getScheduleDate()).isToday()
|
|
133
|
-
? this.localeService.t('common.tournaments.status.today', {
|
|
134
|
-
lang: this.lang,
|
|
135
|
-
})
|
|
136
|
-
: formatDate(this.tournament.getScheduleDate() ?? ''),
|
|
137
|
-
SCHEDULE_DATE: formatTime(this.tournament.getScheduleDate() ?? ''),
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return '';
|
|
142
|
-
}
|
|
143
|
-
}
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import {
|
|
3
|
+
AppScreenIconEnum,
|
|
4
|
+
AppScreenIdEnum,
|
|
5
|
+
IAppScreen,
|
|
6
|
+
UniversalScreenView,
|
|
7
|
+
ILocaleService,
|
|
8
|
+
StandardScreenComponent,
|
|
9
|
+
StatusAppBarComponent,
|
|
10
|
+
StatusHeaderSectionComponent,
|
|
11
|
+
CardListSectionComponent,
|
|
12
|
+
ArrowBackButtonComponent,
|
|
13
|
+
IconImageComponent,
|
|
14
|
+
MiniCardSectionListItemComponent,
|
|
15
|
+
UrlImageComponent,
|
|
16
|
+
} from 'jp.common.models';
|
|
17
|
+
import {
|
|
18
|
+
formatChips,
|
|
19
|
+
formatDate,
|
|
20
|
+
formatTime,
|
|
21
|
+
replacePattern,
|
|
22
|
+
} from 'jp.common.utils';
|
|
23
|
+
import {
|
|
24
|
+
ManyTablesTournamentRoom,
|
|
25
|
+
TournamentMaster,
|
|
26
|
+
} from 'jp.ms.common.engine';
|
|
27
|
+
|
|
28
|
+
export class ManyTablesTournamentStatusScreenView extends UniversalScreenView {
|
|
29
|
+
private readonly tournament: ManyTablesTournamentRoom;
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
localeService: ILocaleService,
|
|
33
|
+
lang: string,
|
|
34
|
+
tournament: ManyTablesTournamentRoom,
|
|
35
|
+
) {
|
|
36
|
+
super(localeService, lang);
|
|
37
|
+
this.tournament = tournament;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
build(): IAppScreen {
|
|
41
|
+
return new StandardScreenComponent(AppScreenIdEnum.ROOMS)
|
|
42
|
+
.addAppBar(
|
|
43
|
+
new StatusAppBarComponent(
|
|
44
|
+
this.tournament.getTitle(this.lang),
|
|
45
|
+
new ArrowBackButtonComponent(
|
|
46
|
+
this.localeService.t('common.button.back', { lang: this.lang }),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
)
|
|
50
|
+
.addSection(this.getStatusHeader())
|
|
51
|
+
.addSection(new CardListSectionComponent('id1', this.getPlayersList()));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private getPlayersList(): Array<MiniCardSectionListItemComponent> {
|
|
55
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
56
|
+
return this.tournament.getWinners().map(
|
|
57
|
+
(item) =>
|
|
58
|
+
new MiniCardSectionListItemComponent(
|
|
59
|
+
item.playerId,
|
|
60
|
+
item.playerName,
|
|
61
|
+
this.localeService.t(
|
|
62
|
+
'common.tournaments.status.screen.finish.description',
|
|
63
|
+
{
|
|
64
|
+
lang: this.lang,
|
|
65
|
+
args: {
|
|
66
|
+
RANK: item.rank.toString(),
|
|
67
|
+
PRIZE: formatChips(item.profit, this.lang, true),
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
),
|
|
71
|
+
new UrlImageComponent(item.playerAvatarUrl),
|
|
72
|
+
true,
|
|
73
|
+
true,
|
|
74
|
+
'',
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return this.tournament
|
|
80
|
+
.getParticipants()
|
|
81
|
+
.map(
|
|
82
|
+
(item) =>
|
|
83
|
+
new MiniCardSectionListItemComponent(
|
|
84
|
+
item.playerId,
|
|
85
|
+
item.playerName,
|
|
86
|
+
'',
|
|
87
|
+
new UrlImageComponent(item.playerAvatarUrl),
|
|
88
|
+
true,
|
|
89
|
+
true,
|
|
90
|
+
'',
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private getStatusHeader(): StatusHeaderSectionComponent {
|
|
96
|
+
return new StatusHeaderSectionComponent(
|
|
97
|
+
'status',
|
|
98
|
+
this.getStatusDescription(),
|
|
99
|
+
new IconImageComponent(this.getStatusIcon()),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private getStatusIcon(): string {
|
|
104
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
105
|
+
return AppScreenIconEnum.INFO;
|
|
106
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
107
|
+
return AppScreenIconEnum.EMOJI_EVENTS;
|
|
108
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
109
|
+
return AppScreenIconEnum.HOURGLASS_EMPTY;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return '';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private getStatusDescription(): string {
|
|
116
|
+
if (this.tournament.getRoomMaster<TournamentMaster>().isCancelled()) {
|
|
117
|
+
return this.localeService.t('common.tournaments.status.4', {
|
|
118
|
+
lang: this.lang,
|
|
119
|
+
});
|
|
120
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isFinish()) {
|
|
121
|
+
return this.localeService.t('common.tournaments.status.3', {
|
|
122
|
+
lang: this.lang,
|
|
123
|
+
});
|
|
124
|
+
} else if (
|
|
125
|
+
this.tournament.getRoomMaster<TournamentMaster>().isInProgress()
|
|
126
|
+
) {
|
|
127
|
+
return this.localeService.t('common.tournaments.status.2', {
|
|
128
|
+
lang: this.lang,
|
|
129
|
+
});
|
|
130
|
+
} else if (this.tournament.getRoomMaster<TournamentMaster>().isWaiting()) {
|
|
131
|
+
return replacePattern(this.tournament.getSubtitle(this.lang), {
|
|
132
|
+
DATE: dayjs(this.tournament.getScheduleDate()).isToday()
|
|
133
|
+
? this.localeService.t('common.tournaments.status.today', {
|
|
134
|
+
lang: this.lang,
|
|
135
|
+
})
|
|
136
|
+
: formatDate(this.tournament.getScheduleDate() ?? ''),
|
|
137
|
+
SCHEDULE_DATE: formatTime(this.tournament.getScheduleDate() ?? ''),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
}
|