Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WIMMA Lab 2019
Overflow
ehasa-backend
Commits
4aa0c47c
Commit
4aa0c47c
authored
5 years ago
by
Ronnie Friman
Browse files
Options
Downloads
Patches
Plain Diff
added socket-notifs
parent
01da9d6f
No related branches found
No related tags found
3 merge requests
!59
Development to master
,
!36
Development
,
!33
Small fixes
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/game/game.service.ts
+4
-2
4 additions, 2 deletions
src/game/game.service.ts
src/score/score.service.ts
+3
-1
3 additions, 1 deletion
src/score/score.service.ts
src/task/task.service.ts
+2
-2
2 additions, 2 deletions
src/task/task.service.ts
with
9 additions
and
5 deletions
src/game/game.service.ts
+
4
−
2
View file @
4aa0c47c
...
...
@@ -149,7 +149,9 @@ export class GameService {
updatedGame
.
state
=
game
.
state
;
await
this
.
gameRepository
.
save
(
updatedGame
);
// notify players about game state change
this
.
notificationGateway
.
server
.
emit
(
game
.
id
,
'
event update
'
);
this
.
notificationGateway
.
server
.
emit
(
game
.
id
,
{
type
:
'
gamestate-update
'
,
});
return
{
code
:
200
,
message
:
'
State was updated
'
,
...
...
@@ -217,7 +219,7 @@ export class GameService {
});
await
this
.
objectivePoint_HistoryRepository
.
insert
(
eventUpdate
);
// send flagbox event to flagbox subscribers
this
.
notificationGateway
.
server
.
emit
(
'
flagbox
'
,
'
event
update
'
);
this
.
notificationGateway
.
server
.
emit
(
gameId
,
{
type
:
'
flagbox
-
event
'
}
);
return
{
code
:
201
,
message
:
'
OK
'
,
...
...
This diff is collapsed.
Click to expand it.
src/score/score.service.ts
+
3
−
1
View file @
4aa0c47c
...
...
@@ -10,7 +10,7 @@ import {
GameEntity
,
}
from
'
../game/game.entity
'
;
import
{
ScoreEntity
}
from
'
./score.entity
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
{
NotificationGateway
}
from
'
../notifications/notifications.gateway
'
;
@
Injectable
()
export
class
ScoreService
{
...
...
@@ -23,6 +23,7 @@ export class ScoreService {
private
flagHistoryRepository
:
Repository
<
ObjectivePoint_HistoryEntity
>
,
@
InjectRepository
(
FactionEntity
)
private
factionRepository
:
Repository
<
FactionEntity
>
,
private
notificationGateway
:
NotificationGateway
,
)
{}
async
addScore
(
scoreData
:
ScoreDTO
,
gameId
:
GameEntity
)
{
...
...
@@ -80,6 +81,7 @@ export class ScoreService {
scoreData
.
map
(
async
data
=>
{
await
this
.
addScore
(
data
,
gameId
);
});
this
.
notificationGateway
.
server
.
emit
(
gameId
,
{
type
:
'
score-update
'
});
return
{
code
:
200
,
message
:
'
Scores added
'
,
...
...
This diff is collapsed.
Click to expand it.
src/task/task.service.ts
+
2
−
2
View file @
4aa0c47c
...
...
@@ -36,8 +36,8 @@ export class TaskService {
// notify subscribers about a new task
// if faction was set it notifies only faction members, else everyone
this
.
notificationGateway
.
server
.
emit
(
task
.
faction
!=
null
?
task
.
faction
.
toString
()
:
'
global
'
,
'
new task
'
,
task
.
faction
!=
null
?
task
.
faction
.
toString
()
:
task
.
taskGame
.
toString
()
,
{
type
:
'
task-update
'
}
,
);
return
{
code
:
201
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment