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
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { DynamicModule, Module, Provider } from '@nestjs/common';
|
|
2
2
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
TournamentOneTableRoom,
|
|
5
|
+
TournamentOneTableRoomSchema,
|
|
6
|
+
TournamentOneTableRoomsRepository,
|
|
7
|
+
} from 'jp.db.schemas';
|
|
8
|
+
import {
|
|
9
|
+
GamePlayer,
|
|
10
|
+
OneTableTournamentUpdateStatusWsEvent,
|
|
11
|
+
RoomUpdateStateEvent,
|
|
12
|
+
} from 'jp.ms.common.engine';
|
|
5
13
|
|
|
6
14
|
import { TournamentOneTableRoomsManagerService } from '../tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service';
|
|
7
15
|
import { EventsBusOneTableTournamentSubscribeService } from '../event-bus';
|
|
@@ -12,42 +20,57 @@ import { ONE_TABLE_TOURNAMENT_OPTIONS } from './one-table-tournament.constants';
|
|
|
12
20
|
import { OneTableTournamentModuleOptions } from './one-table-tournament.interfaces';
|
|
13
21
|
|
|
14
22
|
@Module({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
imports: [
|
|
24
|
+
MongooseModule.forFeature([
|
|
25
|
+
{
|
|
26
|
+
name: TournamentOneTableRoom.name,
|
|
27
|
+
schema: TournamentOneTableRoomSchema,
|
|
28
|
+
},
|
|
29
|
+
]),
|
|
30
|
+
],
|
|
31
|
+
controllers: [OneTableTournamentController],
|
|
32
|
+
providers: [OneTableTournamentService, TournamentOneTableRoomsRepository],
|
|
20
33
|
})
|
|
21
34
|
export class OneTableTournamentModule {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
constructor(
|
|
36
|
+
private readonly oneTableRoomsManagerService: TournamentOneTableRoomsManagerService,
|
|
37
|
+
private readonly eventsBusOneTableTournamentSubscribeService: EventsBusOneTableTournamentSubscribeService,
|
|
38
|
+
private readonly oneTableTournamentService: OneTableTournamentService,
|
|
39
|
+
) {}
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
static forRootAsync(options: OneTableTournamentModuleOptions): DynamicModule {
|
|
42
|
+
return {
|
|
43
|
+
module: OneTableTournamentModule,
|
|
44
|
+
imports: options.imports ?? [],
|
|
45
|
+
providers: [
|
|
46
|
+
{
|
|
47
|
+
provide: ONE_TABLE_TOURNAMENT_OPTIONS,
|
|
48
|
+
useFactory: options.useFactory,
|
|
49
|
+
inject: options.inject || [],
|
|
50
|
+
} as Provider,
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
onModuleInit() {
|
|
56
|
+
this.eventsBusOneTableTournamentSubscribeService.subscribe(
|
|
57
|
+
this.onHandleStatusRoomChange,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
45
60
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
private onHandleStatusRoomChange = (event: RoomUpdateStateEvent) => {
|
|
62
|
+
this.oneTableRoomsManagerService
|
|
63
|
+
.getRoomById(event.roomId)
|
|
64
|
+
?.getStatusScreenWatchers()
|
|
65
|
+
.forEach((subscriber: GamePlayer) => {
|
|
66
|
+
const screen = this.oneTableTournamentService.getStatusScreen(
|
|
67
|
+
event.roomId,
|
|
68
|
+
subscriber.language,
|
|
69
|
+
subscriber.id,
|
|
70
|
+
);
|
|
71
|
+
subscriber.sendMessage(
|
|
72
|
+
new OneTableTournamentUpdateStatusWsEvent(event.game, screen.screen),
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
52
76
|
}
|
|
53
|
-
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { Inject, Injectable, InternalServerErrorException } from '@nestjs/common';
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Inject,
|
|
3
|
+
Injectable,
|
|
4
|
+
InternalServerErrorException,
|
|
5
|
+
} from '@nestjs/common';
|
|
6
|
+
import {
|
|
7
|
+
IAppHeaders,
|
|
8
|
+
IBaseAppScreen,
|
|
9
|
+
IBaseMoveData,
|
|
10
|
+
IAppTableState,
|
|
7
11
|
} from 'jp.common.models';
|
|
8
12
|
|
|
9
13
|
import { BaseAppScreenDto } from '../../dto';
|
|
@@ -16,107 +20,127 @@ import { OneTableTournamentStatusScreenView } from './one-table-tournament-statu
|
|
|
16
20
|
|
|
17
21
|
@Injectable()
|
|
18
22
|
export class OneTableTournamentService {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
constructor(
|
|
24
|
+
private readonly oneTableRoomsManagerService: TournamentOneTableRoomsManagerService,
|
|
25
|
+
private readonly playersManager: PlayersManagerService,
|
|
26
|
+
@Inject(ONE_TABLE_TOURNAMENT_OPTIONS)
|
|
27
|
+
private readonly options: OneTableTournamentFactoryOptions,
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
getStatusScreen(
|
|
31
|
+
tournamentId: string,
|
|
32
|
+
lang: string,
|
|
33
|
+
playerId: string,
|
|
34
|
+
): BaseAppScreenDto {
|
|
35
|
+
const tournament =
|
|
36
|
+
this.oneTableRoomsManagerService.getRoomById(tournamentId);
|
|
37
|
+
|
|
38
|
+
if (!tournament) {
|
|
39
|
+
throw new InternalServerErrorException();
|
|
24
40
|
}
|
|
25
41
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
return new BaseAppScreenDto(
|
|
43
|
+
new OneTableTournamentStatusScreenView(
|
|
44
|
+
this.options.i18n,
|
|
45
|
+
lang,
|
|
46
|
+
tournament,
|
|
47
|
+
playerId,
|
|
48
|
+
).buildBS(),
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
subscribeOnStatusScreen(tournamentId: string, clientAuthToken: string): void {
|
|
53
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
54
|
+
const tournament =
|
|
55
|
+
this.oneTableRoomsManagerService.getRoomById(tournamentId);
|
|
56
|
+
|
|
57
|
+
if (player && tournament) {
|
|
58
|
+
tournament.addToStatusScreenWatchers(player);
|
|
59
|
+
|
|
60
|
+
return;
|
|
41
61
|
}
|
|
42
62
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const tournament = this.oneTableRoomsManagerService.getRoomById(tournamentId);
|
|
63
|
+
throw new InternalServerErrorException();
|
|
64
|
+
}
|
|
46
65
|
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
unsubscribeFromStatusScreen(
|
|
67
|
+
tournamentId: string,
|
|
68
|
+
clientAuthToken: string,
|
|
69
|
+
): void {
|
|
70
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
71
|
+
const tournament =
|
|
72
|
+
this.oneTableRoomsManagerService.getRoomById(tournamentId);
|
|
49
73
|
|
|
50
|
-
|
|
51
|
-
|
|
74
|
+
if (player && tournament) {
|
|
75
|
+
tournament.removeFromStatusScreenWatchers(player);
|
|
52
76
|
|
|
53
|
-
|
|
77
|
+
return;
|
|
54
78
|
}
|
|
55
79
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const tournament = this.oneTableRoomsManagerService.getRoomById(tournamentId);
|
|
80
|
+
throw new InternalServerErrorException();
|
|
81
|
+
}
|
|
59
82
|
|
|
60
|
-
|
|
61
|
-
|
|
83
|
+
watchTheTable(tableId: string, clientAuthToken: string): IAppTableState {
|
|
84
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
85
|
+
const room = this.oneTableRoomsManagerService.getRoomByTableId(tableId);
|
|
86
|
+
const master = room?.getMasterById(tableId);
|
|
62
87
|
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
if (player && room && master) {
|
|
89
|
+
room.handleWatchTheTable(player, tableId);
|
|
65
90
|
|
|
66
|
-
|
|
91
|
+
return master.createGameStateDto(player);
|
|
67
92
|
}
|
|
68
93
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const room = this.oneTableRoomsManagerService.getRoomByTableId(tableId);
|
|
72
|
-
const master = room?.getMasterById(tableId);
|
|
94
|
+
throw new InternalServerErrorException();
|
|
95
|
+
}
|
|
73
96
|
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
moveOnTheTable(
|
|
98
|
+
tableId: string,
|
|
99
|
+
clientAuthToken: string,
|
|
100
|
+
moveDto: IBaseMoveData,
|
|
101
|
+
): IAppTableState {
|
|
102
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
103
|
+
const room = this.oneTableRoomsManagerService.getRoomByTableId(tableId);
|
|
104
|
+
const master = room?.getMasterById(tableId);
|
|
76
105
|
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
if (player && room && master) {
|
|
107
|
+
room.handleMoveOnTheTable(player, tableId, moveDto);
|
|
79
108
|
|
|
80
|
-
|
|
109
|
+
return master.createGameStateDto(player);
|
|
81
110
|
}
|
|
82
111
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const room = this.oneTableRoomsManagerService.getRoomByTableId(tableId);
|
|
86
|
-
const master = room?.getMasterById(tableId);
|
|
112
|
+
throw new InternalServerErrorException();
|
|
113
|
+
}
|
|
87
114
|
|
|
88
|
-
|
|
89
|
-
|
|
115
|
+
joinTournament(tournamentId: string, headers: IAppHeaders): IBaseAppScreen {
|
|
116
|
+
const player = this.playersManager.getPlayerById(headers.client_auth_token);
|
|
117
|
+
const tournament =
|
|
118
|
+
this.oneTableRoomsManagerService.getRoomByTableId(tournamentId);
|
|
90
119
|
|
|
91
|
-
|
|
92
|
-
|
|
120
|
+
if (player && tournament) {
|
|
121
|
+
tournament.handleJoinTournament(player);
|
|
93
122
|
|
|
94
|
-
|
|
123
|
+
return this.getStatusScreen(
|
|
124
|
+
tournamentId,
|
|
125
|
+
headers.client_language,
|
|
126
|
+
headers.client_auth_token,
|
|
127
|
+
);
|
|
95
128
|
}
|
|
96
129
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const tournament = this.oneTableRoomsManagerService.getRoomByTableId(tournamentId);
|
|
130
|
+
throw new InternalServerErrorException();
|
|
131
|
+
}
|
|
100
132
|
|
|
101
|
-
|
|
102
|
-
|
|
133
|
+
leaveTournament(tournamentId: string, clientAuthToken: string): void {
|
|
134
|
+
const player = this.playersManager.getPlayerById(clientAuthToken);
|
|
135
|
+
const tournament =
|
|
136
|
+
this.oneTableRoomsManagerService.getRoomByTableId(tournamentId);
|
|
103
137
|
|
|
104
|
-
|
|
105
|
-
|
|
138
|
+
if (player && tournament) {
|
|
139
|
+
tournament.handleLeaveTournament(player);
|
|
106
140
|
|
|
107
|
-
|
|
141
|
+
return;
|
|
108
142
|
}
|
|
109
143
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const tournament = this.oneTableRoomsManagerService.getRoomByTableId(tournamentId);
|
|
113
|
-
|
|
114
|
-
if (player && tournament) {
|
|
115
|
-
tournament.handleLeaveTournament(player);
|
|
116
|
-
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
throw new InternalServerErrorException();
|
|
121
|
-
}
|
|
144
|
+
throw new InternalServerErrorException();
|
|
145
|
+
}
|
|
122
146
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Global, Module } from '@nestjs/common';
|
|
2
2
|
import { PlayersManagerService } from './players-manager.service';
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
@Global()
|
|
6
5
|
@Module({
|
|
7
6
|
providers: [PlayersManagerService],
|
|
8
|
-
exports: [PlayersManagerService]
|
|
7
|
+
exports: [PlayersManagerService],
|
|
9
8
|
})
|
|
10
9
|
export class PlayersManagerModule {}
|
|
@@ -5,23 +5,23 @@ import { GamePlayer } from 'jp.ms.common.engine';
|
|
|
5
5
|
export class PlayersManagerService {
|
|
6
6
|
private readonly players: Map<string, GamePlayer>;
|
|
7
7
|
|
|
8
|
-
constructor
|
|
8
|
+
constructor() {
|
|
9
9
|
this.players = new Map<string, GamePlayer>();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
getPlayerById
|
|
12
|
+
getPlayerById(playerId: string): GamePlayer | undefined {
|
|
13
13
|
return this.players.get(playerId);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
getPlayers
|
|
16
|
+
getPlayers(): Array<GamePlayer> {
|
|
17
17
|
return Array.from(this.players.values());
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
addPlayer
|
|
20
|
+
addPlayer(player: GamePlayer): void {
|
|
21
21
|
this.players.set(player.id, player);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
removePlayer
|
|
24
|
+
removePlayer(playerId: string): void {
|
|
25
25
|
this.players.delete(playerId);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,54 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
Param,
|
|
5
|
+
Post,
|
|
6
|
+
Headers,
|
|
7
|
+
HttpStatus,
|
|
8
|
+
HttpCode,
|
|
9
|
+
} from '@nestjs/common';
|
|
2
10
|
import { IAppHeaders, IBaseMoveData, IAppTableState } from 'jp.common.models';
|
|
3
11
|
|
|
4
12
|
import { SimpleRoomsService } from './simple-rooms.service';
|
|
5
13
|
|
|
6
14
|
@Controller('simple-rooms')
|
|
7
15
|
export class SimpleRoomsController {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@
|
|
13
|
-
@
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
): IAppTableState {
|
|
18
|
-
return this.roomsService.watchTheTable(tableId, headers.client_auth_token);
|
|
19
|
-
}
|
|
16
|
+
constructor(private readonly roomsService: SimpleRoomsService) {}
|
|
17
|
+
@Post('table/watch/:tableId')
|
|
18
|
+
@HttpCode(HttpStatus.OK)
|
|
19
|
+
watchTheTable(
|
|
20
|
+
@Param('tableId') tableId: string,
|
|
21
|
+
@Headers() headers: IAppHeaders,
|
|
22
|
+
): IAppTableState {
|
|
23
|
+
return this.roomsService.watchTheTable(tableId, headers.client_auth_token);
|
|
24
|
+
}
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
@Post('table/enter/:tableId')
|
|
27
|
+
@HttpCode(HttpStatus.OK)
|
|
28
|
+
enterTheTable(
|
|
29
|
+
@Param('tableId') tableId: string,
|
|
30
|
+
@Headers() headers: IAppHeaders,
|
|
31
|
+
): IAppTableState {
|
|
32
|
+
return this.roomsService.enterTheTable(tableId, headers.client_auth_token);
|
|
33
|
+
}
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
@Post('table/exit/:tableId')
|
|
36
|
+
@HttpCode(HttpStatus.OK)
|
|
37
|
+
exitTheTable(
|
|
38
|
+
@Param('tableId') tableId: string,
|
|
39
|
+
@Headers() headers: IAppHeaders,
|
|
40
|
+
): IAppTableState {
|
|
41
|
+
return this.roomsService.exitTheTable(tableId, headers.client_auth_token);
|
|
42
|
+
}
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
@Post('table/move/:tableId')
|
|
45
|
+
@HttpCode(HttpStatus.OK)
|
|
46
|
+
moveOnTheTable(
|
|
47
|
+
@Param('tableId') tableId: string,
|
|
48
|
+
@Body() baseMoveData: IBaseMoveData,
|
|
49
|
+
@Headers() headers: IAppHeaders,
|
|
50
|
+
): IAppTableState {
|
|
51
|
+
return this.roomsService.moveOnTheTable(
|
|
52
|
+
tableId,
|
|
53
|
+
headers.client_auth_token,
|
|
54
|
+
baseMoveData,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
@Post('table/restart/:tableId')
|
|
59
|
+
@HttpCode(HttpStatus.OK)
|
|
60
|
+
restartTable(@Param('tableId') tableId: string): boolean {
|
|
61
|
+
return this.roomsService.restartTable(tableId);
|
|
62
|
+
}
|
|
54
63
|
}
|
|
@@ -4,12 +4,15 @@ 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
6
|
|
|
7
|
-
export interface SimpleRoomsModuleOptions
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export interface SimpleRoomsModuleOptions
|
|
8
|
+
extends Pick<ModuleMetadata, 'imports'> {
|
|
9
|
+
imports?: Array<
|
|
10
|
+
Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference
|
|
11
|
+
>;
|
|
12
|
+
inject?: any[];
|
|
13
|
+
useFactory?: (...args: any[]) => Promise<any> | any;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export interface SimpleRoomsFactoryOptions {
|
|
14
|
-
|
|
17
|
+
i18n: I18nService;
|
|
15
18
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { DynamicModule, Module, Provider } from '@nestjs/common';
|
|
2
2
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
SimpleRoom,
|
|
5
|
+
SimpleRoomSchema,
|
|
6
|
+
SimpleRoomsRepository,
|
|
7
|
+
} from 'jp.db.schemas';
|
|
4
8
|
|
|
5
9
|
import { SimpleRoomsController } from './simple-rooms.controller';
|
|
6
10
|
import { SimpleRoomsService } from './simple-rooms.service';
|
|
@@ -8,29 +12,28 @@ import { SIMPLE_ROOMS_OPTIONS } from './simple-rooms.constants';
|
|
|
8
12
|
import { SimpleRoomsModuleOptions } from './simple-rooms.interfaces';
|
|
9
13
|
|
|
10
14
|
@Module({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
imports: [
|
|
16
|
+
MongooseModule.forFeature([
|
|
17
|
+
{ name: SimpleRoom.name, schema: SimpleRoomSchema },
|
|
18
|
+
]),
|
|
19
|
+
],
|
|
20
|
+
controllers: [SimpleRoomsController],
|
|
21
|
+
providers: [SimpleRoomsService, SimpleRoomsRepository],
|
|
16
22
|
})
|
|
17
23
|
export class SimpleRoomsModule {
|
|
18
|
-
|
|
24
|
+
constructor() {}
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
26
|
+
static forRootAsync(options: SimpleRoomsModuleOptions): DynamicModule {
|
|
27
|
+
return {
|
|
28
|
+
module: SimpleRoomsModule,
|
|
29
|
+
imports: options.imports ?? [],
|
|
30
|
+
providers: [
|
|
31
|
+
{
|
|
32
|
+
provide: SIMPLE_ROOMS_OPTIONS,
|
|
33
|
+
useFactory: options.useFactory,
|
|
34
|
+
inject: options.inject || [],
|
|
35
|
+
} as Provider,
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
|
-
|