jp.ms.common.modules 1.0.34 → 1.0.35
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/config/cors.js.map +1 -1
- package/dist/config/database.js +1 -1
- package/dist/config/database.js.map +1 -1
- package/dist/config/locale.js +3 -3
- package/dist/config/locale.js.map +1 -1
- package/dist/config/menu.js +1 -1
- package/dist/config/menu.js.map +1 -1
- package/dist/dto/app-screen/app-screen-field-list-item.dto.js.map +1 -1
- package/dist/dto/app-screen/app-screen-field.dto.js.map +1 -1
- package/dist/dto/app-screen/app-screen-section-list-item.dto.js.map +1 -1
- package/dist/dto/app-screen/app-screen.dto.js +3 -1
- package/dist/dto/app-screen/app-screen.dto.js.map +1 -1
- package/dist/dto/app-screen/base-app-screen.dto.js +3 -1
- package/dist/dto/app-screen/base-app-screen.dto.js.map +1 -1
- package/dist/dto/app-table/card.dto.js.map +1 -1
- package/dist/dto/app-table/cards-deck.dto.d.ts +2 -2
- package/dist/dto/app-table/cards-deck.dto.js.map +1 -1
- package/dist/dto/app-table/cards-player.dto.js.map +1 -1
- package/dist/dto/common/find-free-table.dto.js.map +1 -1
- package/dist/dto/common/join-tournament.dto.js.map +1 -1
- package/dist/dto/common/many-tables-tournament-create.dto.js +3 -1
- package/dist/dto/common/many-tables-tournament-create.dto.js.map +1 -1
- package/dist/dto/common/player-check-state.dto.js.map +1 -1
- package/dist/dto/common/player-connected.dto.js.map +1 -1
- package/dist/dto/games/fool/fool-player.dto.d.ts +1 -1
- package/dist/dto/games/fool/fool-player.dto.js.map +1 -1
- package/dist/dto/games/fool/fool-table.dto.d.ts +4 -4
- package/dist/dto/games/fool/fool-table.dto.js +3 -1
- package/dist/dto/games/fool/fool-table.dto.js.map +1 -1
- package/dist/dto/index.js.map +1 -1
- package/dist/exception/error-code.enum.js.map +1 -1
- package/dist/exception/global-exception-filter.js +3 -9
- package/dist/exception/global-exception-filter.js.map +1 -1
- package/dist/exception/http-exception-wth-snackbar.js.map +1 -1
- package/dist/exception/index.js.map +1 -1
- package/dist/exception/not-enough-money-for-purchase.exception.js.map +1 -1
- package/dist/exception/not-found-free-room-for-fast-game.exception.js.map +1 -1
- package/dist/modules/anti-freeze-system/anti-freeze-system.module.d.ts +1 -1
- package/dist/modules/anti-freeze-system/anti-freeze-system.module.js +2 -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.js +4 -2
- package/dist/modules/anti-freeze-system/anti-freeze-system.service.js.map +1 -1
- package/dist/modules/base-achievements/base-achievements.module.d.ts +1 -1
- package/dist/modules/base-achievements/base-achievements.module.js +24 -16
- package/dist/modules/base-achievements/base-achievements.module.js.map +1 -1
- package/dist/modules/event-bus/events-bus.app.subscribe.service.js.map +1 -1
- package/dist/modules/event-bus/events-bus.main-tables.subscribe.service.d.ts +1 -1
- package/dist/modules/event-bus/events-bus.main-tables.subscribe.service.js.map +1 -1
- package/dist/modules/event-bus/events-bus.module.js +1 -1
- package/dist/modules/event-bus/events-bus.module.js.map +1 -1
- package/dist/modules/event-bus/events-bus.tournament.subscribe.service.js.map +1 -1
- package/dist/modules/events/events.gateway.js.map +1 -1
- package/dist/modules/events/events.module.js.map +1 -1
- package/dist/modules/index.d.ts +2 -2
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/logger/jp-logger.module.js.map +1 -1
- package/dist/modules/logger/jp-logger.service.d.ts +1 -1
- package/dist/modules/logger/jp-logger.service.js +1 -1
- package/dist/modules/logger/jp-logger.service.js.map +1 -1
- package/dist/modules/main/main-tables-list-screen.view.d.ts +2 -2
- package/dist/modules/main/main-tables-list-screen.view.js +32 -13
- package/dist/modules/main/main-tables-list-screen.view.js.map +1 -1
- package/dist/modules/main/main.controller.js.map +1 -1
- package/dist/modules/main/main.module.d.ts +1 -1
- package/dist/modules/main/main.module.js +8 -8
- package/dist/modules/main/main.module.js.map +1 -1
- package/dist/modules/main/main.service.js +5 -2
- package/dist/modules/main/main.service.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.d.ts +2 -2
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.js +20 -10
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.d.ts +2 -2
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.js +7 -2
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.constants.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.d.ts +3 -3
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js +5 -7
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.d.ts +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js +11 -3
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.d.ts +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js +3 -2
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js.map +1 -1
- package/dist/modules/menu/menu-screen.view.d.ts +2 -2
- package/dist/modules/menu/menu-screen.view.js +1 -1
- package/dist/modules/menu/menu-screen.view.js.map +1 -1
- package/dist/modules/menu/menu.controller.js.map +1 -1
- package/dist/modules/menu/menu.module.js.map +1 -1
- package/dist/modules/menu/menu.service.js +1 -1
- package/dist/modules/menu/menu.service.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.d.ts +2 -2
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.js +18 -10
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.constants.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.controller.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.d.ts +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.js +11 -3
- package/dist/modules/one-table-tournament/one-table-tournament.module.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.service.js.map +1 -1
- package/dist/modules/players-manager/players-manager.module.js +1 -1
- package/dist/modules/players-manager/players-manager.module.js.map +1 -1
- package/dist/modules/players-manager/players-manager.service.js.map +1 -1
- package/dist/modules/simple-rooms/simple-rooms.controller.js.map +1 -1
- package/dist/modules/simple-rooms/simple-rooms.module.js +4 -3
- package/dist/modules/simple-rooms/simple-rooms.module.js.map +1 -1
- package/dist/modules/simple-rooms/simple-rooms.service.js.map +1 -1
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.constants.js.map +1 -1
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.module.js +6 -2
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.module.js.map +1 -1
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.js +10 -5
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.js.map +1 -1
- package/dist/modules/support/dump.service.d.ts +1 -1
- package/dist/modules/support/dump.service.js +2 -3
- package/dist/modules/support/dump.service.js.map +1 -1
- package/dist/modules/support/metric.service.d.ts +1 -1
- package/dist/modules/support/metric.service.js +1 -1
- package/dist/modules/support/metric.service.js.map +1 -1
- package/dist/modules/support/support.controller.d.ts +2 -2
- package/dist/modules/support/support.controller.js +7 -7
- package/dist/modules/support/support.controller.js.map +1 -1
- package/dist/modules/support/support.module.js.map +1 -1
- package/dist/modules/support/support.service.d.ts +1 -1
- package/dist/modules/support/support.service.js +7 -3
- package/dist/modules/support/support.service.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.constants.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.js +12 -3
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.js +15 -10
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.js.map +1 -1
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.constants.js.map +1 -1
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.module.js +9 -2
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.module.js.map +1 -1
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.js +6 -6
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/game-table-result.js +17 -5
- package/dist/utils/game-table-result.js.map +1 -1
- package/dist/views/index.js.map +1 -1
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.d.ts +1 -1
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.js.map +1 -1
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.d.ts +1 -1
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.js.map +1 -1
- package/dist/views/simple-room-conifrm-exit-dialog.view.d.ts +1 -1
- package/dist/views/simple-room-conifrm-exit-dialog.view.js.map +1 -1
- package/dist/views/table-summary.view.d.ts +2 -2
- package/dist/views/table-summary.view.js +17 -5
- package/dist/views/table-summary.view.js.map +1 -1
- package/dist/views/tournament-buy-ticket-dialog.view.d.ts +1 -1
- package/dist/views/tournament-buy-ticket-dialog.view.js +7 -1
- package/dist/views/tournament-buy-ticket-dialog.view.js.map +1 -1
- package/package.json +16 -6
- package/src/config/cert.ts +1 -1
- package/src/config/cors.ts +2 -2
- package/src/config/database.ts +10 -8
- package/src/config/locale.ts +23 -18
- package/src/config/menu.ts +5 -5
- package/src/dto/app-screen/app-screen-field-list-item.dto.ts +33 -33
- package/src/dto/app-screen/app-screen-field.dto.ts +45 -45
- package/src/dto/app-screen/app-screen-section-list-item.dto.ts +84 -84
- package/src/dto/app-screen/app-screen.dto.ts +3 -1
- package/src/dto/app-screen/base-app-screen.dto.ts +3 -1
- package/src/dto/app-table/card.dto.ts +7 -1
- package/src/dto/app-table/cards-deck.dto.ts +18 -18
- package/src/dto/app-table/cards-player.dto.ts +5 -5
- package/src/dto/app-table/index.ts +1 -1
- package/src/dto/common/find-free-table.dto.ts +1 -1
- package/src/dto/common/index.ts +1 -1
- package/src/dto/common/join-tournament.dto.ts +25 -22
- package/src/dto/common/log.dto.ts +4 -4
- package/src/dto/common/many-tables-tournament-create.dto.ts +4 -2
- package/src/dto/common/player-check-state.dto.ts +25 -22
- package/src/dto/common/player-connected.dto.ts +45 -45
- package/src/dto/games/fool/fool-player.dto.ts +2 -2
- package/src/dto/games/fool/fool-table.dto.ts +65 -63
- package/src/dto/games/index.ts +1 -1
- package/src/dto/index.ts +3 -3
- package/src/exception/error-code.enum.ts +3 -3
- package/src/exception/global-exception-filter.ts +26 -23
- package/src/exception/http-exception-wth-snackbar.ts +18 -14
- package/src/exception/index.ts +2 -2
- package/src/exception/not-enough-money-for-purchase.exception.ts +8 -9
- package/src/exception/not-found-free-room-for-fast-game.exception.ts +8 -9
- package/src/index.ts +1 -1
- package/src/modules/anti-freeze-system/anti-freeze-system.interfaces.ts +8 -5
- package/src/modules/anti-freeze-system/anti-freeze-system.module.ts +48 -40
- package/src/modules/anti-freeze-system/anti-freeze-system.service.ts +81 -70
- package/src/modules/base-achievements/base-achievements.module.ts +198 -61
- package/src/modules/base-achievements/index.ts +1 -1
- package/src/modules/event-bus/events-bus.app.subscribe.service.ts +11 -12
- package/src/modules/event-bus/events-bus.main-tables.subscribe.service.ts +24 -24
- package/src/modules/event-bus/events-bus.many-tables-tournament.subscribe.service.ts +2 -2
- package/src/modules/event-bus/events-bus.module.ts +2 -2
- package/src/modules/event-bus/events-bus.one-table-tournament.subscribe.service.ts +2 -2
- package/src/modules/event-bus/events-bus.tournament.subscribe.service.ts +11 -12
- package/src/modules/event-bus/index.ts +1 -1
- package/src/modules/events/events.gateway.ts +51 -49
- package/src/modules/events/events.interfaces.ts +6 -5
- package/src/modules/events/events.module.ts +18 -19
- package/src/modules/index.ts +13 -7
- package/src/modules/logger/jp-logger.module.ts +2 -2
- package/src/modules/logger/jp-logger.service.ts +28 -22
- package/src/modules/main/main-tables-list-screen.view.ts +247 -201
- package/src/modules/main/main.controller.ts +64 -43
- package/src/modules/main/main.interfaces.ts +6 -4
- package/src/modules/main/main.module.ts +56 -39
- package/src/modules/main/main.service.ts +149 -105
- package/src/modules/many-tables-tournament/index.ts +1 -1
- package/src/modules/many-tables-tournament/many-tables-tournament-status-screen.view.ts +129 -111
- package/src/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.ts +57 -55
- package/src/modules/many-tables-tournament/many-tables-tournament.constants.ts +3 -1
- package/src/modules/many-tables-tournament/many-tables-tournament.controller.ts +131 -92
- package/src/modules/many-tables-tournament/many-tables-tournament.interfaces.ts +8 -5
- package/src/modules/many-tables-tournament/many-tables-tournament.module.ts +62 -35
- package/src/modules/many-tables-tournament/many-tables-tournament.service.ts +161 -126
- package/src/modules/menu/menu-screen.view.ts +64 -63
- package/src/modules/menu/menu.controller.ts +5 -6
- package/src/modules/menu/menu.interfaces.ts +6 -4
- package/src/modules/menu/menu.module.ts +28 -22
- package/src/modules/menu/menu.service.ts +21 -21
- package/src/modules/one-table-tournament/one-table-tournament-status-screen.view.ts +147 -138
- package/src/modules/one-table-tournament/one-table-tournament.constants.ts +3 -1
- package/src/modules/one-table-tournament/one-table-tournament.controller.ts +91 -60
- package/src/modules/one-table-tournament/one-table-tournament.interfaces.ts +8 -5
- package/src/modules/one-table-tournament/one-table-tournament.module.ts +58 -35
- package/src/modules/one-table-tournament/one-table-tournament.service.ts +103 -79
- package/src/modules/players-manager/players-manager.module.ts +1 -2
- package/src/modules/players-manager/players-manager.service.ts +5 -5
- package/src/modules/simple-rooms/simple-rooms.controller.ts +52 -43
- package/src/modules/simple-rooms/simple-rooms.interfaces.ts +8 -5
- package/src/modules/simple-rooms/simple-rooms.module.ts +26 -23
- package/src/modules/simple-rooms/simple-rooms.service.ts +62 -57
- package/src/modules/simple-rooms-manager/simple-rooms-manager.constants.ts +3 -1
- package/src/modules/simple-rooms-manager/simple-rooms-manager.interfaces.ts +10 -7
- package/src/modules/simple-rooms-manager/simple-rooms-manager.module.ts +44 -42
- package/src/modules/simple-rooms-manager/simple-rooms-manager.service.ts +163 -149
- package/src/modules/support/dump.service.ts +4 -5
- package/src/modules/support/metric.service.ts +29 -29
- package/src/modules/support/support.controller.ts +57 -48
- package/src/modules/support/support.module.ts +8 -9
- package/src/modules/support/support.service.ts +15 -12
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.constants.ts +3 -1
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.interfaces.ts +18 -9
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.ts +71 -52
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.ts +313 -266
- package/src/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.constants.ts +3 -1
- package/src/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.interfaces.ts +16 -9
- package/src/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.module.ts +50 -43
- package/src/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.ts +63 -43
- package/src/utils/date.ts +4 -4
- package/src/utils/game-table-result.ts +110 -91
- package/src/views/index.ts +1 -1
- package/src/views/many-tables-tournament-conifrm-exit-dialog.view.ts +33 -17
- package/src/views/one-table-tournament-conifrm-exit-dialog.view.ts +33 -17
- package/src/views/simple-room-conifrm-exit-dialog.view.ts +33 -17
- package/src/views/table-summary.view.ts +89 -76
- package/src/views/tournament-buy-ticket-dialog.view.ts +30 -17
- package/readme.md +0 -3
|
@@ -2,294 +2,341 @@ import { InjectConnection } from '@nestjs/mongoose';
|
|
|
2
2
|
import { Connection } from 'mongoose';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import schedule, { Job } from 'node-schedule';
|
|
5
|
-
import { Inject, Injectable, InternalServerErrorException } from '@nestjs/common';
|
|
6
5
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
Inject,
|
|
7
|
+
Injectable,
|
|
8
|
+
InternalServerErrorException,
|
|
9
|
+
} from '@nestjs/common';
|
|
10
|
+
import {
|
|
11
|
+
BaseGameEvent,
|
|
12
|
+
GameMaster,
|
|
13
|
+
GamePlayer,
|
|
14
|
+
GameTableFinishedEvent,
|
|
15
|
+
GameTournamentCancelledEvent,
|
|
16
|
+
GameTournamentFinishedEvent,
|
|
17
|
+
GameTournamentPlayerJoinedTheTournamentEvent,
|
|
18
|
+
GameTournamentPlayerLeavedTheTournamentEvent,
|
|
19
|
+
GameTournamentStartedEvent,
|
|
20
|
+
GameTournamentWaitedEvent,
|
|
21
|
+
ManyTablesTournamentRoom,
|
|
22
|
+
ManyTablesTournamentRoomConfig,
|
|
23
|
+
NoStartStrategy,
|
|
24
|
+
RoomUpdateStateEvent,
|
|
25
|
+
TournamentMaster,
|
|
22
26
|
} from 'jp.ms.common.engine';
|
|
23
27
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
GameResultRepository,
|
|
29
|
+
PurchaseRepository,
|
|
30
|
+
TournamentManyTablesRoomDocument,
|
|
31
|
+
TournamentManyTablesRoomsRepository,
|
|
32
|
+
UsersRepository,
|
|
29
33
|
} from 'jp.db.schemas';
|
|
30
34
|
|
|
31
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
saveGameTablesResult,
|
|
37
|
+
saveTournamentResult,
|
|
38
|
+
} from '../../utils/game-table-result';
|
|
32
39
|
import { JpLoggerService } from '../logger';
|
|
33
40
|
import { getHours, getMinutes } from '../../utils/date';
|
|
34
41
|
import { ManyTablesTournamentCreateDto } from '../../dto/common/many-tables-tournament-create.dto';
|
|
35
42
|
import { ManyTablesTournamentUpdateDto } from '../../dto/common/many-tables-tournament-update.dto';
|
|
36
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
EventsBusMainTablesSubscribeService,
|
|
45
|
+
EventsBusManyTablesTournamentSubscribeService,
|
|
46
|
+
} from '../event-bus';
|
|
37
47
|
|
|
38
48
|
import { TOURNAMENT_MANY_TABLES_ROOMS_MANAGER_OPTIONS } from './tournament-many-tables-rooms-manager.constants';
|
|
39
49
|
import { TournamentManyTablesRoomsFactoryOptions } from './tournament-many-tables-rooms-manager.interfaces';
|
|
40
50
|
|
|
41
|
-
|
|
42
51
|
@Injectable()
|
|
43
52
|
export class TournamentManyTablesRoomsManagerService {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
private readonly rooms: Map<string, ManyTablesTournamentRoom>;
|
|
54
|
+
private createDailyTournamentJob: Job | null;
|
|
55
|
+
|
|
56
|
+
constructor(
|
|
57
|
+
private readonly tournamentRepository: TournamentManyTablesRoomsRepository,
|
|
58
|
+
private readonly usersRepository: UsersRepository,
|
|
59
|
+
private readonly gameResultRepository: GameResultRepository,
|
|
60
|
+
private readonly purchaseRepository: PurchaseRepository,
|
|
61
|
+
private readonly eventsBusMainTablesSubscribeService: EventsBusMainTablesSubscribeService,
|
|
62
|
+
private readonly eventsBusManyTablesTournamentSubscribeService: EventsBusManyTablesTournamentSubscribeService,
|
|
63
|
+
@Inject(TOURNAMENT_MANY_TABLES_ROOMS_MANAGER_OPTIONS)
|
|
64
|
+
private readonly options: TournamentManyTablesRoomsFactoryOptions,
|
|
65
|
+
@InjectConnection() private readonly connection: Connection,
|
|
66
|
+
@Inject() private readonly logger: JpLoggerService,
|
|
67
|
+
) {
|
|
68
|
+
this.rooms = new Map<string, ManyTablesTournamentRoom>();
|
|
69
|
+
this.createDailyTournamentJob = null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get gameType() {
|
|
73
|
+
return this.options.configService.get<string>('GAME_TYPE') || '';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getRoomById(roomId: string): ManyTablesTournamentRoom | undefined {
|
|
77
|
+
return this.rooms.get(roomId);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getRoomByTableId(tableId: string): ManyTablesTournamentRoom | undefined {
|
|
81
|
+
const { roomId } = GameMaster.parseTableId(tableId);
|
|
82
|
+
|
|
83
|
+
return this.getRoomById(roomId);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
getRooms(): Array<ManyTablesTournamentRoom> {
|
|
87
|
+
return Array.from(this.rooms.values());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getTables(): Array<GameMaster> {
|
|
91
|
+
return this.getRooms().reduce((result, currentValue) => {
|
|
92
|
+
return [...result, ...currentValue.getMasters()];
|
|
93
|
+
}, [] as Array<GameMaster>);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
addRoom(room: ManyTablesTournamentRoom) {
|
|
97
|
+
this.rooms.set(room.getId(), room);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async hydrateTournamentsFromDB() {
|
|
101
|
+
const templates = await this.tournamentRepository.findActualTournaments(
|
|
102
|
+
this.gameType,
|
|
103
|
+
);
|
|
104
|
+
templates.forEach((item) => {
|
|
105
|
+
this.addRoom(
|
|
106
|
+
this.options.createTournamentRoom(
|
|
107
|
+
this.manyTablesTournamentDocumentToTournamentRoom(item),
|
|
108
|
+
),
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async runDailyTournamentJob() {
|
|
114
|
+
const dailyTournamentScheduleTaskTime =
|
|
115
|
+
this.options.configService.get<string>(
|
|
116
|
+
'DAILY_TOURNAMENT_SCHEDULE_TASK_TIME',
|
|
117
|
+
);
|
|
118
|
+
const dailyTournamentTime = this.options.configService.get<string>(
|
|
119
|
+
'DAILY_TOURNAMENT_TIME',
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (dailyTournamentScheduleTaskTime && dailyTournamentTime) {
|
|
123
|
+
await this.createDailyTournament(dailyTournamentTime);
|
|
124
|
+
|
|
125
|
+
this.createDailyTournamentJob = schedule.scheduleJob(
|
|
126
|
+
dailyTournamentScheduleTaskTime,
|
|
127
|
+
() => this.createDailyTournament(dailyTournamentTime),
|
|
128
|
+
);
|
|
64
129
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async createTournament(createTournamentDto: ManyTablesTournamentCreateDto) {
|
|
133
|
+
const newTournament =
|
|
134
|
+
await this.tournamentRepository.createTournament(createTournamentDto);
|
|
135
|
+
|
|
136
|
+
this.addRoom(
|
|
137
|
+
this.options.createTournamentRoom(
|
|
138
|
+
this.manyTablesTournamentDocumentToTournamentRoom(newTournament),
|
|
139
|
+
),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async updateTournament(
|
|
144
|
+
tournamentId: string,
|
|
145
|
+
updateTournamentDto: ManyTablesTournamentUpdateDto,
|
|
146
|
+
) {
|
|
147
|
+
const updatedTournament = await this.tournamentRepository.updateTournament(
|
|
148
|
+
tournamentId,
|
|
149
|
+
updateTournamentDto,
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
this.getRoomById(tournamentId)
|
|
153
|
+
?.getRoomMaster<TournamentMaster>()
|
|
154
|
+
.cancelTournament();
|
|
155
|
+
|
|
156
|
+
this.addRoom(
|
|
157
|
+
this.options.createTournamentRoom(
|
|
158
|
+
this.manyTablesTournamentDocumentToTournamentRoom(updatedTournament),
|
|
159
|
+
),
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async removeTournament(tournamentId: string) {
|
|
164
|
+
await this.tournamentRepository.removeTournament(tournamentId);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async buyTicket(tournamentId: string, player: GamePlayer) {
|
|
168
|
+
const tournament = this.getRoomById(tournamentId);
|
|
169
|
+
const user = await this.usersRepository.findById(player.id);
|
|
170
|
+
|
|
171
|
+
if (!tournament || !user) {
|
|
172
|
+
throw new InternalServerErrorException();
|
|
74
173
|
}
|
|
75
174
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
175
|
+
const session = await this.connection.startSession();
|
|
176
|
+
session.startTransaction();
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
player.decreaseBalance(tournament.getTicketPrice());
|
|
180
|
+
tournament.addParticipant(player);
|
|
181
|
+
void this.purchaseRepository.addManyTablesTournamentTicketPurchase(
|
|
182
|
+
player.id,
|
|
183
|
+
player.fullName,
|
|
184
|
+
tournamentId,
|
|
185
|
+
tournament.getTicketPrice(),
|
|
186
|
+
tournament.getGameType(),
|
|
187
|
+
);
|
|
188
|
+
void this.usersRepository.subtractFromBalance(
|
|
189
|
+
player.id,
|
|
190
|
+
tournament.getTicketPrice(),
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
await this.tournamentRepository.addPlayerToParticipants(tournamentId, {
|
|
194
|
+
playerId: player.id,
|
|
195
|
+
playerAvatarUrl: player.avatarUrl,
|
|
196
|
+
playerName: player.fullName,
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
await session.commitTransaction();
|
|
200
|
+
} catch (error) {
|
|
201
|
+
await session.abortTransaction();
|
|
202
|
+
throw error;
|
|
203
|
+
} finally {
|
|
204
|
+
await session.endSession();
|
|
87
205
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.getRoomById(tournamentId)?.getRoomMaster<TournamentMaster>().cancelTournament();
|
|
128
|
-
|
|
129
|
-
this.addRoom(this.options.createTournamentRoom(
|
|
130
|
-
this.manyTablesTournamentDocumentToTournamentRoom(updatedTournament)
|
|
131
|
-
));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async removeTournament (tournamentId: string) {
|
|
135
|
-
await this.tournamentRepository.removeTournament(tournamentId);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
async buyTicket (tournamentId: string, player: GamePlayer) {
|
|
139
|
-
const tournament = this.getRoomById(tournamentId);
|
|
140
|
-
const user = await this.usersRepository.findById(player.id);
|
|
141
|
-
|
|
142
|
-
if (!tournament || !user) {
|
|
143
|
-
throw new InternalServerErrorException();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const session = await this.connection.startSession();
|
|
147
|
-
session.startTransaction();
|
|
148
|
-
|
|
149
|
-
try {
|
|
150
|
-
player.decreaseBalance(tournament.getTicketPrice());
|
|
151
|
-
tournament.addParticipant(player);
|
|
152
|
-
this.purchaseRepository.addManyTablesTournamentTicketPurchase(
|
|
153
|
-
player.id,
|
|
154
|
-
player.fullName,
|
|
155
|
-
tournamentId,
|
|
156
|
-
tournament.getTicketPrice(),
|
|
157
|
-
tournament.getGameType(),
|
|
158
|
-
)
|
|
159
|
-
this.usersRepository.subtractFromBalance(player.id, tournament.getTicketPrice());
|
|
160
|
-
|
|
161
|
-
await this.tournamentRepository.addPlayerToParticipants(tournamentId, {
|
|
162
|
-
playerId: player.id,
|
|
163
|
-
playerAvatarUrl: player.avatarUrl,
|
|
164
|
-
playerName: player.fullName,
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
await session.commitTransaction();
|
|
168
|
-
} catch (error) {
|
|
169
|
-
await session.abortTransaction();
|
|
170
|
-
throw error;
|
|
171
|
-
} finally {
|
|
172
|
-
await session.endSession();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
private manyTablesTournamentDocumentToTournamentRoom (tournamentDocument: TournamentManyTablesRoomDocument): ManyTablesTournamentRoomConfig {
|
|
177
|
-
const restartGameTimeout = this.options.configService.get<number>('RESTART_GAME_TIMEOUT') || 0;
|
|
178
|
-
const playersTurnTimeout = this.options.configService.get<number>('PLAYERS_TURN_TIMEOUT') || 0;
|
|
179
|
-
const minPlayersForMergeTables = this.options.configService.get<string>('TOURNAMENT_MANY_TABLES_MIN_PLAYERS_FOR_MERGE_TABLES');
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
id: tournamentDocument.tournamentId,
|
|
183
|
-
gameType: tournamentDocument.gameType,
|
|
184
|
-
roomType: tournamentDocument.roomType,
|
|
185
|
-
rulesType: tournamentDocument.rulesType,
|
|
186
|
-
deckType: tournamentDocument.deckType,
|
|
187
|
-
tableSize: tournamentDocument.tableSize,
|
|
188
|
-
bet: tournamentDocument.bet,
|
|
189
|
-
ticketPrice: tournamentDocument.ticketPrice,
|
|
190
|
-
title: tournamentDocument.title,
|
|
191
|
-
subtitle: tournamentDocument.subtitle,
|
|
192
|
-
description: tournamentDocument.description,
|
|
193
|
-
enableForFastGame: false,
|
|
194
|
-
scheduleDate: tournamentDocument.scheduleDate,
|
|
195
|
-
turnTimeout: playersTurnTimeout,
|
|
196
|
-
restartTimeout: restartGameTimeout,
|
|
197
|
-
minPlayersForMergeTables: parseInt(minPlayersForMergeTables ?? '0', 10),
|
|
198
|
-
localeService: this.options.i18n,
|
|
199
|
-
startStrategy: new NoStartStrategy(),
|
|
200
|
-
onRoomEvent: this.handleRoomEvent,
|
|
201
|
-
tournamentPrizeTable: this.options.tournamentPrizeTable,
|
|
202
|
-
tournamentInitialStatus: tournamentDocument.status,
|
|
203
|
-
tournamentWinners: tournamentDocument.winners,
|
|
204
|
-
maxParticipants: tournamentDocument.maxParticipants,
|
|
205
|
-
participants: tournamentDocument.participants,
|
|
206
|
-
} as ManyTablesTournamentRoomConfig;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
private handleRoomEvent = (event: BaseGameEvent) => {
|
|
210
|
-
this.logger.log(event.toLog());
|
|
211
|
-
|
|
212
|
-
if (event instanceof GameTableFinishedEvent) {
|
|
213
|
-
this.handleRoomTableGameFinished(event.master!!);
|
|
214
|
-
} else if (event instanceof GameTournamentStartedEvent) {
|
|
215
|
-
this.handleTournamentRoomStarted(event.room.getRoomMaster());
|
|
216
|
-
} else if (event instanceof GameTournamentCancelledEvent) {
|
|
217
|
-
this.handleTournamentRoomCancelled(event.room.getRoomMaster());
|
|
218
|
-
} else if (event instanceof GameTournamentFinishedEvent) {
|
|
219
|
-
this.handleTournamentRoomFinished(event.room.getRoomMaster());
|
|
220
|
-
} else if (
|
|
221
|
-
event instanceof GameTournamentPlayerJoinedTheTournamentEvent ||
|
|
222
|
-
event instanceof GameTournamentPlayerLeavedTheTournamentEvent ||
|
|
223
|
-
event instanceof GameTournamentCancelledEvent ||
|
|
224
|
-
event instanceof GameTournamentWaitedEvent ||
|
|
225
|
-
event instanceof GameTournamentStartedEvent ||
|
|
226
|
-
event instanceof GameTournamentFinishedEvent
|
|
227
|
-
) {
|
|
228
|
-
this.handleRoomStatusUpdated(new RoomUpdateStateEvent(event.gameType, event.roomId));
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
private handleRoomTableGameFinished = async (master: GameMaster) => {
|
|
233
|
-
await saveGameTablesResult(
|
|
234
|
-
master,
|
|
235
|
-
this.connection,
|
|
236
|
-
this.gameResultRepository,
|
|
237
|
-
this.usersRepository,
|
|
238
|
-
false,
|
|
239
|
-
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
private manyTablesTournamentDocumentToTournamentRoom(
|
|
209
|
+
tournamentDocument: TournamentManyTablesRoomDocument,
|
|
210
|
+
): ManyTablesTournamentRoomConfig {
|
|
211
|
+
const restartGameTimeout =
|
|
212
|
+
this.options.configService.get<number>('RESTART_GAME_TIMEOUT') || 0;
|
|
213
|
+
const playersTurnTimeout =
|
|
214
|
+
this.options.configService.get<number>('PLAYERS_TURN_TIMEOUT') || 0;
|
|
215
|
+
const minPlayersForMergeTables = this.options.configService.get<string>(
|
|
216
|
+
'TOURNAMENT_MANY_TABLES_MIN_PLAYERS_FOR_MERGE_TABLES',
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
id: tournamentDocument.tournamentId,
|
|
221
|
+
gameType: tournamentDocument.gameType,
|
|
222
|
+
roomType: tournamentDocument.roomType,
|
|
223
|
+
rulesType: tournamentDocument.rulesType,
|
|
224
|
+
deckType: tournamentDocument.deckType,
|
|
225
|
+
tableSize: tournamentDocument.tableSize,
|
|
226
|
+
bet: tournamentDocument.bet,
|
|
227
|
+
ticketPrice: tournamentDocument.ticketPrice,
|
|
228
|
+
title: tournamentDocument.title,
|
|
229
|
+
subtitle: tournamentDocument.subtitle,
|
|
230
|
+
description: tournamentDocument.description,
|
|
231
|
+
enableForFastGame: false,
|
|
232
|
+
scheduleDate: tournamentDocument.scheduleDate,
|
|
233
|
+
turnTimeout: playersTurnTimeout,
|
|
234
|
+
restartTimeout: restartGameTimeout,
|
|
235
|
+
minPlayersForMergeTables: parseInt(minPlayersForMergeTables ?? '0', 10),
|
|
236
|
+
localeService: this.options.i18n,
|
|
237
|
+
startStrategy: new NoStartStrategy(),
|
|
238
|
+
onRoomEvent: this.handleRoomEvent,
|
|
239
|
+
tournamentPrizeTable: this.options.tournamentPrizeTable,
|
|
240
|
+
tournamentInitialStatus: tournamentDocument.status,
|
|
241
|
+
tournamentWinners: tournamentDocument.winners,
|
|
242
|
+
maxParticipants: tournamentDocument.maxParticipants,
|
|
243
|
+
participants: tournamentDocument.participants,
|
|
240
244
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private handleRoomEvent = (event: BaseGameEvent) => {
|
|
248
|
+
this.logger.log(event.toLog());
|
|
249
|
+
|
|
250
|
+
if (event instanceof GameTableFinishedEvent) {
|
|
251
|
+
void this.handleRoomTableGameFinished(event.master);
|
|
252
|
+
} else if (event instanceof GameTournamentStartedEvent) {
|
|
253
|
+
void this.handleTournamentRoomStarted(event.room.getRoomMaster());
|
|
254
|
+
} else if (event instanceof GameTournamentCancelledEvent) {
|
|
255
|
+
void this.handleTournamentRoomCancelled(event.room.getRoomMaster());
|
|
256
|
+
} else if (event instanceof GameTournamentFinishedEvent) {
|
|
257
|
+
void this.handleTournamentRoomFinished(event.room.getRoomMaster());
|
|
258
|
+
} else if (
|
|
259
|
+
event instanceof GameTournamentPlayerJoinedTheTournamentEvent ||
|
|
260
|
+
event instanceof GameTournamentPlayerLeavedTheTournamentEvent ||
|
|
261
|
+
event instanceof GameTournamentCancelledEvent ||
|
|
262
|
+
event instanceof GameTournamentWaitedEvent ||
|
|
263
|
+
event instanceof GameTournamentStartedEvent ||
|
|
264
|
+
event instanceof GameTournamentFinishedEvent
|
|
265
|
+
) {
|
|
266
|
+
void this.handleRoomStatusUpdated(
|
|
267
|
+
new RoomUpdateStateEvent(event.gameType, event.roomId),
|
|
268
|
+
);
|
|
262
269
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
private handleRoomTableGameFinished = async (master: GameMaster) => {
|
|
273
|
+
await saveGameTablesResult(
|
|
274
|
+
master,
|
|
275
|
+
this.connection,
|
|
276
|
+
this.gameResultRepository,
|
|
277
|
+
this.usersRepository,
|
|
278
|
+
false,
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
private handleTournamentRoomStarted = async (master: TournamentMaster) => {
|
|
283
|
+
await this.tournamentRepository.startTournament(master.getTournamentId());
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
private handleTournamentRoomCancelled = async (master: TournamentMaster) => {
|
|
287
|
+
await this.tournamentRepository.cancelTournament(master.getTournamentId());
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
private handleTournamentRoomFinished = async (master: TournamentMaster) => {
|
|
291
|
+
await saveTournamentResult(
|
|
292
|
+
master,
|
|
293
|
+
this.connection,
|
|
294
|
+
this.tournamentRepository,
|
|
295
|
+
this.usersRepository,
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
private handleRoomStatusUpdated = (event: RoomUpdateStateEvent) => {
|
|
300
|
+
this.eventsBusMainTablesSubscribeService.pushNewRoomState(event);
|
|
301
|
+
this.eventsBusManyTablesTournamentSubscribeService.pushNewRoomState(event);
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
private createDailyTournament = async (dailyTournamentTime: string) => {
|
|
305
|
+
const hour = getHours(dailyTournamentTime);
|
|
306
|
+
const minutes = getMinutes(dailyTournamentTime);
|
|
307
|
+
const jobEveningDate = dayjs()
|
|
308
|
+
.set('hour', hour)
|
|
309
|
+
.set('minute', minutes)
|
|
310
|
+
.set('second', 0);
|
|
311
|
+
const addingDay = dayjs().isBefore(jobEveningDate) ? 0 : 1;
|
|
312
|
+
|
|
313
|
+
const startDate = dayjs().add(addingDay, 'day').startOf('day');
|
|
314
|
+
const endDate = dayjs().add(addingDay, 'day').endOf('day');
|
|
315
|
+
|
|
316
|
+
const tournamentDate = dayjs()
|
|
317
|
+
.add(addingDay, 'day')
|
|
318
|
+
.set('hour', hour)
|
|
319
|
+
.set('minute', minutes);
|
|
320
|
+
|
|
321
|
+
const waitedTournament =
|
|
322
|
+
await this.tournamentRepository.findWaitingTournamentByDate(
|
|
323
|
+
this.gameType,
|
|
324
|
+
startDate.toDate(),
|
|
325
|
+
endDate.toDate(),
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
if (!waitedTournament) {
|
|
329
|
+
const newTournament =
|
|
330
|
+
await this.tournamentRepository.scheduleTournamentFromMasterTemplate(
|
|
331
|
+
this.gameType,
|
|
332
|
+
tournamentDate.toDate(),
|
|
282
333
|
);
|
|
283
334
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
this.addRoom(this.options.createTournamentRoom(
|
|
291
|
-
this.manyTablesTournamentDocumentToTournamentRoom(newTournament)
|
|
292
|
-
));
|
|
293
|
-
}
|
|
335
|
+
this.addRoom(
|
|
336
|
+
this.options.createTournamentRoom(
|
|
337
|
+
this.manyTablesTournamentDocumentToTournamentRoom(newTournament),
|
|
338
|
+
),
|
|
339
|
+
);
|
|
294
340
|
}
|
|
341
|
+
};
|
|
295
342
|
}
|
|
@@ -3,18 +3,25 @@ import { I18nService } from 'nestjs-i18n';
|
|
|
3
3
|
import { Type } from '@nestjs/common/interfaces/type.interface';
|
|
4
4
|
import { DynamicModule } from '@nestjs/common/interfaces/modules/dynamic-module.interface';
|
|
5
5
|
import { ForwardReference } from '@nestjs/common/interfaces/modules/forward-reference.interface';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
TournamentRoomConfig,
|
|
8
|
+
OneTableTournamentRoom,
|
|
9
|
+
IPrizeTableData,
|
|
10
|
+
} from 'jp.ms.common.engine';
|
|
7
11
|
import { ConfigService } from '@nestjs/config';
|
|
8
12
|
|
|
9
|
-
export interface TournamentOneTableRoomsManagerOptions
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
export interface TournamentOneTableRoomsManagerOptions
|
|
14
|
+
extends Pick<ModuleMetadata, 'imports'> {
|
|
15
|
+
imports?: Array<
|
|
16
|
+
Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference
|
|
17
|
+
>;
|
|
18
|
+
inject?: any[];
|
|
19
|
+
useFactory?: (...args: any[]) => Promise<any> | any;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
export interface TournamentOneTableRoomsFactoryOptions {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
i18n: I18nService;
|
|
24
|
+
configService: ConfigService;
|
|
25
|
+
tournamentPrizeTable: IPrizeTableData;
|
|
26
|
+
createTournamentRoom(room: TournamentRoomConfig): OneTableTournamentRoom;
|
|
20
27
|
}
|