jp.ms.common.modules 1.0.41 → 1.0.43
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/dto/app-table/card.dto.d.ts +1 -0
- package/dist/dto/app-table/card.dto.js +11 -0
- package/dist/dto/app-table/card.dto.js.map +1 -1
- package/dist/dto/app-table/player.dto.d.ts +1 -0
- package/dist/dto/app-table/player.dto.js +11 -0
- package/dist/dto/app-table/player.dto.js.map +1 -1
- package/dist/dto/games/fool/fool-table.dto.d.ts +1 -0
- package/dist/dto/games/fool/fool-table.dto.js +10 -0
- package/dist/dto/games/fool/fool-table.dto.js.map +1 -1
- 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 +19 -5
- 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.controller.d.ts +0 -1
- package/dist/modules/main/main.controller.js +0 -12
- package/dist/modules/main/main.controller.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/main/main.service.d.ts +0 -1
- package/dist/modules/main/main.service.js +0 -13
- package/dist/modules/main/main.service.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.d.ts +1 -0
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js +12 -0
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.module.js +7 -2
- 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 +4 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js +18 -2
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js.map +1 -1
- package/dist/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.module.js +2 -0
- package/dist/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.module.js.map +1 -1
- package/dist/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.service.d.ts +3 -2
- package/dist/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.service.js +9 -6
- package/dist/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.service.js.map +1 -1
- package/dist/modules/menu/menu-screen.view.d.ts +2 -1
- package/dist/modules/menu/menu-screen.view.js +9 -3
- package/dist/modules/menu/menu-screen.view.js.map +1 -1
- package/dist/modules/menu/menu.interfaces.d.ts +1 -0
- 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.module.js +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.module.js.map +1 -1
- package/dist/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.module.js +2 -0
- package/dist/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.module.js.map +1 -1
- package/dist/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.service.d.ts +3 -2
- package/dist/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.service.js +9 -6
- package/dist/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.service.js.map +1 -1
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.module.js +2 -0
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.module.js.map +1 -1
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.d.ts +3 -2
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.js +8 -5
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/game-table-result.d.ts +4 -3
- package/dist/utils/game-table-result.js +54 -4
- package/dist/utils/game-table-result.js.map +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 +63 -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 +78 -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 +89 -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 +84 -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 +51 -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 +154 -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 +164 -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 +89 -80
- package/src/modules/many-tables-tournament/many-tables-tournament.service.ts +241 -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 +89 -84
- package/src/modules/many-tables-tournament-rooms-manager/many-tables-tournament-rooms-manager.service.ts +333 -331
- package/src/modules/menu/index.ts +1 -1
- package/src/modules/menu/menu-screen.view.ts +78 -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 +18 -17
- package/src/modules/menu/menu.module.ts +39 -39
- package/src/modules/menu/menu.service.ts +40 -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 +71 -66
- package/src/modules/one-table-tournament-rooms-manager/one-table-tournament-rooms-manager.service.ts +222 -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 +65 -60
- package/src/modules/simple-rooms-manager/simple-rooms-manager.service.ts +192 -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 +190 -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,151 +1,164 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Body,
|
|
3
|
-
Controller,
|
|
4
|
-
Get,
|
|
5
|
-
Param,
|
|
6
|
-
Post,
|
|
7
|
-
Headers,
|
|
8
|
-
HttpStatus,
|
|
9
|
-
HttpCode,
|
|
10
|
-
Patch,
|
|
11
|
-
Delete,
|
|
12
|
-
} from '@nestjs/common';
|
|
13
|
-
import {
|
|
14
|
-
IAppHeaders,
|
|
15
|
-
IBaseAppScreen,
|
|
16
|
-
IBaseMoveData,
|
|
17
|
-
IAppTableState,
|
|
18
|
-
} from 'jp.common.models';
|
|
19
|
-
|
|
20
|
-
import { ManyTablesTournamentService } from './many-tables-tournament.service';
|
|
21
|
-
import { JoinTournamentDto } from '../../dto/common/join-tournament.dto';
|
|
22
|
-
import { ManyTablesTournamentCreateDto } from '../../dto/common/many-tables-tournament-create.dto';
|
|
23
|
-
import { ManyTablesTournamentUpdateDto } from '../../dto/common/many-tables-tournament-update.dto';
|
|
24
|
-
|
|
25
|
-
@Controller('tournament/many_tables')
|
|
26
|
-
export class ManyTablesTournamentController {
|
|
27
|
-
constructor(
|
|
28
|
-
private readonly tournamentService: ManyTablesTournamentService,
|
|
29
|
-
) {}
|
|
30
|
-
|
|
31
|
-
@Get('status/:tournamentId')
|
|
32
|
-
getStatusScreen(
|
|
33
|
-
@Param('tournamentId') tournamentId: string,
|
|
34
|
-
@Headers() headers: IAppHeaders,
|
|
35
|
-
): IBaseAppScreen {
|
|
36
|
-
return this.tournamentService.getStatusScreen(
|
|
37
|
-
tournamentId,
|
|
38
|
-
headers.client_language,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Get('status/subscribe/:tournamentId')
|
|
43
|
-
subscribeOnStatusScreen(
|
|
44
|
-
@Param('tournamentId') tournamentId: string,
|
|
45
|
-
@Headers() headers: IAppHeaders,
|
|
46
|
-
): void {
|
|
47
|
-
return this.tournamentService.subscribeOnStatusScreen(
|
|
48
|
-
tournamentId,
|
|
49
|
-
headers.client_auth_token,
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@Get('status/unsubscribe/:tournamentId')
|
|
54
|
-
unsubscribeFromStatusScreen(
|
|
55
|
-
@Param('tournamentId') tournamentId: string,
|
|
56
|
-
@Headers() headers: IAppHeaders,
|
|
57
|
-
): void {
|
|
58
|
-
return this.tournamentService.unsubscribeFromStatusScreen(
|
|
59
|
-
tournamentId,
|
|
60
|
-
headers.client_auth_token,
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@Get('tables/:tournamentId')
|
|
65
|
-
getTableListScreen(
|
|
66
|
-
@Param('tournamentId') tournamentId: string,
|
|
67
|
-
@Headers() headers: IAppHeaders,
|
|
68
|
-
): IBaseAppScreen {
|
|
69
|
-
return this.tournamentService.getTableListScreen(
|
|
70
|
-
tournamentId,
|
|
71
|
-
headers.client_language,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@Post('table/watch/:tableId')
|
|
76
|
-
@HttpCode(HttpStatus.OK)
|
|
77
|
-
watchTheTable(
|
|
78
|
-
@Param('tableId') tableId: string,
|
|
79
|
-
@Headers() headers: IAppHeaders,
|
|
80
|
-
): IAppTableState {
|
|
81
|
-
return this.tournamentService.watchTheTable(
|
|
82
|
-
tableId,
|
|
83
|
-
headers.client_auth_token,
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@Post('table/move/:tableId')
|
|
88
|
-
@HttpCode(HttpStatus.OK)
|
|
89
|
-
moveOnTheTable(
|
|
90
|
-
@Param('tableId') tableId: string,
|
|
91
|
-
@Body() baseMoveData: IBaseMoveData,
|
|
92
|
-
@Headers() headers: IAppHeaders,
|
|
93
|
-
): IAppTableState {
|
|
94
|
-
return this.tournamentService.moveOnTheTable(
|
|
95
|
-
tableId,
|
|
96
|
-
headers.client_auth_token,
|
|
97
|
-
baseMoveData,
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@Post('join/:tournamentId')
|
|
102
|
-
@HttpCode(HttpStatus.OK)
|
|
103
|
-
joinTournament(
|
|
104
|
-
@Param('tournamentId') tournamentId: string,
|
|
105
|
-
@Headers() headers: IAppHeaders,
|
|
106
|
-
): JoinTournamentDto {
|
|
107
|
-
return this.tournamentService.joinTournament(
|
|
108
|
-
tournamentId,
|
|
109
|
-
headers.client_auth_token,
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@Post('leave/:tournamentId')
|
|
114
|
-
@HttpCode(HttpStatus.OK)
|
|
115
|
-
leaveTournament(
|
|
116
|
-
@Param('tournamentId') tournamentId: string,
|
|
117
|
-
@Headers() headers: IAppHeaders,
|
|
118
|
-
): void {
|
|
119
|
-
return this.tournamentService.leaveTournament(
|
|
120
|
-
tournamentId,
|
|
121
|
-
headers.client_auth_token,
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@Post('create')
|
|
126
|
-
@HttpCode(HttpStatus.OK)
|
|
127
|
-
createTournament(
|
|
128
|
-
@Headers() headers: IAppHeaders,
|
|
129
|
-
@Body() createTournamentDto: ManyTablesTournamentCreateDto,
|
|
130
|
-
): Promise<void> {
|
|
131
|
-
return this.tournamentService.createTournament(createTournamentDto);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@Patch('update/:tournamentId')
|
|
135
|
-
@HttpCode(HttpStatus.OK)
|
|
136
|
-
updateTournament(
|
|
137
|
-
@Param('tournamentId') tournamentId: string,
|
|
138
|
-
@Body() updateTournamentDto: ManyTablesTournamentUpdateDto,
|
|
139
|
-
): Promise<void> {
|
|
140
|
-
return this.tournamentService.updateTournament(
|
|
141
|
-
tournamentId,
|
|
142
|
-
updateTournamentDto,
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
@Delete('remove/:tournamentId')
|
|
147
|
-
@HttpCode(HttpStatus.OK)
|
|
148
|
-
removeTournament(@Param('tournamentId') tournamentId: string): Promise<void> {
|
|
149
|
-
return this.tournamentService.removeTournament(tournamentId);
|
|
150
|
-
}
|
|
151
|
-
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
Get,
|
|
5
|
+
Param,
|
|
6
|
+
Post,
|
|
7
|
+
Headers,
|
|
8
|
+
HttpStatus,
|
|
9
|
+
HttpCode,
|
|
10
|
+
Patch,
|
|
11
|
+
Delete,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import {
|
|
14
|
+
IAppHeaders,
|
|
15
|
+
IBaseAppScreen,
|
|
16
|
+
IBaseMoveData,
|
|
17
|
+
IAppTableState,
|
|
18
|
+
} from 'jp.common.models';
|
|
19
|
+
|
|
20
|
+
import { ManyTablesTournamentService } from './many-tables-tournament.service';
|
|
21
|
+
import { JoinTournamentDto } from '../../dto/common/join-tournament.dto';
|
|
22
|
+
import { ManyTablesTournamentCreateDto } from '../../dto/common/many-tables-tournament-create.dto';
|
|
23
|
+
import { ManyTablesTournamentUpdateDto } from '../../dto/common/many-tables-tournament-update.dto';
|
|
24
|
+
|
|
25
|
+
@Controller('tournament/many_tables')
|
|
26
|
+
export class ManyTablesTournamentController {
|
|
27
|
+
constructor(
|
|
28
|
+
private readonly tournamentService: ManyTablesTournamentService,
|
|
29
|
+
) {}
|
|
30
|
+
|
|
31
|
+
@Get('status/:tournamentId')
|
|
32
|
+
getStatusScreen(
|
|
33
|
+
@Param('tournamentId') tournamentId: string,
|
|
34
|
+
@Headers() headers: IAppHeaders,
|
|
35
|
+
): IBaseAppScreen {
|
|
36
|
+
return this.tournamentService.getStatusScreen(
|
|
37
|
+
tournamentId,
|
|
38
|
+
headers.client_language,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Get('status/subscribe/:tournamentId')
|
|
43
|
+
subscribeOnStatusScreen(
|
|
44
|
+
@Param('tournamentId') tournamentId: string,
|
|
45
|
+
@Headers() headers: IAppHeaders,
|
|
46
|
+
): void {
|
|
47
|
+
return this.tournamentService.subscribeOnStatusScreen(
|
|
48
|
+
tournamentId,
|
|
49
|
+
headers.client_auth_token,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Get('status/unsubscribe/:tournamentId')
|
|
54
|
+
unsubscribeFromStatusScreen(
|
|
55
|
+
@Param('tournamentId') tournamentId: string,
|
|
56
|
+
@Headers() headers: IAppHeaders,
|
|
57
|
+
): void {
|
|
58
|
+
return this.tournamentService.unsubscribeFromStatusScreen(
|
|
59
|
+
tournamentId,
|
|
60
|
+
headers.client_auth_token,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Get('tables/:tournamentId')
|
|
65
|
+
getTableListScreen(
|
|
66
|
+
@Param('tournamentId') tournamentId: string,
|
|
67
|
+
@Headers() headers: IAppHeaders,
|
|
68
|
+
): IBaseAppScreen {
|
|
69
|
+
return this.tournamentService.getTableListScreen(
|
|
70
|
+
tournamentId,
|
|
71
|
+
headers.client_language,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Post('table/watch/:tableId')
|
|
76
|
+
@HttpCode(HttpStatus.OK)
|
|
77
|
+
watchTheTable(
|
|
78
|
+
@Param('tableId') tableId: string,
|
|
79
|
+
@Headers() headers: IAppHeaders,
|
|
80
|
+
): IAppTableState {
|
|
81
|
+
return this.tournamentService.watchTheTable(
|
|
82
|
+
tableId,
|
|
83
|
+
headers.client_auth_token,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@Post('table/move/:tableId')
|
|
88
|
+
@HttpCode(HttpStatus.OK)
|
|
89
|
+
moveOnTheTable(
|
|
90
|
+
@Param('tableId') tableId: string,
|
|
91
|
+
@Body() baseMoveData: IBaseMoveData,
|
|
92
|
+
@Headers() headers: IAppHeaders,
|
|
93
|
+
): IAppTableState {
|
|
94
|
+
return this.tournamentService.moveOnTheTable(
|
|
95
|
+
tableId,
|
|
96
|
+
headers.client_auth_token,
|
|
97
|
+
baseMoveData,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Post('join/:tournamentId')
|
|
102
|
+
@HttpCode(HttpStatus.OK)
|
|
103
|
+
joinTournament(
|
|
104
|
+
@Param('tournamentId') tournamentId: string,
|
|
105
|
+
@Headers() headers: IAppHeaders,
|
|
106
|
+
): JoinTournamentDto {
|
|
107
|
+
return this.tournamentService.joinTournament(
|
|
108
|
+
tournamentId,
|
|
109
|
+
headers.client_auth_token,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@Post('leave/:tournamentId')
|
|
114
|
+
@HttpCode(HttpStatus.OK)
|
|
115
|
+
leaveTournament(
|
|
116
|
+
@Param('tournamentId') tournamentId: string,
|
|
117
|
+
@Headers() headers: IAppHeaders,
|
|
118
|
+
): void {
|
|
119
|
+
return this.tournamentService.leaveTournament(
|
|
120
|
+
tournamentId,
|
|
121
|
+
headers.client_auth_token,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@Post('create')
|
|
126
|
+
@HttpCode(HttpStatus.OK)
|
|
127
|
+
createTournament(
|
|
128
|
+
@Headers() headers: IAppHeaders,
|
|
129
|
+
@Body() createTournamentDto: ManyTablesTournamentCreateDto,
|
|
130
|
+
): Promise<void> {
|
|
131
|
+
return this.tournamentService.createTournament(createTournamentDto);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@Patch('update/:tournamentId')
|
|
135
|
+
@HttpCode(HttpStatus.OK)
|
|
136
|
+
updateTournament(
|
|
137
|
+
@Param('tournamentId') tournamentId: string,
|
|
138
|
+
@Body() updateTournamentDto: ManyTablesTournamentUpdateDto,
|
|
139
|
+
): Promise<void> {
|
|
140
|
+
return this.tournamentService.updateTournament(
|
|
141
|
+
tournamentId,
|
|
142
|
+
updateTournamentDto,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@Delete('remove/:tournamentId')
|
|
147
|
+
@HttpCode(HttpStatus.OK)
|
|
148
|
+
removeTournament(@Param('tournamentId') tournamentId: string): Promise<void> {
|
|
149
|
+
return this.tournamentService.removeTournament(tournamentId);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@Post('many_tables_tournament/buy_ticket/:tournamentId')
|
|
153
|
+
@HttpCode(HttpStatus.OK)
|
|
154
|
+
buyTicket(
|
|
155
|
+
@Param('tournamentId') tournamentId: string,
|
|
156
|
+
@Headers() headers: IAppHeaders,
|
|
157
|
+
): Promise<void> {
|
|
158
|
+
return this.tournamentService.manyTablesTournamentbBuyTicket(
|
|
159
|
+
headers.client_auth_token,
|
|
160
|
+
headers.client_language,
|
|
161
|
+
tournamentId,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ModuleMetadata } from '@nestjs/common';
|
|
2
|
-
import { I18nService } from 'nestjs-i18n';
|
|
3
|
-
import { Type } from '@nestjs/common/interfaces/type.interface';
|
|
4
|
-
import { DynamicModule } from '@nestjs/common/interfaces/modules/dynamic-module.interface';
|
|
5
|
-
import { ForwardReference } from '@nestjs/common/interfaces/modules/forward-reference.interface';
|
|
6
|
-
|
|
7
|
-
export interface ManyTablesTournamentModuleOptions extends Pick<
|
|
8
|
-
ModuleMetadata,
|
|
9
|
-
'imports'
|
|
10
|
-
> {
|
|
11
|
-
imports?: Array<
|
|
12
|
-
Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference
|
|
13
|
-
>;
|
|
14
|
-
inject?: any[];
|
|
15
|
-
useFactory?: (...args: any[]) => Promise<any> | any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ManyTablesTournamentFactoryOptions {
|
|
19
|
-
i18n: I18nService;
|
|
20
|
-
}
|
|
1
|
+
import { ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { I18nService } from 'nestjs-i18n';
|
|
3
|
+
import { Type } from '@nestjs/common/interfaces/type.interface';
|
|
4
|
+
import { DynamicModule } from '@nestjs/common/interfaces/modules/dynamic-module.interface';
|
|
5
|
+
import { ForwardReference } from '@nestjs/common/interfaces/modules/forward-reference.interface';
|
|
6
|
+
|
|
7
|
+
export interface ManyTablesTournamentModuleOptions extends Pick<
|
|
8
|
+
ModuleMetadata,
|
|
9
|
+
'imports'
|
|
10
|
+
> {
|
|
11
|
+
imports?: Array<
|
|
12
|
+
Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference
|
|
13
|
+
>;
|
|
14
|
+
inject?: any[];
|
|
15
|
+
useFactory?: (...args: any[]) => Promise<any> | any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ManyTablesTournamentFactoryOptions {
|
|
19
|
+
i18n: I18nService;
|
|
20
|
+
}
|
|
@@ -1,80 +1,89 @@
|
|
|
1
|
-
import { DynamicModule, Module, Provider } from '@nestjs/common';
|
|
2
|
-
import { MongooseModule } from '@nestjs/mongoose';
|
|
3
|
-
import {
|
|
4
|
-
ManyTablesTournamentRoom,
|
|
5
|
-
ManyTablesTournamentRoomSchema,
|
|
6
|
-
ManyTablesTournamentRoomsRepository,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { DynamicModule, Module, Provider } from '@nestjs/common';
|
|
2
|
+
import { MongooseModule } from '@nestjs/mongoose';
|
|
3
|
+
import {
|
|
4
|
+
ManyTablesTournamentRoom,
|
|
5
|
+
ManyTablesTournamentRoomSchema,
|
|
6
|
+
ManyTablesTournamentRoomsRepository,
|
|
7
|
+
User,
|
|
8
|
+
UserSchema,
|
|
9
|
+
UsersRepository,
|
|
10
|
+
} from 'jp.db.schemas';
|
|
11
|
+
import {
|
|
12
|
+
GamePlayer,
|
|
13
|
+
ManyTablesTournamentUpdateStatusWsEvent,
|
|
14
|
+
RoomUpdateStateEvent,
|
|
15
|
+
} from 'jp.ms.common.engine';
|
|
16
|
+
|
|
17
|
+
import { ManyTablesTournamentRoomsManagerService } from '../many-tables-tournament-rooms-manager';
|
|
18
|
+
import { EventsBusManyTablesTournamentSubscribeService } from '../event-bus';
|
|
19
|
+
|
|
20
|
+
import { ManyTablesTournamentController } from './many-tables-tournament.controller';
|
|
21
|
+
import { ManyTablesTournamentService } from './many-tables-tournament.service';
|
|
22
|
+
import { MANY_TABLES_TOURNAMENT_OPTIONS } from './many-tables-tournament.constants';
|
|
23
|
+
import { ManyTablesTournamentModuleOptions } from './many-tables-tournament.interfaces';
|
|
24
|
+
|
|
25
|
+
@Module({
|
|
26
|
+
imports: [
|
|
27
|
+
MongooseModule.forFeature([
|
|
28
|
+
{
|
|
29
|
+
name: ManyTablesTournamentRoom.name,
|
|
30
|
+
schema: ManyTablesTournamentRoomSchema,
|
|
31
|
+
},
|
|
32
|
+
]),
|
|
33
|
+
MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
|
|
34
|
+
],
|
|
35
|
+
controllers: [ManyTablesTournamentController],
|
|
36
|
+
providers: [
|
|
37
|
+
ManyTablesTournamentService,
|
|
38
|
+
ManyTablesTournamentRoomsRepository,
|
|
39
|
+
UsersRepository,
|
|
40
|
+
],
|
|
41
|
+
})
|
|
42
|
+
export class ManyTablesTournamentModule {
|
|
43
|
+
constructor(
|
|
44
|
+
private readonly manyTablesRoomsManagerService: ManyTablesTournamentRoomsManagerService,
|
|
45
|
+
private readonly eventsBusManyTablesTournamentSubscribeService: EventsBusManyTablesTournamentSubscribeService,
|
|
46
|
+
private readonly manyTablesTournamentService: ManyTablesTournamentService,
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
static forRootAsync(
|
|
50
|
+
options: ManyTablesTournamentModuleOptions,
|
|
51
|
+
): DynamicModule {
|
|
52
|
+
return {
|
|
53
|
+
module: ManyTablesTournamentModule,
|
|
54
|
+
imports: options.imports ?? [],
|
|
55
|
+
providers: [
|
|
56
|
+
{
|
|
57
|
+
provide: MANY_TABLES_TOURNAMENT_OPTIONS,
|
|
58
|
+
useFactory: options.useFactory,
|
|
59
|
+
inject: options.inject || [],
|
|
60
|
+
} as Provider,
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onModuleInit() {
|
|
66
|
+
this.eventsBusManyTablesTournamentSubscribeService.subscribe(
|
|
67
|
+
this.onHandleStatusRoomChange,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onHandleStatusRoomChange = (event: RoomUpdateStateEvent) => {
|
|
72
|
+
this.manyTablesRoomsManagerService
|
|
73
|
+
.getRoomById(event.roomId)
|
|
74
|
+
?.getStatusScreenWatchers()
|
|
75
|
+
.forEach((subscriber: GamePlayer) => {
|
|
76
|
+
const screen = this.manyTablesTournamentService.getStatusScreen(
|
|
77
|
+
event.roomId,
|
|
78
|
+
subscriber.language,
|
|
79
|
+
);
|
|
80
|
+
subscriber.sendMessage(
|
|
81
|
+
new ManyTablesTournamentUpdateStatusWsEvent(
|
|
82
|
+
event.game,
|
|
83
|
+
subscriber.id,
|
|
84
|
+
screen.screen,
|
|
85
|
+
),
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
}
|